PrivateBroadcast

Store a list of transactions to be broadcast privately. Supports the following operations: - Add a new transaction - Remove a transaction - Pick a transaction for sending to one recipient - Query which transaction has been picked for sending to a given recipient node - Mark that a given recipient node has confirmed receipt of a transaction - Query whether a given recipient node has confirmed reception - Query whether any transactions that need sending are currently on the list

Synopsis

Declared in <private_broadcast.h>

class PrivateBroadcast;

Types

NameDescription
PeerSendInfo Per-recipient record of when a transaction was sent and (optionally) received back.
TxBroadcastInfo Public snapshot of a tracked transaction and its per-peer broadcast history.

Enums

NameDescription
AddResult Outcome of Add().

Member Functions

NameDescription
PrivateBroadcast [constructor]Construct a private broadcast store with optional capacity limits.
Add Add a transaction to the storage, or reset an exhausted transaction so it can be broadcast again.
DidNodeConfirmReception Check if the node has confirmed reception of the transaction.
GetBroadcastInfo Get stats about all transactions currently being privately broadcast.
GetStale Get the transactions that have not been broadcast recently and have send attempts remaining.
GetTxForNode Get the transaction that was picked for sending to a given node by PickTxForSend().
HavePendingTransactions Check if there are transactions with send attempts remaining.
NodeConfirmedReception Mark that the node has confirmed reception of the transaction we sent it by responding with PONG to our PING message.
PickTxForSend Pick the transaction with the fewest send attempts, and confirmations, and oldest send/confirm times.
Remove Forget a transaction.

Static Data Members

NameDescription
INITIAL_STALE_DURATION If a transaction is not sent to any peer for this duration, then we consider it stale / for rebroadcasting.
MAX_SEND_ATTEMPTS Maximum number of send attempts for a transaction. Once this limit is reached, the transaction remains tracked but is not sent again unless explicitly re-added.
MAX_TRANSACTIONS Maximum number of transactions tracked simultaneously. Additions that would exceed this are rejected (see Add()).
STALE_DURATION If a transaction is not received back from the network for this duration after it is broadcast, then we consider it stale / for rebroadcasting.