@@ -394,7 +394,8 @@ void UpdateMempoolForReorg(DisconnectedBlockTransactions &disconnectpool, bool f
394394
395395bool AcceptToMemoryPoolWorker (CTxMemPool& pool, CValidationState& state, const CTransactionRef& ptx, bool fLimitFree ,
396396 bool * pfMissingInputs, int64_t nAcceptTime, std::list<CTransactionRef>* plTxnReplaced,
397- bool fOverrideMempoolLimit , const CAmount& nAbsurdFee, std::vector<COutPoint>& coins_to_uncache)
397+ bool fOverrideMempoolLimit , const CAmount& nAbsurdFee, std::vector<COutPoint>& coins_to_uncache,
398+ bool fDryRun )
398399{
399400 const CTransaction& tx = *ptx;
400401 const uint256 hash = tx.GetHash ();
@@ -774,6 +775,9 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
774775 __func__, hash.ToString (), FormatStateMessage (state));
775776 }
776777
778+ // If this is a dry run, quit here before modifying any state
779+ if (fDryRun ) return true ;
780+
777781 // Remove conflicting transactions from the mempool
778782 BOOST_FOREACH (const CTxMemPool::txiter it, allConflicting)
779783 {
@@ -811,10 +815,11 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
811815
812816bool AcceptToMemoryPoolWithTime (CTxMemPool& pool, CValidationState &state, const CTransactionRef &tx, bool fLimitFree ,
813817 bool * pfMissingInputs, int64_t nAcceptTime, std::list<CTransactionRef>* plTxnReplaced,
814- bool fOverrideMempoolLimit , const CAmount nAbsurdFee)
818+ bool fOverrideMempoolLimit , const CAmount nAbsurdFee,
819+ bool fDryRun )
815820{
816821 std::vector<COutPoint> coins_to_uncache;
817- bool res = AcceptToMemoryPoolWorker (pool, state, tx, fLimitFree , pfMissingInputs, nAcceptTime, plTxnReplaced, fOverrideMempoolLimit , nAbsurdFee, coins_to_uncache);
822+ bool res = AcceptToMemoryPoolWorker (pool, state, tx, fLimitFree , pfMissingInputs, nAcceptTime, plTxnReplaced, fOverrideMempoolLimit , nAbsurdFee, coins_to_uncache, fDryRun );
818823 if (!res) {
819824 BOOST_FOREACH (const COutPoint& hashTx, coins_to_uncache)
820825 pcoinsTip->Uncache (hashTx);
@@ -827,9 +832,10 @@ bool AcceptToMemoryPoolWithTime(CTxMemPool& pool, CValidationState &state, const
827832
828833bool AcceptToMemoryPool (CTxMemPool& pool, CValidationState &state, const CTransactionRef &tx, bool fLimitFree ,
829834 bool * pfMissingInputs, std::list<CTransactionRef>* plTxnReplaced,
830- bool fOverrideMempoolLimit , const CAmount nAbsurdFee)
835+ bool fOverrideMempoolLimit , const CAmount nAbsurdFee,
836+ bool fDryRun )
831837{
832- return AcceptToMemoryPoolWithTime (pool, state, tx, fLimitFree , pfMissingInputs, GetTime (), plTxnReplaced, fOverrideMempoolLimit , nAbsurdFee);
838+ return AcceptToMemoryPoolWithTime (pool, state, tx, fLimitFree , pfMissingInputs, GetTime (), plTxnReplaced, fOverrideMempoolLimit , nAbsurdFee, fDryRun );
833839}
834840
835841/* * Return transaction in txOut, and if it was found inside a block, its hash is placed in hashBlock */
0 commit comments