- This PR attempts to fix the duplicate coinbase weight reservation issue we currently have.
- Fixes #21950
We reserve 4000 weight units for coinbase transaction in DEFAULT_BLOCK_MAX_WEIGHT
And also reserve additional 4000
weight units in the default BlockCreationOptions
struct.
Motivation
- This issue was first noticed during a review here #11100 (review))
- It was later reported in issue #21950.
- I also came across the bug while writing a test for building the block template. I could not create a block template above
3,992,000
in the block assembler, and this was not documented anywhere. It took me a while to realize that we were reserving space for the coinbase transaction weight twice.
This PR fixes this by consolidating the reservation to be in a single location in the codebase.
This PR then adds a new startup option -blockreservedweight
whose default is 8000
that can be used to lower or increase the block reserved weight for block header, txs count, coinbase tx.