HomePhabricator

Add a simplifygbt option to simplify parsing the block template for miners

Description

Add a simplifygbt option to simplify parsing the block template for miners

Summary:
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.

The choice of using an init option rather than a flag is to avoid having the miner special casing the calls for XEC, which would partially defeat the purpose of this diff.

Test Plan:

ninja check-functional

Reviewers: #bitcoin_abc, roqqit

Reviewed By: #bitcoin_abc, roqqit

Subscribers: Mengerian, roqqit, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D17658

Details

Provenance
FabienAuthored on Tue, Feb 11, 14:08
FabienPushed on Thu, Feb 13, 08:29
Reviewer
Restricted Project
Differential Revision
D17658: Add a simplifygbt option to simplify parsing the block template for miners
Parents
rABC4d18082f0bad: Bump version to 0.30.11
Branches
Unknown
Tags
Unknown