The current block template is convoluted for the miner fund and the staking rewards:
- It is deeply nested, requiring lots of null checks in the miner code
- The miner fund uses an array for a single value, and address instead of script which requires decoding on the miner code
- The staking rewards includes a lot of debug information that are irrelevant for miners and causes confusion. E.g. it includes addresses even if any standard script can be used (so address might be absent, or multiple).
This diff adds an option, currently opt-in, to simplify the output for these objects:
- They now live at the root of the block template object, so coinbasetxn is compliant with bip22
- They only contain the data which is useful for miners, i.e. the script and the amount to be included in the coinbase output.
Depends on D17657.