mining: expose block weight/sigop limits and template usage stats via IPC (and optional BlockCreateOptions on waitNext) #37013

issue mutatrum opened this issue on November 29, 2026
  1. mutatrum commented at 10:27 PM on November 29, 2026: contributor

    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:

    1. 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 -blockmaxweight in the mining server's configuration so dynamic reservation increases do not fail createNewBlock().
    2. Actual template usage is not exposed: BlockTemplate does not expose txCount, 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 calling getBlock() and measuring the serialized block.
    3. waitNext() cannot update BlockCreateOptions: BlockTemplate::waitNext() reuses the BlockCreateOptions captured by the original createNewBlock(). When downstream coinbase weight requirements change, the client has to call interruptWait() and invoke createNewBlock() again, resetting the waitNext() fee-threshold baseline.

    Proposal

    1. Expose the node's effective block assembly limits on Mining (e.g. getBlockLimits() or a BlockLimits struct):
      • blockMaxWeight :UInt64
      • minBlockReservedWeight :UInt64
      • maxBlockSigopsCost :UInt64
    2. Expose lightweight template metrics on BlockTemplate (e.g. getTemplateStats()):
      • txCount :UInt64 (including coinbase)
      • nonCoinbaseWeight :UInt64
      • nonCoinbaseSigopsCost :UInt64
      • totalFees :Int64
    3. Optionally allow passing updated BlockCreateOptions (or blockReservedWeight / coinbaseOutputMaxAdditionalSigops) in BlockWaitOptions for waitNext(), 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).


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-11-30 04:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me