test: IsFinalTx returns true when there is no locktime

This commit is contained in:
brunoerg
2025-07-21 14:52:35 -03:00
parent 7129c9ea8e
commit 065e42976a

View File

@@ -523,6 +523,10 @@ void MinerTestingSetup::TestBasicMining(const CScript& scriptPubKey, const std::
BOOST_CHECK(TestSequenceLocks(CTransaction{tx}, tx_mempool)); // Sequence locks pass
BOOST_CHECK(IsFinalTx(CTransaction(tx), m_node.chainman->ActiveChain().Tip()->nHeight + 2, m_node.chainman->ActiveChain().Tip()->GetMedianTimePast())); // Locktime passes on 2nd block
// ensure tx is final for a specific case where there is no locktime and block height is zero
tx.nLockTime = 0;
BOOST_CHECK(IsFinalTx(CTransaction(tx), /*nBlockHeight=*/0, m_node.chainman->ActiveChain().Tip()->GetMedianTimePast()));
// absolute time locked
tx.vin[0].prevout.hash = txFirst[3]->GetHash();
tx.nLockTime = m_node.chainman->ActiveChain().Tip()->GetMedianTimePast();