@@ -249,7 +249,7 @@ func (h *Handler) HandleTransaction(msg *pb.ChaincodeMessage, delegate handleFun
249
249
250
250
chaincodeLogger .Debugf ("[%s] Completed %s. Sending %s" , shorttxid (msg .Txid ), msg .Type , resp .Type )
251
251
h .ActiveTransactions .Remove (msg .ChannelId , msg .Txid )
252
- h .serialSendAsync (resp , false )
252
+ h .serialSendAsync (resp )
253
253
}
254
254
255
255
func shorttxid (txid string ) string {
@@ -303,17 +303,20 @@ func (h *Handler) serialSend(msg *pb.ChaincodeMessage) error {
303
303
// can be nonblocking. Only errors need to be handled and these are handled by
304
304
// communication on supplied error channel. A typical use will be a non-blocking or
305
305
// nil channel
306
- func (h * Handler ) serialSendAsync (msg * pb.ChaincodeMessage , sendErr bool ) {
306
+ func (h * Handler ) serialSendAsync (msg * pb.ChaincodeMessage ) {
307
307
go func () {
308
308
if err := h .serialSend (msg ); err != nil {
309
- if sendErr {
310
- // provide an error response to the caller
311
- resp := & pb.ChaincodeMessage {Type : pb .ChaincodeMessage_ERROR , Payload : []byte (err .Error ()), Txid : msg .Txid , ChannelId : msg .ChannelId }
312
- h .Notify (resp )
313
-
314
- // provide an error response to the caller
315
- h .errChan <- err
309
+ // provide an error response to the caller
310
+ resp := & pb.ChaincodeMessage {
311
+ Type : pb .ChaincodeMessage_ERROR ,
312
+ Payload : []byte (err .Error ()),
313
+ Txid : msg .Txid ,
314
+ ChannelId : msg .ChannelId ,
316
315
}
316
+ h .Notify (resp )
317
+
318
+ // surface send error to stream processing
319
+ h .errChan <- err
317
320
}
318
321
}()
319
322
}
@@ -411,7 +414,7 @@ func (h *Handler) ProcessStream(stream ccintf.ChaincodeStream) error {
411
414
case <- keepaliveCh :
412
415
// if no error message from serialSend, KEEPALIVE happy, and don't care about error
413
416
// (maybe it'll work later)
414
- h .serialSendAsync (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_KEEPALIVE }, false )
417
+ h .serialSendAsync (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_KEEPALIVE })
415
418
continue
416
419
}
417
420
}
@@ -918,7 +921,7 @@ func (h *Handler) Execute(txParams *ccprovider.TransactionParams, cccid *ccprovi
918
921
return nil , err
919
922
}
920
923
921
- h .serialSendAsync (msg , true )
924
+ h .serialSendAsync (msg )
922
925
923
926
var ccresp * pb.ChaincodeMessage
924
927
select {
0 commit comments