Skip to content

Commit 9910ed7

Browse files
committed
net_processing: Pass a Peer& to ProcessOrphanTx
1 parent 89e2e0d commit 9910ed7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/net_processing.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ class PeerManagerImpl final : public PeerManager
589589
*/
590590
bool MaybeDiscourageAndDisconnect(CNode& pnode, Peer& peer);
591591

592-
void ProcessOrphanTx(std::set<uint256>& orphan_work_set) EXCLUSIVE_LOCKS_REQUIRED(cs_main, g_cs_orphans)
592+
void ProcessOrphanTx(Peer& peer) EXCLUSIVE_LOCKS_REQUIRED(cs_main, g_cs_orphans)
593593
EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex, g_msgproc_mutex);
594594
/** Process a single headers message from a peer.
595595
*
@@ -2878,20 +2878,20 @@ void PeerManagerImpl::ProcessHeadersMessage(CNode& pfrom, Peer& peer,
28782878
/**
28792879
* Reconsider orphan transactions after a parent has been accepted to the mempool.
28802880
*
2881-
* @param[in,out] orphan_work_set The set of orphan transactions to reconsider. Generally only one
2881+
* @peer[in] peer The peer whose orphan transactions we will reconsider. Generally only one
28822882
* orphan will be reconsidered on each call of this function. This set
28832883
* may be added to if accepting an orphan causes its children to be
28842884
* reconsidered.
28852885
*/
2886-
void PeerManagerImpl::ProcessOrphanTx(std::set<uint256>& orphan_work_set)
2886+
void PeerManagerImpl::ProcessOrphanTx(Peer& peer)
28872887
{
28882888
AssertLockHeld(g_msgproc_mutex);
28892889
AssertLockHeld(cs_main);
28902890
AssertLockHeld(g_cs_orphans);
28912891

2892-
while (!orphan_work_set.empty()) {
2893-
const uint256 orphanHash = *orphan_work_set.begin();
2894-
orphan_work_set.erase(orphan_work_set.begin());
2892+
while (!peer.m_orphan_work_set.empty()) {
2893+
const uint256 orphanHash = *peer.m_orphan_work_set.begin();
2894+
peer.m_orphan_work_set.erase(peer.m_orphan_work_set.begin());
28952895

28962896
const auto [porphanTx, from_peer] = m_orphanage.GetTx(orphanHash);
28972897
if (porphanTx == nullptr) continue;
@@ -2902,7 +2902,7 @@ void PeerManagerImpl::ProcessOrphanTx(std::set<uint256>& orphan_work_set)
29022902
if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) {
29032903
LogPrint(BCLog::MEMPOOL, " accepted orphan tx %s\n", orphanHash.ToString());
29042904
RelayTransaction(orphanHash, porphanTx->GetWitnessHash());
2905-
m_orphanage.AddChildrenToWorkSet(*porphanTx, orphan_work_set);
2905+
m_orphanage.AddChildrenToWorkSet(*porphanTx, peer.m_orphan_work_set);
29062906
m_orphanage.EraseTx(orphanHash);
29072907
for (const CTransactionRef& removedTx : result.m_replaced_transactions.value()) {
29082908
AddToCompactExtraTransactions(removedTx);
@@ -3959,7 +3959,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
39593959
}
39603960

39613961
// Recursively process any orphan transactions that depended on this one
3962-
ProcessOrphanTx(peer->m_orphan_work_set);
3962+
ProcessOrphanTx(*peer);
39633963
}
39643964
else if (state.GetResult() == TxValidationResult::TX_MISSING_INPUTS)
39653965
{
@@ -4771,7 +4771,7 @@ bool PeerManagerImpl::ProcessMessages(CNode* pfrom, std::atomic<bool>& interrupt
47714771
{
47724772
LOCK2(cs_main, g_cs_orphans);
47734773
if (!peer->m_orphan_work_set.empty()) {
4774-
ProcessOrphanTx(peer->m_orphan_work_set);
4774+
ProcessOrphanTx(*peer);
47754775
}
47764776
}
47774777

0 commit comments

Comments
 (0)