Repository navigation
ibd: refill an empty header queue from the stored tip #1015
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9d5f6b1
test: empty header queue must ask from the stored tip
rearden-grok[bot] ea9f425
ibd: refill an empty header queue from the stored tip
rearden-grok[bot] 5966c59
test: proved tip must not chase a peer, and a checkpoint miss must no…
rearden-grok[bot] f9775f4
ibd: do not chase a proved tip or keep a checkpoint miss
rearden-grok[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| Changed | ||
|
|
||
| - **During IBD there is one headers question: the header after the candidate.** The locator also names a lighter fork still being weighed. A refused low-work batch is not paged, and a connecting peer does not start a second headers sync. An unknown block inv from outside the header slot does not retire the reserved peer. After IBD, connect-time headers sync is unchanged. | ||
| - **During IBD one peer is asked for the next header that is not stored.** While the queue has room the locator starts at the stored tip, then the candidate and a lighter fork. A full queue asks from the candidate. A refused low-work batch is not paged. Only one connecting peer starts headers sync. An unknown block inv from outside the header slot does not retire the reserved peer. After IBD, connect-time headers sync is unchanged. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Fixed | ||
|
|
||
| - **An empty header queue during IBD asks from the stored tip.** A reply that continues that tip is written onto the queue even when it stops short of the next checkpoint, so block download can resume when a restart kept the walk checkpoint and not the headers in between. A reply that misses the checkpoint does not occupy the gap, and a later reply that meets it replaces the short guess. A `headers_done` latch that never proved a walk opens again when a peer is ahead. A proved walk already at the confirmed tip does not. A connecting peer still gets the one initial headers sync. |
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
[bug]
!headers_completeis broader than "a latch that never proved a walk."headers_completeis false when the walk tip is above the confirmed tip (the hole this patch should reopen) and also when any non-quiet live peer haspeer_heightabove a proved walk that is already at the confirmed tip (wants_lookahead).header_lag_behind_peersstill usesmax_peer_height, so a farversion.start_heightunlatches. The newshould_unlatch_headers_donetest never inserts a slot, andprove_throughdoes not set a tip hash, sowants_lookaheadstays false and the signet assertion does not cover a connected peer. After the unlatch,header_pollwill notLatchDonewhileempty_path_header_fanseeslag > 2. A full 2000-header reply returns beforesettle_walk_peercan insertwalk_quiet, soheaders_completestays false.headers_doneis only set again by an empty reply orLatchDone.ibd_caught_upthen stays false (headers_completefalse andlag > 2requiresheaders_done), and the main loop keeps enqueueingHeaderCmd::Askon the empty-path cadence. A proved walk above the confirmed tip with a real hole should still unlatch; that part is not this bug. A proved walk at the confirmed tip must not.Suggestion: Unlatch a proved walk only when its tip is above the confirmed tip or above
max_ordered_height(the missing download path). When the walk is proved andtip_height() <= tip_h, keep the old rule: do not clearheaders_doneforlag > 2. Add a slot whosepeer_heightis far above that tip toshould_unlatch_headers_doneand expect no unlatch. Re-latch, or leave the latch set, when a full window fails to extend the candidate so catch-up can still finish.