When generating a block template through e.g. getblocktemplate RPC, we reserve 4000 weight units and 400 sigops. Pools use this space for their coinbase outputs.
At least one pool patched their Bitcoin Core node to adjust these hardcoded values. They eventually produced an invalid block which exceeded the sigops limit.
The existince of such patches suggests it may be useful to make this value configurable. This PR would make such a change easier. However, the main motivation is that in the Stratum v2 spec requires the pool to communicate the maximum bytes they intend to add to the coinbase outputs.
Specifically the CoinbaseOutputDataSize
message which is part of the Template Distribution Protocol has a field coinbase_output_max_additional_size
.
A proposed change to the spec adds the max additional sigops as well: https://github.com/stratum-mining/sv2-spec/pull/86. Whether that change makes it into the spec is not important though, as adding both to BlockAssembler::Options
makes sense.
The first commit is a test refactor followup for #30335, related to the code that’s changed here, but not required.
The second commit introduces BlockCreateOptions, with just use_mempool
.
The thirds commit adds coinbase_max_additional_weight
and coinbase_output_max_additional_sigops
to BlockCreateOptions
. They use the originally hardcoded values, and no existing caller overrides these defaults. This changes in #29432.