From c6638fa7c5e97f9fd7a5ea8feb29f8caeac788bd Mon Sep 17 00:00:00 2001 From: Ryan Ofsky Date: Mon, 9 Feb 2026 15:44:27 -0500 Subject: [PATCH] ipc mining: provide default option values (incompatible schema change) This change copies default option values from the C++ mining interface to the Cap'n Proto interface. Currently, no capnp default values are set, so they are implicitly all false or 0, which is inconvenient for the rust and python clients and inconsistent with the C++ client. Warning: This is an intermediate, review-only commit. Binaries built from it should not be distributed or used to connect to other clients or servers. It makes incompatible changes to the `mining.capnp` schema without updating the `Init.makeMining` version, causing binaries to advertise support for a schema they do not actually implement. Mixed versions may therefore exchange garbage requests/responses instead of producing clear errors. The final commit in this series bumps the mining interface number to ensure mismatches are detected. git-bisect-skip: yes --- src/ipc/capnp/mining.capnp | 16 ++++++++-------- test/functional/interface_ipc_mining.py | 10 +--------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/ipc/capnp/mining.capnp b/src/ipc/capnp/mining.capnp index 7e5cced6f31..1811716ff54 100644 --- a/src/ipc/capnp/mining.capnp +++ b/src/ipc/capnp/mining.capnp @@ -21,7 +21,7 @@ interface Mining $Proxy.wrap("interfaces::Mining") { isTestChain @0 (context :Proxy.Context) -> (result: Bool); isInitialBlockDownload @1 (context :Proxy.Context) -> (result: Bool); getTip @2 (context :Proxy.Context) -> (result: Common.BlockRef, hasResult: Bool); - waitTipChanged @3 (context :Proxy.Context, currentTip: Data, timeout: Float64) -> (result: Common.BlockRef); + waitTipChanged @3 (context :Proxy.Context, currentTip: Data, timeout: Float64 = .maxDouble) -> (result: Common.BlockRef); createNewBlock @4 (options: BlockCreateOptions) -> (result: BlockTemplate); checkBlock @5 (block: Data, options: BlockCheckOptions) -> (reason: Text, debug: Text, result: Bool); } @@ -43,19 +43,19 @@ interface BlockTemplate $Proxy.wrap("interfaces::BlockTemplate") { } struct BlockCreateOptions $Proxy.wrap("node::BlockCreateOptions") { - useMempool @0 :Bool $Proxy.name("use_mempool"); - blockReservedWeight @1 :UInt64 $Proxy.name("block_reserved_weight"); - coinbaseOutputMaxAdditionalSigops @2 :UInt64 $Proxy.name("coinbase_output_max_additional_sigops"); + useMempool @0 :Bool = true $Proxy.name("use_mempool"); + blockReservedWeight @1 :UInt64 = .defaultBlockReservedWeight $Proxy.name("block_reserved_weight"); + coinbaseOutputMaxAdditionalSigops @2 :UInt64 = .defaultCoinbaseOutputMaxAdditionalSigops $Proxy.name("coinbase_output_max_additional_sigops"); } struct BlockWaitOptions $Proxy.wrap("node::BlockWaitOptions") { - timeout @0 : Float64 $Proxy.name("timeout"); - feeThreshold @1 : Int64 $Proxy.name("fee_threshold"); + timeout @0 : Float64 = .maxDouble $Proxy.name("timeout"); + feeThreshold @1 : Int64 = .maxMoney $Proxy.name("fee_threshold"); } struct BlockCheckOptions $Proxy.wrap("node::BlockCheckOptions") { - checkMerkleRoot @0 :Bool $Proxy.name("check_merkle_root"); - checkPow @1 :Bool $Proxy.name("check_pow"); + checkMerkleRoot @0 :Bool = true $Proxy.name("check_merkle_root"); + checkPow @1 :Bool = true $Proxy.name("check_pow"); } struct CoinbaseTx $Proxy.wrap("node::CoinbaseTx") { diff --git a/test/functional/interface_ipc_mining.py b/test/functional/interface_ipc_mining.py index d4a0d87e767..a02727bb4c9 100755 --- a/test/functional/interface_ipc_mining.py +++ b/test/functional/interface_ipc_mining.py @@ -243,9 +243,6 @@ class IPCMiningTest(BitcoinTestFramework): async with AsyncExitStack() as stack: opts = self.capnp_modules['mining'].BlockCreateOptions() - opts.useMempool = True - opts.blockReservedWeight = 4000 - opts.coinbaseOutputMaxAdditionalSigops = 0 template = await mining_create_block_template(mining, stack, ctx, opts) assert template is not None block = await mining_get_block(template, ctx) @@ -351,12 +348,7 @@ class IPCMiningTest(BitcoinTestFramework): def run_test(self): self.miniwallet = MiniWallet(self.nodes[0]) - self.default_block_create_options = self.capnp_modules['mining'].BlockCreateOptions( - useMempool=True, - blockReservedWeight=4000, - coinbaseOutputMaxAdditionalSigops=0 - ) - + self.default_block_create_options = self.capnp_modules['mining'].BlockCreateOptions() self.run_mining_interface_test() self.run_block_template_test() self.run_coinbase_and_submission_test()