DEPENDENT: API: Expose bitcoinconsensus_verify_header() in libconsensus#5995
Closed
jtimon wants to merge 14 commits intobitcoin:masterfrom
Closed
DEPENDENT: API: Expose bitcoinconsensus_verify_header() in libconsensus#5995jtimon wants to merge 14 commits intobitcoin:masterfrom
jtimon wants to merge 14 commits intobitcoin:masterfrom
Conversation
75b466c to
3e23de9
Compare
e6adb85 to
f086046
Compare
Contributor
Author
|
Needed rebase |
Contributor
Author
There was a problem hiding this comment.
Feel free to suggest something. Probably better to comment in the smaller PRs for now as this branch will likely require more rebases and force pushes. In this case, the relevant PR is #6009
8ce53eb to
7e0cd14
Compare
This was referenced Apr 20, 2015
from main.cpp: -CheckBlockHeader -ContextualCheckBlockHeader -IsSuperMajority from pow.cpp: -CalculateNextWorkRequired -CheckProofOfWork -GetNextWorkRequired
7e0cd14 to
00b9b22
Compare
Contributor
Author
|
I realized this is mostly unreadable until something similar to #6048 is merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
To extend libconsensus' functionality, I propose to add
bitcoinconsensus_verify_header()the partial checksCheckBlockHeader()andContextualCheckBlockHeadercould be exposed as well.Unlike VerifyScript, VerifyBlockHeader depends on the nodes storage, as it requires data from the blockchain previous to the header being verified. How to exactly interface that data with VerifyBlockHeader can be a delicate matter and it should be of course open to discussion. Here there's just one proposal.
The offending dependency is CBlockIndex in chain.o, specially CBlockIndex::pprev which is a pointer to another object. All the other dependencies unacceptable for libconsensus have been removed first, to make things easier for someone who wants to propose to solve that final problem in some other way.
Dependencies:
-MOVEONLY: Move most consensus function declarations to consensus/consensus.h #6048
-Consensus: Refactor: Consensus version of CheckBlockHeader() #6035
-Separate CValidationState from main #5669
-Chainparams: Refactor: Decouple IsSuperMajority from Params() #5968
-Consensus: Decouple ContextualCheckBlockHeader from checkpoints #5975
-Consensus: Turn CBlockIndex::GetMedianTimePast into independent function #6009
-Consensus: Consensus version of pow functions #6037