@@ -2353,12 +2353,9 @@ public CompletableFuture<TransactionEvent> sendTransaction(Collection<ProposalRe
23532353
23542354 public CompletableFuture <TransactionEvent > sendTransaction (Collection <ProposalResponse > proposalResponses , Collection <Orderer > orderers , User userContext ) {
23552355 try {
2356-
23572356 checkChannelState ();
23582357 userContextCheck (userContext );
2359-
23602358 if (null == proposalResponses ) {
2361-
23622359 throw new InvalidArgumentException ("sendTransaction proposalResponses was null" );
23632360 }
23642361
@@ -2370,9 +2367,7 @@ public CompletableFuture<TransactionEvent> sendTransaction(Collection<ProposalRe
23702367 }
23712368
23722369 if (config .getProposalConsistencyValidation ()) {
2373-
23742370 HashSet <ProposalResponse > invalid = new HashSet <>();
2375-
23762371 int consistencyGroups = SDKUtils .getProposalConsistencySets (proposalResponses , invalid ).size ();
23772372
23782373 if (consistencyGroups != 1 || !invalid .isEmpty ()) {
@@ -2409,14 +2404,20 @@ public CompletableFuture<TransactionEvent> sendTransaction(Collection<ProposalRe
24092404
24102405 Envelope transactionEnvelope = createTransactionEnvelope (transactionPayload , userContext );
24112406
2412- CompletableFuture <TransactionEvent > sret = registerTxListener (proposalTransactionID );
2413- logger .debug (format ("Channel %s sending transaction to orderer(s) with TxID %s " , name , proposalTransactionID ));
2407+ CompletableFuture <TransactionEvent > sret ;
2408+ if (getEventHubs ().isEmpty ()) { //If there are no eventhubs to complete the future, complete it
2409+ // immediately but give no transaction event
2410+ sret = new CompletableFuture <>();
2411+ sret .complete (null );
2412+ } else {
2413+ sret = registerTxListener (proposalTransactionID );
2414+ }
24142415
2416+ logger .debug (format ("Channel %s sending transaction to orderer(s) with TxID %s " , name , proposalTransactionID ));
24152417 boolean success = false ;
24162418
24172419 BroadcastResponse resp = null ;
24182420 for (Orderer orderer : orderers ) {
2419-
24202421 try {
24212422
24222423 if (null != diagnosticFileDumper ) {
@@ -2426,10 +2427,8 @@ public CompletableFuture<TransactionEvent> sendTransaction(Collection<ProposalRe
24262427
24272428 resp = orderer .sendTransaction (transactionEnvelope );
24282429 if (resp .getStatus () == Status .SUCCESS ) {
2429-
24302430 success = true ;
24312431 break ;
2432-
24332432 }
24342433 } catch (Exception e ) {
24352434 String emsg = format ("Channel %s unsuccessful sendTransaction to orderer" , name );
0 commit comments