public class TransactionBroadcast
extends java.lang.Object
Wallet
and needs to be sent to the network. A broadcast can succeed or fail. A success is
defined as seeing the transaction be announced by peers via inv messages, thus indicating their acceptance. A failure
is defined as not reaching acceptance within a timeout period, or getting an explicit reject message from a peer
indicating that the transaction was not acceptable.Modifier and Type | Class and Description |
---|---|
static interface |
TransactionBroadcast.ProgressCallback
An interface for receiving progress information on the propagation of the tx, from 0.0 to 1.0
|
Modifier and Type | Field and Description |
---|---|
static java.util.Random |
random
Used for shuffling the peers before broadcast: unit tests can replace this to make themselves deterministic.
|
Modifier and Type | Method and Description |
---|---|
com.google.common.util.concurrent.ListenableFuture<Transaction> |
broadcast() |
static TransactionBroadcast |
createMockBroadcast(Transaction tx,
com.google.common.util.concurrent.SettableFuture<Transaction> future) |
com.google.common.util.concurrent.ListenableFuture<Transaction> |
future() |
void |
setDropPeersAfterBroadcast(boolean dropPeersAfterBroadcast) |
void |
setMinConnections(int minConnections) |
void |
setProgressCallback(TransactionBroadcast.ProgressCallback callback)
Sets the given callback for receiving progress values, which will run on the user thread.
|
void |
setProgressCallback(TransactionBroadcast.ProgressCallback callback,
java.util.concurrent.Executor executor)
Sets the given callback for receiving progress values, which will run on the given executor.
|
public static java.util.Random random
public static TransactionBroadcast createMockBroadcast(Transaction tx, com.google.common.util.concurrent.SettableFuture<Transaction> future)
public com.google.common.util.concurrent.ListenableFuture<Transaction> future()
public void setMinConnections(int minConnections)
public void setDropPeersAfterBroadcast(boolean dropPeersAfterBroadcast)
public com.google.common.util.concurrent.ListenableFuture<Transaction> broadcast()
public void setProgressCallback(TransactionBroadcast.ProgressCallback callback)
Threading
for details. If the broadcast has already started then the callback will
be invoked immediately with the current progress.public void setProgressCallback(TransactionBroadcast.ProgressCallback callback, @Nullable java.util.concurrent.Executor executor)