5#ifndef BITCOIN_NODE_TXDOWNLOADMAN_H
6#define BITCOIN_NODE_TXDOWNLOADMAN_H
29class TxDownloadManagerImpl;
34 .max_peer_announcements = 5000,
35 .nonpref_peer_delay = std::chrono::seconds{2},
36 .overloaded_peer_delay = std::chrono::seconds{2},
37 .getdata_interval = std::chrono::seconds{60},
73 this->m_txns = std::move(other.m_txns);
74 this->m_senders = std::move(other.m_senders);
80 return strprintf(
"parent %s (sender=%d) + child %s (sender=%d)",
111 const std::unique_ptr<TxDownloadManagerImpl>
m_impl;
146 std::chrono::microseconds now);
150 std::chrono::microseconds current_time);
161 NodeId nodeid,
bool first_time_failure);
171 std::pair<bool, std::optional<PackageToValidate>>
#define Assume(val)
Assume is the identity function.
RollingBloomFilter is a probabilistic "keep track of most recently inserted" set.
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Class responsible for deciding what transactions to request and, once downloaded, whether and how to ...
const std::unique_ptr< TxDownloadManagerImpl > m_impl
std::vector< TxId > GetRequestsToSend(NodeId nodeid, std::chrono::microseconds current_time)
Get getdata requests to send.
InvRequestTracker< TxId > & GetTxRequestRef()
std::pair< bool, std::optional< PackageToValidate > > ReceivedTx(NodeId nodeid, const CTransactionRef &ptx)
Marks a tx as ReceivedResponse in txrequest and checks whether AlreadyHaveTx.
std::vector< TxOrphanage::PoolTx > GetOrphanTransactions() const
Wrapper for TxOrphanage::GetOrphanTransactions.
void BlockConnected(const std::shared_ptr< const CBlock > &pblock)
CTransactionRef GetTxToReconsider(NodeId nodeid)
Returns next orphan tx to consider, or nullptr if none exist.
void CheckIsEmpty() const
Check that all data structures are empty.
void MempoolAcceptedTx(const CTransactionRef &tx)
Respond to successful transaction submission to mempool.
void ConnectedPeer(NodeId nodeid, const TxDownloadConnectionInfo &info)
Creates a new PeerInfo.
bool AddTxAnnouncement(NodeId peer, const TxId &txid, std::chrono::microseconds now)
Consider adding this tx hash to txrequest.
void MempoolRejectedPackage(const Package &package)
Respond to package rejected from mempool.
void DisconnectedPeer(NodeId nodeid)
Deletes all txrequest announcements and orphans for a given peer.
CRollingBloomFilter & RecentRejectsFilter()
RejectedTxTodo MempoolRejectedTx(const CTransactionRef &ptx, const TxValidationState &state, NodeId nodeid, bool first_time_failure)
Respond to transaction rejected from mempool.
CRollingBloomFilter & RecentConfirmedTransactionsFilter()
void ReceivedNotFound(NodeId nodeid, const std::vector< TxId > &txids)
Should be called when a notfound for a tx has been received.
bool HaveMoreWork(NodeId nodeid) const
Whether there are any orphans to reconsider for this peer.
static constexpr DataRequestParameters TX_REQUEST_PARAMS
Parameters for the tx requests, see DataRequestParameters.
Implement std::hash so RCUPtr can be used as a key for maps or sets.
std::vector< CTransactionRef > Package
A package is an ordered list of transactions.
std::shared_ptr< const CTransaction > CTransactionRef
const size_t max_peer_request_in_flight
Maximum number of in-flight data requests from a peer.
A TxId is the identifier of a transaction.
std::vector< NodeId > m_senders
PackageToValidate(const CTransactionRef &parent, const CTransactionRef &child, NodeId parent_sender, NodeId child_sender)
Construct a 1-parent-1-child package.
std::string ToString() const
PackageToValidate(PackageToValidate &&other)
PackageToValidate & operator=(PackageToValidate &&other)
PackageToValidate(const PackageToValidate &other)=default
bool m_should_add_extra_compact_tx
std::optional< PackageToValidate > m_package_to_validate
std::vector< TxId > m_unique_parents
const bool m_preferred
Whether this peer is preferred for transaction download.
const bool m_relay_permissions
Whether this peer has Relay permissions.
bool m_deterministic_txrequest
Instantiate TxRequestTracker as deterministic (used for tests).
const uint32_t m_max_orphan_txs
Maximum number of transactions allowed in orphanage.
const CTxMemPool & m_mempool
Read-only reference to mempool.