mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-09 02:59:31 +08:00
[doc] Update comments on dummy extraNonces in tests
This commit is contained in:
committed by
Sjors Provoost
parent
27aeeff630
commit
78df9003d6
@@ -49,6 +49,7 @@ std::vector<std::shared_ptr<CBlock>> CreateBlockChain(size_t total_height, const
|
||||
coinbase_tx.vout.resize(1);
|
||||
coinbase_tx.vout[0].scriptPubKey = P2WSH_OP_TRUE;
|
||||
coinbase_tx.vout[0].nValue = GetBlockSubsidy(height + 1, params.GetConsensus());
|
||||
// Always include OP_0 as a dummy extraNonce.
|
||||
coinbase_tx.vin[0].scriptSig = CScript() << (height + 1) << OP_0;
|
||||
block.vtx = {MakeTransactionRef(std::move(coinbase_tx))};
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -164,7 +164,7 @@ def add_witness_commitment(block, nonce=0):
|
||||
def script_BIP34_coinbase_height(height):
|
||||
if height <= 16:
|
||||
res = CScriptOp.encode_op_n(height)
|
||||
# Append dummy to increase scriptSig size to 2 (see bad-cb-length consensus rule)
|
||||
# Append dummy extraNonce to increase scriptSig size to 2 (see bad-cb-length consensus rule)
|
||||
return CScript([res, OP_0])
|
||||
return CScript([CScriptNum(height)])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user