diff --git a/src/txmempool.h b/src/txmempool.h --- a/src/txmempool.h +++ b/src/txmempool.h @@ -476,6 +476,7 @@ uint32_t nCheckFrequency; unsigned int nTransactionsUpdated; CBlockPolicyEstimator *minerPolicyEstimator; + const Config *config; //!< sum of all mempool tx's virtual sizes. uint64_t totalTxSize; @@ -587,7 +588,7 @@ void removeRecursive( const CTransaction &tx, MemPoolRemovalReason reason = MemPoolRemovalReason::UNKNOWN); - void removeForReorg(const Config &config, const CCoinsViewCache *pcoins, + void removeForReorg(const CCoinsViewCache *pcoins, unsigned int nMemPoolHeight, int flags); void removeConflicts(const CTransaction &tx); void removeForBlock(const std::vector &vtx, diff --git a/src/txmempool.cpp b/src/txmempool.cpp --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -7,6 +7,7 @@ #include "chainparams.h" // for GetConsensus. #include "clientversion.h" +#include "config.h" #include "consensus/consensus.h" #include "consensus/validation.h" #include "policy/fees.h" @@ -383,6 +384,8 @@ // lock free clear _clear(); + config = &GetConfig(); + // Sanity checks off by default for performance, because otherwise accepting // transactions becomes O(N^2) where N is the number of transactions in the // pool @@ -559,8 +562,7 @@ RemoveStaged(setAllRemoves, false, reason); } -void CTxMemPool::removeForReorg(const Config &config, - const CCoinsViewCache *pcoins, +void CTxMemPool::removeForReorg(const CCoinsViewCache *pcoins, unsigned int nMemPoolHeight, int flags) { // Remove transactions spending a coinbase which are now immature and // no-longer-final transactions. @@ -573,7 +575,7 @@ bool validLP = TestLockPointValidity(&lp); CValidationState state; - if (!ContextualCheckTransactionForCurrentBlock(config, tx, state, + if (!ContextualCheckTransactionForCurrentBlock(*config, tx, state, flags) || !CheckSequenceLocks(tx, flags, &lp, validLP)) { // Note if CheckSequenceLocks fails the LockPoints may still be diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -683,7 +683,7 @@ mempool.UpdateTransactionsFromBlock(vHashUpdate); // We also need to remove any now-immature transactions - mempool.removeForReorg(config, pcoinsTip, chainActive.Tip()->nHeight + 1, + mempool.removeForReorg(pcoinsTip, chainActive.Tip()->nHeight + 1, STANDARD_LOCKTIME_VERIFY_FLAGS); // Re-limit mempool size, in case we added any transactions LimitMempoolSize(