-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assert height to hash in contains block #19136
Conversation
Pull Request Test Coverage Report for Build 13111506377Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
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.
given that contains_block()
is non-trivial now, it would probably be good to have a unit test
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.
looks good, just a few comments/questions
|
Purpose:
use the height to hash when checking for "contains_block" block that way we always get the relevant block for the chain being validated
and create better separation between Augmentedblockchain and the underlining blockchain.
Current Behavior:
we call contains block that checks the block_record cache, this will return true if the block is in the cache regardless if is relevant to the chain
New Behavior:
contains_block will check the height_to_hash, the AugmentedBlockchain will return true for blocks that are in the fork and the underlining will return true only for blocks that are in the current chain, as we switch to the fork blocks in the underlying blockchain once the new blocks pass the height of the old fork peak we clean the height_to_hash blocks from the augmented (since now they are present in the underlying height_to_hash)
Testing Notes: