@@ -212,7 +212,7 @@ func (chaincodeSupport *ChaincodeSupport) registerHandler(chaincodehandler *Hand
212
212
213
213
//now we are ready to receive messages and send back responses
214
214
chaincodehandler .txCtxs = make (map [string ]* transactionContext )
215
- chaincodehandler .uuidMap = make (map [string ]bool )
215
+ chaincodehandler .txidMap = make (map [string ]bool )
216
216
chaincodehandler .isTransaction = make (map [string ]bool )
217
217
218
218
chaincodeLogger .Debugf ("registered handler complete for chaincode %s" , key )
@@ -243,7 +243,7 @@ func (chaincodeSupport *ChaincodeSupport) deregisterHandler(chaincodehandler *Ha
243
243
}
244
244
245
245
// Based on state of chaincode send either init or ready to move to ready state
246
- func (chaincodeSupport * ChaincodeSupport ) sendInitOrReady (context context.Context , uuid string , chaincode string , f * string , initArgs []string , timeout time.Duration , tx * pb.Transaction , depTx * pb.Transaction ) error {
246
+ func (chaincodeSupport * ChaincodeSupport ) sendInitOrReady (context context.Context , txid string , chaincode string , f * string , initArgs []string , timeout time.Duration , tx * pb.Transaction , depTx * pb.Transaction ) error {
247
247
chaincodeSupport .runningChaincodes .Lock ()
248
248
//if its in the map, there must be a connected stream...nothing to do
249
249
var chrte * chaincodeRTEnv
@@ -257,7 +257,7 @@ func (chaincodeSupport *ChaincodeSupport) sendInitOrReady(context context.Contex
257
257
258
258
var notfy chan * pb.ChaincodeMessage
259
259
var err error
260
- if notfy , err = chrte .handler .initOrReady (uuid , f , initArgs , tx , depTx ); err != nil {
260
+ if notfy , err = chrte .handler .initOrReady (txid , f , initArgs , tx , depTx ); err != nil {
261
261
return fmt .Errorf ("Error sending %s: %s" , pb .ChaincodeMessage_INIT , err )
262
262
}
263
263
if notfy != nil {
@@ -272,7 +272,7 @@ func (chaincodeSupport *ChaincodeSupport) sendInitOrReady(context context.Contex
272
272
}
273
273
274
274
//if initOrReady succeeded, our responsibility to delete the context
275
- chrte .handler .deleteTxContext (uuid )
275
+ chrte .handler .deleteTxContext (txid )
276
276
277
277
return err
278
278
}
@@ -309,7 +309,7 @@ func (chaincodeSupport *ChaincodeSupport) getArgsAndEnv(cID *pb.ChaincodeID, cLa
309
309
}
310
310
311
311
// launchAndWaitForRegister will launch container if not already running. Use the targz to create the image if not found
312
- func (chaincodeSupport * ChaincodeSupport ) launchAndWaitForRegister (ctxt context.Context , cds * pb.ChaincodeDeploymentSpec , cID * pb.ChaincodeID , uuid string , cLang pb.ChaincodeSpec_Type , targz io.Reader ) (bool , error ) {
312
+ func (chaincodeSupport * ChaincodeSupport ) launchAndWaitForRegister (ctxt context.Context , cds * pb.ChaincodeDeploymentSpec , cID * pb.ChaincodeID , txid string , cLang pb.ChaincodeSpec_Type , targz io.Reader ) (bool , error ) {
313
313
chaincode := cID .Name
314
314
if chaincode == "" {
315
315
return false , fmt .Errorf ("chaincode name not set" )
@@ -359,10 +359,10 @@ func (chaincodeSupport *ChaincodeSupport) launchAndWaitForRegister(ctxt context.
359
359
select {
360
360
case ok := <- notfy :
361
361
if ! ok {
362
- err = fmt .Errorf ("registration failed for %s(networkid:%s,peerid:%s,tx:%s)" , chaincode , chaincodeSupport .peerNetworkID , chaincodeSupport .peerID , uuid )
362
+ err = fmt .Errorf ("registration failed for %s(networkid:%s,peerid:%s,tx:%s)" , chaincode , chaincodeSupport .peerNetworkID , chaincodeSupport .peerID , txid )
363
363
}
364
364
case <- time .After (chaincodeSupport .ccStartupTimeout ):
365
- err = fmt .Errorf ("Timeout expired while starting chaincode %s(networkid:%s,peerid:%s,tx:%s)" , chaincode , chaincodeSupport .peerNetworkID , chaincodeSupport .peerID , uuid )
365
+ err = fmt .Errorf ("Timeout expired while starting chaincode %s(networkid:%s,peerid:%s,tx:%s)" , chaincode , chaincodeSupport .peerNetworkID , chaincodeSupport .peerID , txid )
366
366
}
367
367
if err != nil {
368
368
chaincodeLogger .Debugf ("stopping due to error while launching %s" , err )
@@ -486,7 +486,7 @@ func (chaincodeSupport *ChaincodeSupport) Launch(context context.Context, t *pb.
486
486
}
487
487
488
488
//hopefully we are restarting from existing image and the deployed transaction exists
489
- depTx , ledgerErr = ledger .GetTransactionByUUID (chaincode )
489
+ depTx , ledgerErr = ledger .GetTransactionByID (chaincode )
490
490
if ledgerErr != nil {
491
491
return cID , cMsg , fmt .Errorf ("Could not get deployment transaction for %s - %s" , chaincode , ledgerErr )
492
492
}
@@ -514,7 +514,7 @@ func (chaincodeSupport *ChaincodeSupport) Launch(context context.Context, t *pb.
514
514
//launch container if it is a System container or not in dev mode
515
515
if (! chaincodeSupport .userRunsCC || cds .ExecEnv == pb .ChaincodeDeploymentSpec_SYSTEM ) && (chrte == nil || chrte .handler == nil ) {
516
516
var targz io.Reader = bytes .NewBuffer (cds .CodePackage )
517
- _ , err = chaincodeSupport .launchAndWaitForRegister (context , cds , cID , t .Uuid , cLang , targz )
517
+ _ , err = chaincodeSupport .launchAndWaitForRegister (context , cds , cID , t .Txid , cLang , targz )
518
518
if err != nil {
519
519
chaincodeLogger .Errorf ("launchAndWaitForRegister failed %s" , err )
520
520
return cID , cMsg , err
@@ -523,7 +523,7 @@ func (chaincodeSupport *ChaincodeSupport) Launch(context context.Context, t *pb.
523
523
524
524
if err == nil {
525
525
//send init (if (f,args)) and wait for ready state
526
- err = chaincodeSupport .sendInitOrReady (context , t .Uuid , chaincode , f , initargs , chaincodeSupport .ccStartupTimeout , t , depTx )
526
+ err = chaincodeSupport .sendInitOrReady (context , t .Txid , chaincode , f , initargs , chaincodeSupport .ccStartupTimeout , t , depTx )
527
527
if err != nil {
528
528
chaincodeLogger .Errorf ("sending init failed(%s)" , err )
529
529
err = fmt .Errorf ("Failed to init chaincode(%s)" , err )
@@ -615,22 +615,22 @@ func (chaincodeSupport *ChaincodeSupport) Register(stream pb.ChaincodeSupport_Re
615
615
}
616
616
617
617
// createTransactionMessage creates a transaction message.
618
- func createTransactionMessage (uuid string , cMsg * pb.ChaincodeInput ) (* pb.ChaincodeMessage , error ) {
618
+ func createTransactionMessage (txid string , cMsg * pb.ChaincodeInput ) (* pb.ChaincodeMessage , error ) {
619
619
payload , err := proto .Marshal (cMsg )
620
620
if err != nil {
621
621
fmt .Printf (err .Error ())
622
622
return nil , err
623
623
}
624
- return & pb.ChaincodeMessage {Type : pb .ChaincodeMessage_TRANSACTION , Payload : payload , Uuid : uuid }, nil
624
+ return & pb.ChaincodeMessage {Type : pb .ChaincodeMessage_TRANSACTION , Payload : payload , Txid : txid }, nil
625
625
}
626
626
627
627
// createQueryMessage creates a query message.
628
- func createQueryMessage (uuid string , cMsg * pb.ChaincodeInput ) (* pb.ChaincodeMessage , error ) {
628
+ func createQueryMessage (txid string , cMsg * pb.ChaincodeInput ) (* pb.ChaincodeMessage , error ) {
629
629
payload , err := proto .Marshal (cMsg )
630
630
if err != nil {
631
631
return nil , err
632
632
}
633
- return & pb.ChaincodeMessage {Type : pb .ChaincodeMessage_QUERY , Payload : payload , Uuid : uuid }, nil
633
+ return & pb.ChaincodeMessage {Type : pb .ChaincodeMessage_QUERY , Payload : payload , Txid : txid }, nil
634
634
}
635
635
636
636
// Execute executes a transaction and waits for it to complete until a timeout value.
@@ -660,7 +660,7 @@ func (chaincodeSupport *ChaincodeSupport) Execute(ctxt context.Context, chaincod
660
660
}
661
661
662
662
//our responsibility to delete transaction context if sendExecuteMessage succeeded
663
- chrte .handler .deleteTxContext (msg .Uuid )
663
+ chrte .handler .deleteTxContext (msg .Txid )
664
664
665
665
return ccresp , err
666
666
}
0 commit comments