Implement dynafed block header support for elements >= 0.18.1 #3440
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.
This implements support for the upcoming
elementsddynafed block headerformat, which is slightly different from either the bitcoin block header
format as well as the
elementsd<= 0.17.0 block header format. A couple offields were added, 3 different serialization formats for the information
(
null,compactandfull) and some of those fields are not hashed intothe block hash, since they'd be self-referential (like the pre-0.18.0 solution
field).
In order to implement this I chose to also simplify the block hash generation,
to happen in parallel with the deserialization. This has a couple of
side-effects:
call
bitcoin_block_blkid. For compatibility I left that function, but itnow just copies over the cached hash instead of re-serializing it.
just consumers of blocks, and we don't have to generate new ones from its
constituent parts.
use to us. It always felt weird having to remember constituent parts only
to be able to re-serialize the header. Now we can just feed it into the
hashing algorithm and skip the actual fields. This also ends up saving us a
couple of allocations.
There are a couple of drive-by fixes, such as weening off of
elementsd'sdeprecated
generateRPC in favor ofgeneratetoaddress, but they should beminor.
Fixes #3362