diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -95,8 +95,8 @@ static bool TestSequenceLocks(const CTransaction &tx, int flags) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { - LOCK(g_mempool.cs); - return CheckSequenceLocks(tx, flags); + LOCK(::g_mempool.cs); + return CheckSequenceLocks(::g_mempool, tx, flags); } // Test suite for ancestor feerate transaction selection. diff --git a/src/txmempool.cpp b/src/txmempool.cpp --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -570,7 +570,7 @@ CValidationState state; if (!ContextualCheckTransactionForCurrentBlock( config.GetChainParams().GetConsensus(), tx, state, flags) || - !CheckSequenceLocks(tx, flags, &lp, validLP)) { + !CheckSequenceLocks(*this, tx, flags, &lp, validLP)) { // Note if CheckSequenceLocks fails the LockPoints may still be // invalid. So it's critical that we remove the tx and not depend on // the LockPoints. diff --git a/src/validation.h b/src/validation.h --- a/src/validation.h +++ b/src/validation.h @@ -529,8 +529,8 @@ * * See consensus/consensus.h for flag definitions. */ -bool CheckSequenceLocks(const CTransaction &tx, int flags, - LockPoints *lp = nullptr, +bool CheckSequenceLocks(const CTxMemPool &pool, const CTransaction &tx, + int flags, LockPoints *lp = nullptr, bool useExistingLockPoints = false) EXCLUSIVE_LOCKS_REQUIRED(cs_main); diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -358,10 +358,10 @@ return true; } -bool CheckSequenceLocks(const CTransaction &tx, int flags, LockPoints *lp, - bool useExistingLockPoints) { +bool CheckSequenceLocks(const CTxMemPool &pool, const CTransaction &tx, + int flags, LockPoints *lp, bool useExistingLockPoints) { AssertLockHeld(cs_main); - AssertLockHeld(g_mempool.cs); + AssertLockHeld(pool.cs); CBlockIndex *tip = chainActive.Tip(); assert(tip != nullptr); @@ -382,7 +382,7 @@ lockPair.second = lp->time; } else { // pcoinsTip contains the UTXO set for chainActive.Tip() - CCoinsViewMemPool viewMemPool(pcoinsTip.get(), g_mempool); + CCoinsViewMemPool viewMemPool(pcoinsTip.get(), pool); std::vector prevheights; prevheights.resize(tx.vin.size()); for (size_t txinIndex = 0; txinIndex < tx.vin.size(); txinIndex++) { @@ -634,7 +634,8 @@ // that can't be mined yet. Must keep pool.cs for this unless we change // CheckSequenceLocks to take a CoinsViewCache instead of create its // own. - if (!CheckSequenceLocks(tx, STANDARD_LOCKTIME_VERIFY_FLAGS, &lp)) { + if (!CheckSequenceLocks(pool, tx, STANDARD_LOCKTIME_VERIFY_FLAGS, + &lp)) { return state.DoS(0, false, REJECT_NONSTANDARD, "non-BIP68-final"); }