5#ifndef BITCOIN_NODE_TXDOWNLOADMAN_H
6#define BITCOIN_NODE_TXDOWNLOADMAN_H
74 this->m_txns = std::move(other.m_txns);
75 this->m_senders = std::move(other.m_senders);
81 return strprintf(
"parent %s (wtxid=%s, sender=%d) + child %s (wtxid=%s, sender=%d)",
82 m_txns.front()->GetHash().ToString(),
83 m_txns.front()->GetWitnessHash().ToString(),
85 m_txns.back()->GetHash().ToString(),
86 m_txns.back()->GetWitnessHash().ToString(),
118 const std::unique_ptr<TxDownloadManagerImpl>
m_impl;
#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 ...
Data structure to keep track of, and schedule, transaction downloads from peers.
const std::unique_ptr< TxDownloadManagerImpl > m_impl
std::vector< GenTxid > GetRequestsToSend(NodeId nodeid, std::chrono::microseconds current_time)
Get getdata requests to send.
void ReceivedNotFound(NodeId nodeid, const std::vector< GenTxid > >xids)
Should be called when a notfound for a tx has been received.
std::vector< TxOrphanage::OrphanInfo > GetOrphanTransactions() const
Wrapper for TxOrphanage::GetOrphanTransactions.
std::pair< bool, std::optional< PackageToValidate > > ReceivedTx(NodeId nodeid, const CTransactionRef &ptx)
Marks a tx as ReceivedResponse in txrequest and checks whether AlreadyHaveTx.
bool AddTxAnnouncement(NodeId peer, const GenTxid >xid, std::chrono::microseconds now)
Consider adding this tx hash to txrequest.
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.
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.
RejectedTxTodo MempoolRejectedTx(const CTransactionRef &ptx, const TxValidationState &state, NodeId nodeid, bool first_time_failure)
Respond to transaction rejected from mempool.
TxDownloadManager(const TxDownloadOptions &options)
bool HaveMoreWork(NodeId nodeid) const
Whether there are any orphans to reconsider for this peer.
static constexpr auto GETDATA_TX_INTERVAL
How long to wait before downloading a transaction from an additional peer.
static constexpr int32_t MAX_PEER_TX_ANNOUNCEMENTS
Maximum number of transactions to consider for requesting, per peer.
static constexpr int32_t MAX_PEER_TX_REQUEST_IN_FLIGHT
Maximum number of in-flight transaction requests from a peer.
static constexpr auto TXID_RELAY_DELAY
How long to delay requesting transactions via txids, if we have wtxid-relaying peers.
static constexpr auto OVERLOADED_PEER_TX_DELAY
How long to delay requesting transactions from overloaded peers (see MAX_PEER_TX_REQUEST_IN_FLIGHT).
static constexpr auto NONPREF_PEER_TX_DELAY
How long to delay requesting transactions from non-preferred peers.
std::vector< CTransactionRef > Package
A package is an ordered list of transactions.
std::shared_ptr< const CTransaction > CTransactionRef
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_wtxid_relay
Whether this peer supports wtxid relay.
const bool m_relay_permissions
Whether this peer has Relay permissions.
bool m_deterministic_txrequest
Instantiate TxRequestTracker as deterministic (used for tests).
FastRandomContext & m_rng
RNG provided by caller.
const CTxMemPool & m_mempool
Read-only reference to mempool.