@ -20,6 +20,15 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
return true ;
return true ;
if ( ( int64_t ) tx . nLockTime < ( ( int64_t ) tx . nLockTime < LOCKTIME_THRESHOLD ? ( int64_t ) nBlockHeight : nBlockTime ) )
if ( ( int64_t ) tx . nLockTime < ( ( int64_t ) tx . nLockTime < LOCKTIME_THRESHOLD ? ( int64_t ) nBlockHeight : nBlockTime ) )
return true ;
return true ;
// Even if tx.nLockTime isn't satisfied by nBlockHeight/nBlockTime, a
// transaction is still considered final if all inputs' nSequence ==
// SEQUENCE_FINAL (0xffffffff), in which case nLockTime is ignored.
//
// Because of this behavior OP_CHECKLOCKTIMEVERIFY/CheckLockTime() will
// also check that the spending input's nSequence != SEQUENCE_FINAL,
// ensuring that an unsatisfied nLockTime value will actually cause
// IsFinalTx() to return false here:
for ( const auto & txin : tx . vin ) {
for ( const auto & txin : tx . vin ) {
if ( ! ( txin . nSequence = = CTxIn : : SEQUENCE_FINAL ) )
if ( ! ( txin . nSequence = = CTxIn : : SEQUENCE_FINAL ) )
return false ;
return false ;