-
Notifications
You must be signed in to change notification settings - Fork 990
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempting to use sync_pmmr instead of header_pmmr during kernel vali…
…dation.
- Loading branch information
David Burkett
committed
Nov 24, 2018
1 parent
07aacf6
commit 14a8852
Showing
1 changed file
with
8 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
14a8852
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit: sorry - this comment was specific to the "use sync MMR for validating kernels"... I think I replied to something in github and didn't realize this would appear as a generic comment on the PR...
What's the rationale for this?
The reason we kept the sync MMR out of the full extension is it doesn't necessarily track the same data.
The sync head will track headers on a possible fork.
The header MMR itself though will track headers (for full blocks) on the (what we believe to be) main chain.
If we're validating kernels I think the header MMR is more applicable.
Adding the sync MMR to the extension gets complicated and potentially error prone as the heads of the various MMRs may not always align.
14a8852
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very long story. The not-very-quick TL;DR is I was trying to get a header by height of the header 'chain' (ie. the one 'header_head' points to), not the fully validated block 'chain' (the one 'head' points to). Since we only populate the store with block height indices after we've fully validated the block 'chain', I had no quick way of doing this. I attempted to use sync_pmmr (since header_pmmr isn't populated until the chain is fully validated, I believe) because I erroneously thought the leaves were the hashes of the headers, and I could figure out heights that way, but I quickly realized the leaf hashes also include the index when hashing. So the next commit I reverted these changes.
In order to get around the need for knowing block heights, the Kernels message had to be changed to include the block hashes that the kernels belong to (https://github.com/mimblewimble/grin/blob/d468f595c829339e9526a76de40c0b8c88af4d13/p2p/src/msg.rs).