[#node-TxDownloadManager] = xref:node.adoc[node]::TxDownloadManager :relfileprefix: ../ :mrdocs: 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>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- 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 [cols="1,4"] |=== | Name| Description | xref:node/TxDownloadManager/2constructor.adoc[`TxDownloadManager`] [.small]#[constructor]# | Construct a transaction download manager. | xref:node/TxDownloadManager/2destructor.adoc[`~TxDownloadManager`] [.small]#[destructor]# | Destroy the download manager and release its state. | xref:node/TxDownloadManager/ActiveTipChange.adoc[`ActiveTipChange`] | React to the active chain tip changing. | xref:node/TxDownloadManager/AddTxAnnouncement.adoc[`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. | xref:node/TxDownloadManager/BlockConnected.adoc[`BlockConnected`] | React to a block being connected to the active chain. | xref:node/TxDownloadManager/BlockDisconnected.adoc[`BlockDisconnected`] | React to a block being disconnected from the active chain. | xref:node/TxDownloadManager/CheckIsEmpty-0c.adoc[`CheckIsEmpty`] | `CheckIsEmpty` overloads | xref:node/TxDownloadManager/ConnectedPeer.adoc[`ConnectedPeer`] | Creates a new PeerInfo. Saves the connection info to calculate tx announcement delays later. | xref:node/TxDownloadManager/DisconnectedPeer.adoc[`DisconnectedPeer`] | Deletes all txrequest announcements and orphans for a given peer. | xref:node/TxDownloadManager/GetOrphanTransactions.adoc[`GetOrphanTransactions`] | Wrapper for TxOrphanage::GetOrphanTransactions | xref:node/TxDownloadManager/GetRequestsToSend.adoc[`GetRequestsToSend`] | Get getdata requests to send. | xref:node/TxDownloadManager/GetTxToReconsider.adoc[`GetTxToReconsider`] | Returns next orphan tx to consider, or nullptr if none exist. | xref:node/TxDownloadManager/HaveMoreWork.adoc[`HaveMoreWork`] | Whether there are any orphans to reconsider for this peer. | xref:node/TxDownloadManager/MempoolAcceptedTx.adoc[`MempoolAcceptedTx`] | Respond to successful transaction submission to mempool | xref:node/TxDownloadManager/MempoolRejectedPackage.adoc[`MempoolRejectedPackage`] | Respond to package rejected from mempool | xref:node/TxDownloadManager/MempoolRejectedTx.adoc[`MempoolRejectedTx`] | Respond to transaction rejected from mempool | xref:node/TxDownloadManager/ReceivedNotFound.adoc[`ReceivedNotFound`] | Should be called when a notfound for a tx has been received. | xref:node/TxDownloadManager/ReceivedTx.adoc[`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. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#