From c8e67b9169bddc0bdfefa10e9cf7f9c22847e237 Mon Sep 17 00:00:00 2001 From: glozow Date: Wed, 15 May 2024 16:00:32 +0100 Subject: [PATCH] [refactor] move ProcessInvalidTx and ProcessValidTx definitions down ProcessInvalidTx will return a PackageToValidate, so it needs to be defined afterward. --- src/net_processing.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 3f4f4f6af38..95fdf862f12 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -564,20 +564,6 @@ private: */ bool MaybeDiscourageAndDisconnect(CNode& pnode, Peer& peer); - /** Handle a transaction whose result was not MempoolAcceptResult::ResultType::VALID. - * @param[in] first_time_failure Whether this tx should be added to vExtraTxnForCompact. - * Set to false if the tx has already been rejected before, - * e.g. is an orphan, to avoid adding duplicate entries. - * Updates m_txrequest, m_lazy_recent_rejects, m_lazy_recent_rejects_reconsiderable, m_orphanage, and vExtraTxnForCompact. */ - void ProcessInvalidTx(NodeId nodeid, const CTransactionRef& tx, const TxValidationState& result, - bool first_time_failure) - EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex, g_msgproc_mutex, m_tx_download_mutex); - - /** Handle a transaction whose result was MempoolAcceptResult::ResultType::VALID. - * Updates m_txrequest, m_orphanage, and vExtraTxnForCompact. Also queues the tx for relay. */ - void ProcessValidTx(NodeId nodeid, const CTransactionRef& tx, const std::list& replaced_transactions) - EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex, g_msgproc_mutex, m_tx_download_mutex); - struct PackageToValidate { const Package m_txns; const std::vector m_senders; @@ -602,6 +588,20 @@ private: } }; + /** Handle a transaction whose result was not MempoolAcceptResult::ResultType::VALID. + * @param[in] first_time_failure Whether this tx should be added to vExtraTxnForCompact. + * Set to false if the tx has already been rejected before, + * e.g. is an orphan, to avoid adding duplicate entries. + * Updates m_txrequest, m_lazy_recent_rejects, m_lazy_recent_rejects_reconsiderable, m_orphanage, and vExtraTxnForCompact. */ + void ProcessInvalidTx(NodeId nodeid, const CTransactionRef& tx, const TxValidationState& result, + bool first_time_failure) + EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex, g_msgproc_mutex, m_tx_download_mutex); + + /** Handle a transaction whose result was MempoolAcceptResult::ResultType::VALID. + * Updates m_txrequest, m_orphanage, and vExtraTxnForCompact. Also queues the tx for relay. */ + void ProcessValidTx(NodeId nodeid, const CTransactionRef& tx, const std::list& replaced_transactions) + EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex, g_msgproc_mutex, m_tx_download_mutex); + /** Handle the results of package validation: calls ProcessValidTx and ProcessInvalidTx for * individual transactions, and caches rejection for the package as a group. */