From 2e3e6d4485e2958daf58b397b1f39c054594245e Mon Sep 17 00:00:00 2001 From: Sean Gilligan Date: Sun, 26 Mar 2023 13:24:30 -0700 Subject: [PATCH] TransactionBroadcast: add `awaitSent()` method This just returns the used internally (and therefore tested) `sentFuture`. --- .../java/org/bitcoinj/core/TransactionBroadcast.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/src/main/java/org/bitcoinj/core/TransactionBroadcast.java b/core/src/main/java/org/bitcoinj/core/TransactionBroadcast.java index 9263d5622..9401d8d91 100644 --- a/core/src/main/java/org/bitcoinj/core/TransactionBroadcast.java +++ b/core/src/main/java/org/bitcoinj/core/TransactionBroadcast.java @@ -217,6 +217,15 @@ public class TransactionBroadcast { .thenApply(tx -> this); } + /** + * Wait for confirmation the transaction has been sent to a remote peer. (Or at least buffered to be sent to + * a peer.) + * @return A future that completes when the message has been relayed by the appropriate number of remote peers + */ + public CompletableFuture awaitSent() { + return sentFuture; + } + /** * If you migrate to {@link #broadcastAndAwaitRelay()} and need a {@link CompletableFuture} that returns * {@link Transaction} you can use: