This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
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.
Avoid a duplicate block request when syncing from a fork #11094
Avoid a duplicate block request when syncing from a fork #11094
Changes from 5 commits
c795f03
20dd632
01ee1fb
4556c57
9fda717
66dd756
b9e2df8
725ead1
913cb5e
5e714fb
216b448
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
The current implementation of this function could lead to deleting data in the queue that we don't yet have imported. You always set
prev = start + len
. If we have data that was downloaded after the last call toready_blocks
, we would also delete this.I think we should change the
clear_queued
to take the hash of the first block that was returned byready_blocks
.Internally we would add a
HashMap<Block::Hash, usize>
where the second parameter is the number of entries we need to delete inself.blocks
. We would insert the value there inready_blocks
.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.
Ah, that makes sense. Since we need to know the start number of the range along with the number of entries, instead of a
HashMap<Block::Hash, usize>
I went with aHashMap<Block::Hash, (NumberFor<Block>, NumberFor<Block>)>
.