[doc] Update comments on dummy extraNonces in tests

This commit is contained in:
Anthony Towns
2025-11-01 04:46:17 +10:00
committed by Sjors Provoost
parent 27aeeff630
commit 78df9003d6
3 changed files with 3 additions and 2 deletions

View File

@@ -82,7 +82,7 @@ std::shared_ptr<CBlock> MinerTestingSetup::Block(const uint256& prev_hash)
txCoinbase.vout[1].nValue = txCoinbase.vout[0].nValue;
txCoinbase.vout[0].nValue = 0;
txCoinbase.vin[0].scriptWitness.SetNull();
// Always pad with OP_0 at the end to avoid bad-cb-length error
// Always pad with OP_0 as dummy extraNonce (also avoids bad-cb-length error for block <=16)
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);