From 557f7db468781ee5b9baec6fbc2977f9e09f0abc Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Wed, 31 Jan 2024 16:15:57 -0300 Subject: [PATCH 1/2] Extend signetchallenge to set target block spacing Inspired by https://github.com/bitcoin/bitcoin/pull/27446, this commit implements the proposal detailed in the comment https://github.com/bitcoin/bitcoin/pull/27446#issuecomment-1516600820. Rationale. Introduce the ability to configure a custom target time between blocks in a custom Bitcoin signet network. This enhancement enables users to create a signet that is more conducive to testing. The change enhances the flexibility of signet, rendering it more versatile for various testing scenarios. For instance, I am currently working on setting up a signet with a 30-second block time. However, this caused numerous difficulty adjustments, resulting in an inconsistent network state. Regtest isn't a viable alternative for me in this context since we prefer defaults to utilize our custom signet when configured, without impeding local regtest development. Implementation. If the challenge format is "OP_RETURN PUSHDATA PUSHDATA", the actual challenge from the second data push is used as the signet challenge, and the parameters from the first push are used to configure the network. Otherwise the challenge is used as is. This change is backward-compatible, as per the old rules, such a signet challenge would always evaluate to false, rendering it unused. The only parameter currently available is "target_spacing" (default 600 seconds). To set it, place "0x01" in the params. Empty params are also valid. If other network parameters are added in the future, they should use "0x02