ForwardingService: print exception in coinForwardingListener

The listener was swallowing some exceptions. This change will
print those exceptions to the console.
This commit is contained in:
Sean Gilligan 2023-08-02 14:49:36 -07:00 committed by Andreas Schildbach
parent 50c0f2eae9
commit 8cff8e0ac2

View File

@ -154,11 +154,15 @@ public class ForwardingService implements Closeable {
System.out.printf("Transaction %s is signed and is being delivered to %s...\n", broadcast.transaction().getTxId(), network);
return broadcast.awaitRelayed(); // Wait until peers report they have seen the transaction
})
.thenAccept(broadcast ->
System.out.printf("Sent %s onwards and acknowledged by peers, via transaction %s\n",
broadcast.transaction().getOutputSum().toFriendlyString(),
broadcast.transaction().getTxId())
);
.whenComplete((broadcast, throwable) -> {
if (broadcast != null) {
System.out.printf("Sent %s onwards and acknowledged by peers, via transaction %s\n",
broadcast.transaction().getOutputSum().toFriendlyString(),
broadcast.transaction().getTxId());
} else {
System.out.println("Exception occurred: " + throwable);
}
});
}
static String getPrefix(BitcoinNetwork network) {