Skip to content

Commit e662e2d

Browse files
committed
[net processing] Move ProcessOrphanTx to PeerManager
1 parent b70cd89 commit e662e2d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/net_processing.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,7 +2030,7 @@ void PeerManager::ProcessHeadersMessage(CNode& pfrom, const std::vector<CBlockHe
20302030
return;
20312031
}
20322032

2033-
void static ProcessOrphanTx(CConnman& connman, CTxMemPool& mempool, std::set<uint256>& orphan_work_set, std::list<CTransactionRef>& removed_txn) EXCLUSIVE_LOCKS_REQUIRED(cs_main, g_cs_orphans)
2033+
void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<CTransactionRef>& removed_txn)
20342034
{
20352035
AssertLockHeld(cs_main);
20362036
AssertLockHeld(g_cs_orphans);
@@ -2052,9 +2052,9 @@ void static ProcessOrphanTx(CConnman& connman, CTxMemPool& mempool, std::set<uin
20522052
TxValidationState orphan_state;
20532053

20542054
if (setMisbehaving.count(fromPeer)) continue;
2055-
if (AcceptToMemoryPool(mempool, orphan_state, porphanTx, &removed_txn, false /* bypass_limits */, 0 /* nAbsurdFee */)) {
2055+
if (AcceptToMemoryPool(m_mempool, orphan_state, porphanTx, &removed_txn, false /* bypass_limits */, 0 /* nAbsurdFee */)) {
20562056
LogPrint(BCLog::MEMPOOL, " accepted orphan tx %s\n", orphanHash.ToString());
2057-
RelayTransaction(orphanHash, porphanTx->GetWitnessHash(), connman);
2057+
RelayTransaction(orphanHash, porphanTx->GetWitnessHash(), m_connman);
20582058
for (unsigned int i = 0; i < orphanTx.vout.size(); i++) {
20592059
auto it_by_prev = mapOrphanTransactionsByPrev.find(COutPoint(orphanHash, i));
20602060
if (it_by_prev != mapOrphanTransactionsByPrev.end()) {
@@ -2112,7 +2112,7 @@ void static ProcessOrphanTx(CConnman& connman, CTxMemPool& mempool, std::set<uin
21122112
EraseOrphanTx(orphanHash);
21132113
done = true;
21142114
}
2115-
mempool.check(&::ChainstateActive().CoinsTip());
2115+
m_mempool.check(&::ChainstateActive().CoinsTip());
21162116
}
21172117
}
21182118

@@ -3030,7 +3030,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
30303030
m_mempool.size(), m_mempool.DynamicMemoryUsage() / 1000);
30313031

30323032
// Recursively process any orphan transactions that depended on this one
3033-
ProcessOrphanTx(m_connman, m_mempool, pfrom.orphan_work_set, lRemovedTxn);
3033+
ProcessOrphanTx(pfrom.orphan_work_set, lRemovedTxn);
30343034
}
30353035
else if (state.GetResult() == TxValidationResult::TX_MISSING_INPUTS)
30363036
{
@@ -3850,7 +3850,7 @@ bool PeerManager::ProcessMessages(CNode* pfrom, std::atomic<bool>& interruptMsgP
38503850
if (!pfrom->orphan_work_set.empty()) {
38513851
std::list<CTransactionRef> removed_txn;
38523852
LOCK2(cs_main, g_cs_orphans);
3853-
ProcessOrphanTx(m_connman, m_mempool, pfrom->orphan_work_set, removed_txn);
3853+
ProcessOrphanTx(pfrom->orphan_work_set, removed_txn);
38543854
for (const CTransactionRef& removedTx : removed_txn) {
38553855
AddToCompactExtraTransactions(removedTx);
38563856
}

src/net_processing.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ class PeerManager final : public CValidationInterface, public NetEventsInterface
105105
*/
106106
bool MaybeDiscourageAndDisconnect(CNode& pnode);
107107

108+
void ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<CTransactionRef>& removed_txn)
109+
EXCLUSIVE_LOCKS_REQUIRED(cs_main, g_cs_orphans);
108110
/** Process a single headers message from a peer. */
109111
void ProcessHeadersMessage(CNode& pfrom, const std::vector<CBlockHeader>& headers, bool via_compact_block);
110112

0 commit comments

Comments
 (0)