From c4f68c12e228818f655352d17d038dcc7ba1db3a Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Wed, 8 Jan 2025 19:03:30 +0100 Subject: [PATCH] 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. --- test/functional/test_framework/blocktools.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/functional/test_framework/blocktools.py b/test/functional/test_framework/blocktools.py index 7c455ea52f2..c6ebf77deb8 100644 --- a/test/functional/test_framework/blocktools.py +++ b/test/functional/test_framework/blocktools.py @@ -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)])