[refactor] make AlreadyHaveTx and Find1P1CPackage private to TxDownloadImpl

pull/30110/head
glozow 6 months ago
parent 1e08195135
commit f150fb94e7

@ -131,15 +131,6 @@ public:
void BlockConnected(const std::shared_ptr<const CBlock>& pblock); void BlockConnected(const std::shared_ptr<const CBlock>& pblock);
void BlockDisconnected(); void BlockDisconnected();
/** Check whether we already have this gtxid in:
* - mempool
* - orphanage
* - m_recent_rejects
* - m_recent_rejects_reconsiderable (if include_reconsiderable = true)
* - m_recent_confirmed_transactions
* */
bool AlreadyHaveTx(const GenTxid& gtxid, bool include_reconsiderable);
/** Creates a new PeerInfo. Saves the connection info to calculate tx announcement delays later. */ /** Creates a new PeerInfo. Saves the connection info to calculate tx announcement delays later. */
void ConnectedPeer(NodeId nodeid, const TxDownloadConnectionInfo& info); void ConnectedPeer(NodeId nodeid, const TxDownloadConnectionInfo& info);
@ -157,11 +148,6 @@ public:
/** Should be called when a notfound for a tx has been received. */ /** Should be called when a notfound for a tx has been received. */
void ReceivedNotFound(NodeId nodeid, const std::vector<uint256>& txhashes); void ReceivedNotFound(NodeId nodeid, const std::vector<uint256>& txhashes);
/** Look for a child of this transaction in the orphanage to form a 1-parent-1-child package,
* skipping any combinations that have already been tried. Return the resulting package along with
* the senders of its respective transactions, or std::nullopt if no package is found. */
std::optional<PackageToValidate> Find1P1CPackage(const CTransactionRef& ptx, NodeId nodeid);
/** Respond to successful transaction submission to mempool */ /** Respond to successful transaction submission to mempool */
void MempoolAcceptedTx(const CTransactionRef& tx); void MempoolAcceptedTx(const CTransactionRef& tx);

@ -39,10 +39,6 @@ void TxDownloadManager::BlockDisconnected()
{ {
m_impl->BlockDisconnected(); m_impl->BlockDisconnected();
} }
bool TxDownloadManager::AlreadyHaveTx(const GenTxid& gtxid, bool include_reconsiderable)
{
return m_impl->AlreadyHaveTx(gtxid, include_reconsiderable);
}
void TxDownloadManager::ConnectedPeer(NodeId nodeid, const TxDownloadConnectionInfo& info) void TxDownloadManager::ConnectedPeer(NodeId nodeid, const TxDownloadConnectionInfo& info)
{ {
m_impl->ConnectedPeer(nodeid, info); m_impl->ConnectedPeer(nodeid, info);
@ -63,10 +59,6 @@ void TxDownloadManager::ReceivedNotFound(NodeId nodeid, const std::vector<uint25
{ {
m_impl->ReceivedNotFound(nodeid, txhashes); m_impl->ReceivedNotFound(nodeid, txhashes);
} }
std::optional<PackageToValidate> TxDownloadManager::Find1P1CPackage(const CTransactionRef& ptx, NodeId nodeid)
{
return m_impl->Find1P1CPackage(ptx, nodeid);
}
void TxDownloadManager::MempoolAcceptedTx(const CTransactionRef& tx) void TxDownloadManager::MempoolAcceptedTx(const CTransactionRef& tx)
{ {
m_impl->MempoolAcceptedTx(tx); m_impl->MempoolAcceptedTx(tx);

@ -148,6 +148,13 @@ public:
void BlockConnected(const std::shared_ptr<const CBlock>& pblock); void BlockConnected(const std::shared_ptr<const CBlock>& pblock);
void BlockDisconnected(); void BlockDisconnected();
/** Check whether we already have this gtxid in:
* - mempool
* - orphanage
* - m_recent_rejects
* - m_recent_rejects_reconsiderable (if include_reconsiderable = true)
* - m_recent_confirmed_transactions
* */
bool AlreadyHaveTx(const GenTxid& gtxid, bool include_reconsiderable); bool AlreadyHaveTx(const GenTxid& gtxid, bool include_reconsiderable);
void ConnectedPeer(NodeId nodeid, const TxDownloadConnectionInfo& info); void ConnectedPeer(NodeId nodeid, const TxDownloadConnectionInfo& info);
@ -162,6 +169,9 @@ public:
/** Marks a tx as ReceivedResponse in txrequest. */ /** Marks a tx as ReceivedResponse in txrequest. */
void ReceivedNotFound(NodeId nodeid, const std::vector<uint256>& txhashes); void ReceivedNotFound(NodeId nodeid, const std::vector<uint256>& txhashes);
/** Look for a child of this transaction in the orphanage to form a 1-parent-1-child package,
* skipping any combinations that have already been tried. Return the resulting package along with
* the senders of its respective transactions, or std::nullopt if no package is found. */
std::optional<PackageToValidate> Find1P1CPackage(const CTransactionRef& ptx, NodeId nodeid); std::optional<PackageToValidate> Find1P1CPackage(const CTransactionRef& ptx, NodeId nodeid);
void MempoolAcceptedTx(const CTransactionRef& tx); void MempoolAcceptedTx(const CTransactionRef& tx);

Loading…
Cancel
Save