-
Notifications
You must be signed in to change notification settings - Fork 21
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
Sliding blocks window #24
Draft
samay-kothari
wants to merge
15
commits into
utreexo:main
Choose a base branch
from
samay-kothari:slidingBlocksWindow
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
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
Pull Request Test Coverage Report for Build 2659025298
💛 - Coveralls |
go.yml: Fix github workflow and linting errors
ProcessBlockHeader allows for seprately validation and accepting block headers which is needed for header-first block downloads
Exporting chain setup will allow it to be used in other packages, to be used while testing
These tests would be useful for testing valdiation process of block headers introduced by ProcessBlockHeader
Header validation
Making the required changes in the processBlock and maybeAcceptBlock function, such that they work with the headervalidation process and accept already validated headers.
When the block data is being validated for an already validated header, then we modify the behavioural flag, so that we don't repeat the header validation steps again
HaveBlockWithData is a modification of HaveBlock function, but here we return true only if we have block data also present along with the block node.
Adding the functionality that the headers would be validated as soon as they are recieved from the peer
… and processHeaderBlocks Adding the tests that would check if a block with validated header give the expected reponse when block data is added to that node.
best header tracks the highest work block node in the index that is not known to be invalid. This is specifically useful when we don't have the block data. However, since block nodes are only added to the index for block headers that pass all sanity and positional checks, which include checking proof of work, it does represent the tip of the header chain with the highest known work that has a reasonably high chance of becoming the best chain tip and is useful for things such as reporting progress and discovering the most suitable blocks to download.
NodeHeightByHash function returns the height of the block with the given hash in the main chain. It does not check of the node is on the main chain, so returns heigh of the node which is created by header validation.
PutNextNeededBlocks populates the provided slice with hashes for the next blocks after the current best chain tip that are needed to make progress towards the current best known header skipping any blocks that already have their data available. BestHeader returns the header with the most cumulative work that is NOT known to be invalid.
implementing maybeUpdateNextNeededBlocks function that populates the sliding window with next blocks whose headers are validated using the PutNextNeededBlocks function. fetchNextBlocks function creates and sends a request to the provided peer for next blocks to be downloaded based on the current headers.
samay-kothari
force-pushed
the
slidingBlocksWindow
branch
from
August 23, 2022 09:23
c201dc8
to
5a00fd9
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adding the sliding window functionality where the syncManager maintains a moving window that contains all the headers that have been validated and are ready for block download.
We slide forward on the window and requests for the blocks to be downloaded.