[#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&period; It is also responsible for deciding what transaction packages to validate and how to resolve orphan transactions&period; Its data structures include TxRequestTracker for scheduling requests, rolling bloom filters for remembering transactions that have already been &lcub;accepted, rejected, confirmed&rcub;, an orphanage, and a registry of each peer&apos;s transaction relay&hyphen;related information&period;

== Synopsis

Declared in `&lt;node&sol;txdownloadman&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class TxDownloadManager;
----

== Description

Caller needs to interact with TxDownloadManager&colon;

* ValidationInterface callbacks&period;
* When a potential transaction relay peer connects or disconnects&period;
* 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&hyphen;safe&period; Access must be synchronized using an external mutex&period;

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:node/TxDownloadManager/2constructor.adoc[`TxDownloadManager`]         [.small]#[constructor]#
| Construct a transaction download manager&period;
| xref:node/TxDownloadManager/2destructor.adoc[`&#126;TxDownloadManager`] [.small]#[destructor]#
| Destroy the download manager and release its state&period;
| xref:node/TxDownloadManager/ActiveTipChange.adoc[`ActiveTipChange`] 
| React to the active chain tip changing&period;
| xref:node/TxDownloadManager/AddTxAnnouncement.adoc[`AddTxAnnouncement`] 
| Consider adding this tx hash to txrequest&period; Should be called whenever a new inv has been received&period; Also called internally when a transaction is missing parents so that we can request them&period; Returns true if this was a dropped inv (p2p&lowbar;inv&equals;true and we already have the tx), false otherwise&period;
| xref:node/TxDownloadManager/BlockConnected.adoc[`BlockConnected`] 
| React to a block being connected to the active chain&period;
| xref:node/TxDownloadManager/BlockDisconnected.adoc[`BlockDisconnected`] 
| React to a block being disconnected from the active chain&period;
| xref:node/TxDownloadManager/CheckIsEmpty-0c.adoc[`CheckIsEmpty`] 
| `CheckIsEmpty` overloads
| xref:node/TxDownloadManager/ConnectedPeer.adoc[`ConnectedPeer`] 
| Creates a new PeerInfo&period; Saves the connection info to calculate tx announcement delays later&period;
| xref:node/TxDownloadManager/DisconnectedPeer.adoc[`DisconnectedPeer`] 
| Deletes all txrequest announcements and orphans for a given peer&period;
| xref:node/TxDownloadManager/GetOrphanTransactions.adoc[`GetOrphanTransactions`] 
| Wrapper for TxOrphanage&colon;&colon;GetOrphanTransactions
| xref:node/TxDownloadManager/GetRequestsToSend.adoc[`GetRequestsToSend`] 
| Get getdata requests to send&period;
| xref:node/TxDownloadManager/GetTxToReconsider.adoc[`GetTxToReconsider`] 
| Returns next orphan tx to consider, or nullptr if none exist&period;
| xref:node/TxDownloadManager/HaveMoreWork.adoc[`HaveMoreWork`] 
| Whether there are any orphans to reconsider for this peer&period;
| 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&period;
| xref:node/TxDownloadManager/ReceivedTx.adoc[`ReceivedTx`] 
| Marks a tx as ReceivedResponse in txrequest and checks whether AlreadyHaveTx&period; Return a bool indicating whether this tx should be validated&period; If false, optionally, a PackageToValidate&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
