mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 03:47:29 -03:00
[net processing] Move ProcessOrphanTx to PeerManager
This commit is contained in:
parent
b70cd890e3
commit
e662e2d42a
2 changed files with 8 additions and 6 deletions
|
@ -2030,7 +2030,7 @@ void PeerManager::ProcessHeadersMessage(CNode& pfrom, const std::vector<CBlockHe
|
|||
return;
|
||||
}
|
||||
|
||||
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)
|
||||
void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<CTransactionRef>& removed_txn)
|
||||
{
|
||||
AssertLockHeld(cs_main);
|
||||
AssertLockHeld(g_cs_orphans);
|
||||
|
@ -2052,9 +2052,9 @@ void static ProcessOrphanTx(CConnman& connman, CTxMemPool& mempool, std::set<uin
|
|||
TxValidationState orphan_state;
|
||||
|
||||
if (setMisbehaving.count(fromPeer)) continue;
|
||||
if (AcceptToMemoryPool(mempool, orphan_state, porphanTx, &removed_txn, false /* bypass_limits */, 0 /* nAbsurdFee */)) {
|
||||
if (AcceptToMemoryPool(m_mempool, orphan_state, porphanTx, &removed_txn, false /* bypass_limits */, 0 /* nAbsurdFee */)) {
|
||||
LogPrint(BCLog::MEMPOOL, " accepted orphan tx %s\n", orphanHash.ToString());
|
||||
RelayTransaction(orphanHash, porphanTx->GetWitnessHash(), connman);
|
||||
RelayTransaction(orphanHash, porphanTx->GetWitnessHash(), m_connman);
|
||||
for (unsigned int i = 0; i < orphanTx.vout.size(); i++) {
|
||||
auto it_by_prev = mapOrphanTransactionsByPrev.find(COutPoint(orphanHash, i));
|
||||
if (it_by_prev != mapOrphanTransactionsByPrev.end()) {
|
||||
|
@ -2112,7 +2112,7 @@ void static ProcessOrphanTx(CConnman& connman, CTxMemPool& mempool, std::set<uin
|
|||
EraseOrphanTx(orphanHash);
|
||||
done = true;
|
||||
}
|
||||
mempool.check(&::ChainstateActive().CoinsTip());
|
||||
m_mempool.check(&::ChainstateActive().CoinsTip());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3030,7 +3030,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
|||
m_mempool.size(), m_mempool.DynamicMemoryUsage() / 1000);
|
||||
|
||||
// Recursively process any orphan transactions that depended on this one
|
||||
ProcessOrphanTx(m_connman, m_mempool, pfrom.orphan_work_set, lRemovedTxn);
|
||||
ProcessOrphanTx(pfrom.orphan_work_set, lRemovedTxn);
|
||||
}
|
||||
else if (state.GetResult() == TxValidationResult::TX_MISSING_INPUTS)
|
||||
{
|
||||
|
@ -3850,7 +3850,7 @@ bool PeerManager::ProcessMessages(CNode* pfrom, std::atomic<bool>& interruptMsgP
|
|||
if (!pfrom->orphan_work_set.empty()) {
|
||||
std::list<CTransactionRef> removed_txn;
|
||||
LOCK2(cs_main, g_cs_orphans);
|
||||
ProcessOrphanTx(m_connman, m_mempool, pfrom->orphan_work_set, removed_txn);
|
||||
ProcessOrphanTx(pfrom->orphan_work_set, removed_txn);
|
||||
for (const CTransactionRef& removedTx : removed_txn) {
|
||||
AddToCompactExtraTransactions(removedTx);
|
||||
}
|
||||
|
|
|
@ -105,6 +105,8 @@ private:
|
|||
*/
|
||||
bool MaybeDiscourageAndDisconnect(CNode& pnode);
|
||||
|
||||
void ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<CTransactionRef>& removed_txn)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main, g_cs_orphans);
|
||||
/** Process a single headers message from a peer. */
|
||||
void ProcessHeadersMessage(CNode& pfrom, const std::vector<CBlockHeader>& headers, bool via_compact_block);
|
||||
|
||||
|
|
Loading…
Reference in a new issue