@@ -2041,10 +2041,8 @@ void PeerManager::ProcessHeadersMessage(CNode& pfrom, const std::vector<CBlockHe
2041
2041
* orphan will be reconsidered on each call of this function. This set
2042
2042
* may be added to if accepting an orphan causes its children to be
2043
2043
* reconsidered.
2044
- * @param[out] removed_txn Transactions that were removed from the mempool as a result of an
2045
- * orphan transaction being added.
2046
2044
*/
2047
- void PeerManager::ProcessOrphanTx (std::set<uint256>& orphan_work_set, std::list<CTransactionRef>& removed_txn )
2045
+ void PeerManager::ProcessOrphanTx (std::set<uint256>& orphan_work_set)
2048
2046
{
2049
2047
AssertLockHeld (cs_main);
2050
2048
AssertLockHeld (g_cs_orphans);
@@ -2058,6 +2056,7 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
2058
2056
2059
2057
const CTransactionRef porphanTx = orphan_it->second .tx ;
2060
2058
TxValidationState state;
2059
+ std::list<CTransactionRef> removed_txn;
2061
2060
2062
2061
if (AcceptToMemoryPool (m_mempool, state, porphanTx, &removed_txn, false /* bypass_limits */ , 0 /* nAbsurdFee */ )) {
2063
2062
LogPrint (BCLog::MEMPOOL, " accepted orphan tx %s\n " , orphanHash.ToString ());
@@ -2071,6 +2070,9 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
2071
2070
}
2072
2071
}
2073
2072
EraseOrphanTx (orphanHash);
2073
+ for (const CTransactionRef& removedTx : removed_txn) {
2074
+ AddToCompactExtraTransactions (removedTx);
2075
+ }
2074
2076
break ;
2075
2077
} else if (state.GetResult () != TxValidationResult::TX_MISSING_INPUTS) {
2076
2078
if (state.IsInvalid ()) {
@@ -3034,8 +3036,12 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
3034
3036
tx.GetHash ().ToString (),
3035
3037
m_mempool.size (), m_mempool.DynamicMemoryUsage () / 1000 );
3036
3038
3039
+ for (const CTransactionRef& removedTx : lRemovedTxn) {
3040
+ AddToCompactExtraTransactions (removedTx);
3041
+ }
3042
+
3037
3043
// Recursively process any orphan transactions that depended on this one
3038
- ProcessOrphanTx (pfrom.orphan_work_set , lRemovedTxn );
3044
+ ProcessOrphanTx (pfrom.orphan_work_set );
3039
3045
}
3040
3046
else if (state.GetResult () == TxValidationResult::TX_MISSING_INPUTS)
3041
3047
{
@@ -3138,9 +3144,6 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
3138
3144
}
3139
3145
}
3140
3146
3141
- for (const CTransactionRef& removedTx : lRemovedTxn)
3142
- AddToCompactExtraTransactions (removedTx);
3143
-
3144
3147
// If a tx has been detected by recentRejects, we will have reached
3145
3148
// this point and the tx will have been ignored. Because we haven't run
3146
3149
// the tx through AcceptToMemoryPool, we won't have computed a DoS
@@ -3853,12 +3856,8 @@ bool PeerManager::ProcessMessages(CNode* pfrom, std::atomic<bool>& interruptMsgP
3853
3856
ProcessGetData (*pfrom, m_chainparams, m_connman, m_mempool, interruptMsgProc);
3854
3857
3855
3858
if (!pfrom->orphan_work_set .empty ()) {
3856
- std::list<CTransactionRef> removed_txn;
3857
3859
LOCK2 (cs_main, g_cs_orphans);
3858
- ProcessOrphanTx (pfrom->orphan_work_set , removed_txn);
3859
- for (const CTransactionRef& removedTx : removed_txn) {
3860
- AddToCompactExtraTransactions (removedTx);
3861
- }
3860
+ ProcessOrphanTx (pfrom->orphan_work_set );
3862
3861
}
3863
3862
3864
3863
if (pfrom->fDisconnect )
0 commit comments