Class responsible for deciding what transactions to request and, once downloaded, whether and how to validate them. It is also responsible for deciding what transaction packages to validate and how to resolve orphan transactions. Its data structures include TxRequestTracker for scheduling requests, rolling bloom filters for remembering transactions that have already been {accepted, rejected, confirmed}, an orphanage, and a registry of each peer's transaction relay‐related information.

Synopsis

Declared in <node/txdownloadman.h>

class TxDownloadManager;

Description

Caller needs to interact with TxDownloadManager:

  • ValidationInterface callbacks.

  • When a potential transaction relay peer connects or disconnects.

  • When a transaction or package is accepted or rejected from mempool

  • When a inv, notfound, or tx message is received

  • To get instructions for which getdata messages to send

This class is not thread‐safe. Access must be synchronized using an external mutex.

Member Functions

Name

Description

TxDownloadManager [constructor]

Construct a transaction download manager.

~TxDownloadManager [destructor]

Destroy the download manager and release its state.

ActiveTipChange

React to the active chain tip changing.

AddTxAnnouncement

Consider adding this tx hash to txrequest. Should be called whenever a new inv has been received. Also called internally when a transaction is missing parents so that we can request them. Returns true if this was a dropped inv (p2p_inv=true and we already have the tx), false otherwise.

BlockConnected

React to a block being connected to the active chain.

BlockDisconnected

React to a block being disconnected from the active chain.

CheckIsEmpty

CheckIsEmpty overloads

ConnectedPeer

Creates a new PeerInfo. Saves the connection info to calculate tx announcement delays later.

DisconnectedPeer

Deletes all txrequest announcements and orphans for a given peer.

GetOrphanTransactions

Wrapper for TxOrphanage::GetOrphanTransactions

GetRequestsToSend

Get getdata requests to send.

GetTxToReconsider

Returns next orphan tx to consider, or nullptr if none exist.

HaveMoreWork

Whether there are any orphans to reconsider for this peer.

MempoolAcceptedTx

Respond to successful transaction submission to mempool

MempoolRejectedPackage

Respond to package rejected from mempool

MempoolRejectedTx

Respond to transaction rejected from mempool

ReceivedNotFound

Should be called when a notfound for a tx has been received.

ReceivedTx

Marks a tx as ReceivedResponse in txrequest and checks whether AlreadyHaveTx. Return a bool indicating whether this tx should be validated. If false, optionally, a PackageToValidate.

Created with MrDocs