Skip to content

Commit c4f68c1

Browse files
committed
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.
1 parent cf0a628 commit c4f68c1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/functional/test_framework/blocktools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
CScript,
3636
CScriptNum,
3737
CScriptOp,
38-
OP_1,
38+
OP_0,
3939
OP_RETURN,
4040
OP_TRUE,
4141
)
@@ -128,8 +128,8 @@ def add_witness_commitment(block, nonce=0):
128128
def script_BIP34_coinbase_height(height):
129129
if height <= 16:
130130
res = CScriptOp.encode_op_n(height)
131-
# Append dummy to increase scriptSig size above 2 (see bad-cb-length consensus rule)
132-
return CScript([res, OP_1])
131+
# Append dummy to increase scriptSig size to 2 (see bad-cb-length consensus rule)
132+
return CScript([res, OP_0])
133133
return CScript([CScriptNum(height)])
134134

135135

0 commit comments

Comments
 (0)