diff options
author | Anthony Towns <aj@erisian.com.au> | 2022-11-22 01:39:32 +1000 |
---|---|---|
committer | Anthony Towns <aj@erisian.com.au> | 2023-01-25 18:13:42 +1000 |
commit | be2304676bedcd15debcdc694549fdd2b255ba62 (patch) | |
tree | db3646c6daeedeb178905e8527e1311fea2bb722 /src | |
parent | a4fe09973aa82210b98dcb4e4e9f11ef59780f9b (diff) |
txorphange: Drop redundant originator arg from GetTxToReconsider
Diffstat (limited to 'src')
-rw-r--r-- | src/net_processing.cpp | 7 | ||||
-rw-r--r-- | src/test/fuzz/txorphan.cpp | 3 | ||||
-rw-r--r-- | src/txorphanage.cpp | 3 | ||||
-rw-r--r-- | src/txorphanage.h | 6 |
4 files changed, 8 insertions, 11 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 5001358c59..9b9ef40001 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2892,10 +2892,9 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer) AssertLockHeld(cs_main); CTransactionRef porphanTx = nullptr; - NodeId from_peer = -1; bool more = false; - while (CTransactionRef porphanTx = m_orphanage.GetTxToReconsider(peer.m_id, from_peer, more)) { + while (CTransactionRef porphanTx = m_orphanage.GetTxToReconsider(peer.m_id, more)) { const MempoolAcceptResult result = m_chainman.ProcessTransaction(porphanTx); const TxValidationState& state = result.m_state; const uint256& orphanHash = porphanTx->GetHash(); @@ -2913,10 +2912,10 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer) if (state.IsInvalid()) { LogPrint(BCLog::MEMPOOL, " invalid orphan tx %s from peer=%d. %s\n", orphanHash.ToString(), - from_peer, + peer.m_id, state.ToString()); // Maybe punish peer that gave us an invalid orphan tx - MaybePunishNodeForTx(from_peer, state); + MaybePunishNodeForTx(peer.m_id, state); } // Has inputs but not accepted to mempool // Probably non-standard or insufficient fee diff --git a/src/test/fuzz/txorphan.cpp b/src/test/fuzz/txorphan.cpp index dff29bcd6e..4673b884dc 100644 --- a/src/test/fuzz/txorphan.cpp +++ b/src/test/fuzz/txorphan.cpp @@ -89,9 +89,8 @@ FUZZ_TARGET_INIT(txorphan, initialize_orphanage) }, [&] { { - NodeId originator; bool more = true; - CTransactionRef ref = orphanage.GetTxToReconsider(peer_id, originator, more); + CTransactionRef ref = orphanage.GetTxToReconsider(peer_id, more); if (!ref) { Assert(!more); } else { diff --git a/src/txorphanage.cpp b/src/txorphanage.cpp index 2dbc73cbca..31c6ff7106 100644 --- a/src/txorphanage.cpp +++ b/src/txorphanage.cpp @@ -174,7 +174,7 @@ bool TxOrphanage::HaveTx(const GenTxid& gtxid) const } } -CTransactionRef TxOrphanage::GetTxToReconsider(NodeId peer, NodeId& originator, bool& more) +CTransactionRef TxOrphanage::GetTxToReconsider(NodeId peer, bool& more) { LOCK(m_mutex); @@ -188,7 +188,6 @@ CTransactionRef TxOrphanage::GetTxToReconsider(NodeId peer, NodeId& originator, const auto orphan_it = m_orphans.find(txid); if (orphan_it != m_orphans.end()) { more = !work_set.empty(); - originator = orphan_it->second.fromPeer; return orphan_it->second.tx; } } diff --git a/src/txorphanage.h b/src/txorphanage.h index e8767fddc5..55c02976dd 100644 --- a/src/txorphanage.h +++ b/src/txorphanage.h @@ -29,11 +29,11 @@ public: /** Extract a transaction from a peer's work set * Returns nullptr and sets more to false if there are no transactions * to work on. Otherwise returns the transaction reference, removes - * the transaction from the work set, and populates its arguments with - * the originating peer, and whether there are more orphans for this peer + * the transaction from the work set, and sets "more" to indicate + * if there are more orphans for this peer * to work on after this tx. */ - CTransactionRef GetTxToReconsider(NodeId peer, NodeId& originator, bool& more) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex); + CTransactionRef GetTxToReconsider(NodeId peer, bool& more) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex); /** Erase an orphan by txid */ int EraseTx(const uint256& txid) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex); |