@ -245,18 +245,13 @@ bool TestLockPointValidity(CChain& active_chain, const LockPoints* lp)
return true ;
}
bool CheckSequenceLocks ( C ChainState& active_chainstate ,
const C TxMemPool& pool ,
bool CheckSequenceLocks ( C BlockIndex* tip ,
const C CoinsView& coins_view ,
const CTransaction & tx ,
int flags ,
LockPoints * lp ,
bool useExistingLockPoints )
{
AssertLockHeld ( cs_main ) ;
AssertLockHeld ( pool . cs ) ;
assert ( std : : addressof ( : : ChainstateActive ( ) ) = = std : : addressof ( active_chainstate ) ) ;
CBlockIndex * tip = active_chainstate . m_chain . Tip ( ) ;
assert ( tip ! = nullptr ) ;
CBlockIndex index ;
@ -276,14 +271,12 @@ bool CheckSequenceLocks(CChainState& active_chainstate,
lockPair . second = lp - > time ;
}
else {
// CoinsTip() contains the UTXO set for active_chainstate.m_chain.Tip()
CCoinsViewMemPool viewMemPool ( & active_chainstate . CoinsTip ( ) , pool ) ;
std : : vector < int > prevheights ;
prevheights . resize ( tx . vin . size ( ) ) ;
for ( size_t txinIndex = 0 ; txinIndex < tx . vin . size ( ) ; txinIndex + + ) {
const CTxIn & txin = tx . vin [ txinIndex ] ;
Coin coin ;
if ( ! viewMemPool . GetCoin ( txin . prevout , coin ) ) {
if ( ! coins_ view. GetCoin ( txin . prevout , coin ) ) {
return error ( " %s: Missing input " , __func__ ) ;
}
if ( coin . nHeight = = MEMPOOL_HEIGHT ) {
@ -686,10 +679,10 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
// Only accept BIP68 sequence locked transactions that can be mined in the next
// block; we don't want our mempool filled up with transactions 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
// Pass in m_view which has all of the relevant inputs cached. Note that, since m_view's
// backend was removed, it no longer pulls coins from the mempool.
assert ( std : : addressof ( : : ChainstateActive ( ) ) = = std : : addressof ( m_active_chainstate ) ) ;
if ( ! CheckSequenceLocks ( m_active_chainstate , m_pool , tx , STANDARD_LOCKTIME_VERIFY_FLAGS , & lp ) )
if ( ! CheckSequenceLocks ( m_active_chainstate .m_chain . Tip ( ) , m_view , tx , STANDARD_LOCKTIME_VERIFY_FLAGS , & lp ) )
return state . Invalid ( TxValidationResult : : TX_PREMATURE_SPEND , " non-BIP68-final " ) ;
assert ( std : : addressof ( g_chainman . m_blockman ) = = std : : addressof ( m_active_chainstate . m_blockman ) ) ;