Use OP_0 for BIP34 padding in signet and tests

For blocks 1 through 15 the script_BIP34_coinbase_height appends OP_1
to comply with BIP34 and avoid bad-cb-length.

This is inconsistent with BlockAssembler::CreateNewBlock() which adds
OP_0 instead.

The utxo_total_supply fuzzer and MinerTestingSetup::Block also use OP_0.

Changing it is required to import the test vectors in the next commit.

It also ensures the test vectors can be regenerated using the CPU miner
at https://github.com/pooler/cpuminer without patches (it uses OP_0).

The same helper is used by the signet miner, so this will impact newly
bootstrapped signets.
This commit is contained in:
Sjors Provoost 2025-01-08 19:03:30 +01:00
parent cf0a62878b
commit c4f68c12e2
No known key found for this signature in database
GPG key ID: 57FF9BDBCC301009

View file

@ -35,7 +35,7 @@ from .script import (
CScript,
CScriptNum,
CScriptOp,
OP_1,
OP_0,
OP_RETURN,
OP_TRUE,
)
@ -128,8 +128,8 @@ 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 above 2 (see bad-cb-length consensus rule)
return CScript([res, OP_1])
# Append dummy to increase scriptSig size to 2 (see bad-cb-length consensus rule)
return CScript([res, OP_0])
return CScript([CScriptNum(height)])