Pass tx pool reference into CheckSequenceLocks
This commit is contained in:
parent
362518791a
commit
fa511e8dad
4 changed files with 8 additions and 8 deletions
|
@ -92,8 +92,8 @@ static CBlockIndex CreateBlockIndex(int nHeight)
|
||||||
|
|
||||||
static bool TestSequenceLocks(const CTransaction &tx, int flags) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
|
static bool TestSequenceLocks(const CTransaction &tx, int flags) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
|
||||||
{
|
{
|
||||||
LOCK(mempool.cs);
|
LOCK(::mempool.cs);
|
||||||
return CheckSequenceLocks(tx, flags);
|
return CheckSequenceLocks(::mempool, tx, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test suite for ancestor feerate transaction selection.
|
// Test suite for ancestor feerate transaction selection.
|
||||||
|
|
|
@ -498,7 +498,7 @@ void CTxMemPool::removeForReorg(const CCoinsViewCache *pcoins, unsigned int nMem
|
||||||
const CTransaction& tx = it->GetTx();
|
const CTransaction& tx = it->GetTx();
|
||||||
LockPoints lp = it->GetLockPoints();
|
LockPoints lp = it->GetLockPoints();
|
||||||
bool validLP = TestLockPointValidity(&lp);
|
bool validLP = TestLockPointValidity(&lp);
|
||||||
if (!CheckFinalTx(tx, flags) || !CheckSequenceLocks(tx, flags, &lp, validLP)) {
|
if (!CheckFinalTx(tx, flags) || !CheckSequenceLocks(*this, tx, flags, &lp, validLP)) {
|
||||||
// Note if CheckSequenceLocks fails the LockPoints may still be invalid
|
// 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.
|
// So it's critical that we remove the tx and not depend on the LockPoints.
|
||||||
txToRemove.insert(it);
|
txToRemove.insert(it);
|
||||||
|
|
|
@ -361,10 +361,10 @@ bool TestLockPointValidity(const LockPoints* lp)
|
||||||
return true;
|
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(cs_main);
|
||||||
AssertLockHeld(mempool.cs);
|
AssertLockHeld(pool.cs);
|
||||||
|
|
||||||
CBlockIndex* tip = chainActive.Tip();
|
CBlockIndex* tip = chainActive.Tip();
|
||||||
assert(tip != nullptr);
|
assert(tip != nullptr);
|
||||||
|
@ -387,7 +387,7 @@ bool CheckSequenceLocks(const CTransaction &tx, int flags, LockPoints* lp, bool
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// pcoinsTip contains the UTXO set for chainActive.Tip()
|
// pcoinsTip contains the UTXO set for chainActive.Tip()
|
||||||
CCoinsViewMemPool viewMemPool(pcoinsTip.get(), mempool);
|
CCoinsViewMemPool viewMemPool(pcoinsTip.get(), pool);
|
||||||
std::vector<int> prevheights;
|
std::vector<int> prevheights;
|
||||||
prevheights.resize(tx.vin.size());
|
prevheights.resize(tx.vin.size());
|
||||||
for (size_t txinIndex = 0; txinIndex < tx.vin.size(); txinIndex++) {
|
for (size_t txinIndex = 0; txinIndex < tx.vin.size(); txinIndex++) {
|
||||||
|
@ -679,7 +679,7 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
|
||||||
// be mined yet.
|
// be mined yet.
|
||||||
// Must keep pool.cs for this unless we change CheckSequenceLocks to take a
|
// Must keep pool.cs for this unless we change CheckSequenceLocks to take a
|
||||||
// CoinsViewCache instead of create its own
|
// 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");
|
return state.DoS(0, false, REJECT_NONSTANDARD, "non-BIP68-final");
|
||||||
|
|
||||||
CAmount nFees = 0;
|
CAmount nFees = 0;
|
||||||
|
|
|
@ -347,7 +347,7 @@ bool TestLockPointValidity(const LockPoints* lp) EXCLUSIVE_LOCKS_REQUIRED(cs_mai
|
||||||
*
|
*
|
||||||
* See consensus/consensus.h for flag definitions.
|
* See consensus/consensus.h for flag definitions.
|
||||||
*/
|
*/
|
||||||
bool CheckSequenceLocks(const CTransaction &tx, int flags, LockPoints* lp = nullptr, bool useExistingLockPoints = false) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
bool CheckSequenceLocks(const CTxMemPool& pool, const CTransaction& tx, int flags, LockPoints* lp = nullptr, bool useExistingLockPoints = false) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closure representing one script verification
|
* Closure representing one script verification
|
||||||
|
|
Loading…
Reference in a new issue