@@ -491,7 +491,7 @@ void UpdateMempoolForReorg(DisconnectedBlockTransactions &disconnectpool, bool f
491491 CValidationState stateDummy;
492492 if (!fAddToMempool || (*it)->IsCoinBase () ||
493493 !AcceptToMemoryPool (mempool, stateDummy, *it, nullptr /* pfMissingInputs */ ,
494- nullptr /* plTxnReplaced */ , true /* bypass_limits */ , 0 /* nAbsurdFee */ )) {
494+ true /* bypass_limits */ , 0 /* nAbsurdFee */ )) {
495495 // If the transaction doesn't make it in to the mempool, remove any
496496 // transactions that depend on it (which would now be orphans).
497497 mempool.removeRecursive (**it, MemPoolRemovalReason::REORG);
@@ -551,8 +551,8 @@ static bool CheckInputsFromMempoolAndCache(const CTransaction& tx, CValidationSt
551551}
552552
553553static bool AcceptToMemoryPoolWorker (const CChainParams& chainparams, CTxMemPool& pool, CValidationState& state, const CTransactionRef& ptx,
554- bool * pfMissingInputs, int64_t nAcceptTime, std::list<CTransactionRef>* plTxnReplaced ,
555- bool bypass_limits, const CAmount& nAbsurdFee, std::vector<COutPoint>& coins_to_uncache, bool test_accept)
554+ bool * pfMissingInputs, int64_t nAcceptTime, bool bypass_limits ,
555+ const CAmount& nAbsurdFee, std::vector<COutPoint>& coins_to_uncache, bool test_accept)
556556{
557557 const CTransaction& tx = *ptx;
558558 const uint256 hash = tx.GetHash ();
@@ -948,15 +948,16 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
948948 }
949949
950950 // Remove conflicting transactions from the mempool
951+ auto txn_replaced = std::make_shared<std::vector<CTransactionRef>>();
952+ txn_replaced->reserve (allConflicting.size ());
951953 for (const CTxMemPool::txiter it : allConflicting)
952954 {
953955 LogPrint (BCLog::MEMPOOL, " replacing tx %s with %s for %s BTC additional fees, %d delta bytes\n " ,
954956 it->GetTx ().GetHash ().ToString (),
955957 hash.ToString (),
956958 FormatMoney (nModifiedFees - nConflictingFees),
957959 (int )nSize - (int )nConflictingSize);
958- if (plTxnReplaced)
959- plTxnReplaced->push_back (it->GetSharedTx ());
960+ txn_replaced->push_back (it->GetSharedTx ());
960961 }
961962 pool.RemoveStaged (allConflicting, false , MemPoolRemovalReason::REPLACED);
962963
@@ -977,18 +978,17 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
977978 return state.DoS (0 , false , REJECT_INSUFFICIENTFEE, " mempool full" );
978979 }
979980
980- GetMainSignals ().TransactionAddedToMempool (ptx);
981+ GetMainSignals ().TransactionAddedToMempool (ptx, txn_replaced );
981982
982983 return true ;
983984}
984985
985986/* * (try to) add transaction to memory pool with a specified acceptance time **/
986987static bool AcceptToMemoryPoolWithTime (const CChainParams& chainparams, CTxMemPool& pool, CValidationState &state, const CTransactionRef &tx,
987- bool * pfMissingInputs, int64_t nAcceptTime, std::list<CTransactionRef>* plTxnReplaced,
988- bool bypass_limits, const CAmount nAbsurdFee, bool test_accept)
988+ bool * pfMissingInputs, int64_t nAcceptTime, bool bypass_limits, const CAmount nAbsurdFee, bool test_accept)
989989{
990990 std::vector<COutPoint> coins_to_uncache;
991- bool res = AcceptToMemoryPoolWorker (chainparams, pool, state, tx, pfMissingInputs, nAcceptTime, plTxnReplaced, bypass_limits, nAbsurdFee, coins_to_uncache, test_accept);
991+ bool res = AcceptToMemoryPoolWorker (chainparams, pool, state, tx, pfMissingInputs, nAcceptTime, bypass_limits, nAbsurdFee, coins_to_uncache, test_accept);
992992 if (!res) {
993993 for (const COutPoint& hashTx : coins_to_uncache)
994994 pcoinsTip->Uncache (hashTx);
@@ -1000,11 +1000,10 @@ static bool AcceptToMemoryPoolWithTime(const CChainParams& chainparams, CTxMemPo
10001000}
10011001
10021002bool AcceptToMemoryPool (CTxMemPool& pool, CValidationState &state, const CTransactionRef &tx,
1003- bool * pfMissingInputs, std::list<CTransactionRef>* plTxnReplaced,
1004- bool bypass_limits, const CAmount nAbsurdFee, bool test_accept)
1003+ bool * pfMissingInputs, bool bypass_limits, const CAmount nAbsurdFee, bool test_accept)
10051004{
10061005 const CChainParams& chainparams = Params ();
1007- return AcceptToMemoryPoolWithTime (chainparams, pool, state, tx, pfMissingInputs, GetTime (), plTxnReplaced, bypass_limits, nAbsurdFee, test_accept);
1006+ return AcceptToMemoryPoolWithTime (chainparams, pool, state, tx, pfMissingInputs, GetTime (), bypass_limits, nAbsurdFee, test_accept);
10081007}
10091008
10101009/* *
@@ -4587,8 +4586,7 @@ bool LoadMempool(void)
45874586 if (nTime + nExpiryTimeout > nNow) {
45884587 LOCK (cs_main);
45894588 AcceptToMemoryPoolWithTime (chainparams, mempool, state, tx, nullptr /* pfMissingInputs */ , nTime,
4590- nullptr /* plTxnReplaced */ , false /* bypass_limits */ , 0 /* nAbsurdFee */ ,
4591- false /* test_accept */ );
4589+ false /* bypass_limits */ , 0 /* nAbsurdFee */ , false /* test_accept */ );
45924590 if (state.IsValid ()) {
45934591 ++count;
45944592 } else {
0 commit comments