Tracking: #33777
Motivation
Bitcoin Core v32 validates BlockCreateOptions.blockReservedWeight against -blockmaxweight instead of silently clamping, and BlockCreateOptions also controls coinbaseOutputMaxAdditionalSigops.
For IPC clients that dynamically size blockReservedWeight there are three gaps in the current interfaces::Mining / mining.capnp API:
- Node limits are not queryable: Clients have no way to discover the node's configured
-blockmaxweight,MINIMUM_BLOCK_RESERVED_WEIGHT, or maximum block sigops cost. Operators must manually duplicate-blockmaxweightin the mining server's configuration so dynamic reservation increases do not failcreateNewBlock(). - Actual template usage is not exposed:
BlockTemplatedoes not exposetxCount, non-coinbase block weight, or non-coinbase sigops cost. If a block is not full (e.g. a 1.5 MW mempool), a client cannot tell how much spare weight already exists in the template without callinggetBlock()and measuring the serialized block. waitNext()cannot updateBlockCreateOptions:BlockTemplate::waitNext()reuses theBlockCreateOptionscaptured by the originalcreateNewBlock(). When downstream coinbase weight requirements change, the client has to callinterruptWait()and invokecreateNewBlock()again, resetting thewaitNext()fee-threshold baseline.
Proposal
- Expose the node's effective block assembly limits on
Mining(e.g.getBlockLimits()or aBlockLimitsstruct):blockMaxWeight :UInt64minBlockReservedWeight :UInt64maxBlockSigopsCost :UInt64
- Expose lightweight template metrics on
BlockTemplate(e.g.getTemplateStats()):txCount :UInt64(including coinbase)nonCoinbaseWeight :UInt64nonCoinbaseSigopsCost :UInt64totalFees :Int64
- Optionally allow passing updated
BlockCreateOptions(orblockReservedWeight/coinbaseOutputMaxAdditionalSigops) inBlockWaitOptionsforwaitNext(), so reservation updates can be applied cleanly on the next template without interrupting the wait loop.
All three additions are backward-compatible (new methods / optional fields with existing defaults).