fix(hardfork): built-in miner shouldn't ignore the extension field in block templates #2876
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
The built-in miner will ignore the extension field in block templates.
Reason
When call
as_builder()
to convert aBlock
to aBlockBuilder
, all extra fields will be ignored, because the generated code ofBlockBuilder
couldn't know any about extra fields.And the extension field is an extra field on the molecule-serialized
struct Block
, it will be ignored, too.Solution
We already have the advanced
Block
builder, which is not generated.The
as_advanced_builder
will handle the extension field.How to reproduce the issue and test the solution?
Set the
extension
in theTxPoolService::build_block_template(..)
to the follow value:Start a dev chain with
func = "Eaglesong"
and run a built-in miner.Check the extension field in all blocks.