mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-26 06:48:53 +02:00
qa: use prev height as nLockTime for coinbase txs created in unit tests
We don't set the nSequence as it will be set directly in the block template generator in a following commit.
This commit is contained in:
@@ -82,7 +82,9 @@ std::shared_ptr<CBlock> MinerTestingSetup::Block(const uint256& prev_hash)
|
||||
txCoinbase.vout[0].nValue = 0;
|
||||
txCoinbase.vin[0].scriptWitness.SetNull();
|
||||
// Always pad with OP_0 at the end to avoid bad-cb-length error
|
||||
txCoinbase.vin[0].scriptSig = CScript{} << WITH_LOCK(::cs_main, return m_node.chainman->m_blockman.LookupBlockIndex(prev_hash)->nHeight + 1) << OP_0;
|
||||
const int prev_height{WITH_LOCK(::cs_main, return m_node.chainman->m_blockman.LookupBlockIndex(prev_hash)->nHeight)};
|
||||
txCoinbase.vin[0].scriptSig = CScript{} << prev_height + 1 << OP_0;
|
||||
txCoinbase.nLockTime = static_cast<uint32_t>(prev_height);
|
||||
pblock->vtx[0] = MakeTransactionRef(std::move(txCoinbase));
|
||||
|
||||
return pblock;
|
||||
|
||||
Reference in New Issue
Block a user