From f150fb94e7dbb3c1f4fca32a0abf063943ca676d Mon Sep 17 00:00:00 2001 From: glozow Date: Wed, 15 May 2024 16:57:03 +0100 Subject: [PATCH] [refactor] make AlreadyHaveTx and Find1P1CPackage private to TxDownloadImpl --- src/node/txdownloadman.h | 14 -------------- src/node/txdownloadman_impl.cpp | 8 -------- src/node/txdownloadman_impl.h | 10 ++++++++++ 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/node/txdownloadman.h b/src/node/txdownloadman.h index 164c4b706ef..e921ac3c2d4 100644 --- a/src/node/txdownloadman.h +++ b/src/node/txdownloadman.h @@ -131,15 +131,6 @@ public: void BlockConnected(const std::shared_ptr& pblock); 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. */ void ConnectedPeer(NodeId nodeid, const TxDownloadConnectionInfo& info); @@ -157,11 +148,6 @@ public: /** Should be called when a notfound for a tx has been received. */ void ReceivedNotFound(NodeId nodeid, const std::vector& 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 Find1P1CPackage(const CTransactionRef& ptx, NodeId nodeid); - /** Respond to successful transaction submission to mempool */ void MempoolAcceptedTx(const CTransactionRef& tx); diff --git a/src/node/txdownloadman_impl.cpp b/src/node/txdownloadman_impl.cpp index 22bfff167d4..e6b1873e28f 100644 --- a/src/node/txdownloadman_impl.cpp +++ b/src/node/txdownloadman_impl.cpp @@ -39,10 +39,6 @@ void TxDownloadManager::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) { m_impl->ConnectedPeer(nodeid, info); @@ -63,10 +59,6 @@ void TxDownloadManager::ReceivedNotFound(NodeId nodeid, const std::vectorReceivedNotFound(nodeid, txhashes); } -std::optional TxDownloadManager::Find1P1CPackage(const CTransactionRef& ptx, NodeId nodeid) -{ - return m_impl->Find1P1CPackage(ptx, nodeid); -} void TxDownloadManager::MempoolAcceptedTx(const CTransactionRef& tx) { m_impl->MempoolAcceptedTx(tx); diff --git a/src/node/txdownloadman_impl.h b/src/node/txdownloadman_impl.h index 019b930a850..fe04770f650 100644 --- a/src/node/txdownloadman_impl.h +++ b/src/node/txdownloadman_impl.h @@ -148,6 +148,13 @@ public: void BlockConnected(const std::shared_ptr& pblock); 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); void ConnectedPeer(NodeId nodeid, const TxDownloadConnectionInfo& info); @@ -162,6 +169,9 @@ public: /** Marks a tx as ReceivedResponse in txrequest. */ void ReceivedNotFound(NodeId nodeid, const std::vector& 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 Find1P1CPackage(const CTransactionRef& ptx, NodeId nodeid); void MempoolAcceptedTx(const CTransactionRef& tx);