Rewind the download window with the position on regression. - #10
Open
echennells wants to merge 2 commits into
Open
echennells wants to merge 2 commits into
echennells wants to merge 2 commits into
Conversation
echennells
force-pushed
the
reorg-window-rewind
branch
4 times, most recently
from
September 15, 2026 22:01
34f1f35 to
9b25e7b
Compare
A regression below the position rewound the position but not the window (requested_/advanced_), and a regression above the position but within the window was ignored. Either way set_unassociated() then deferred new work until the gap at the replaced height was filled, which only a request can do, so a tip reorg stopped block download until restart while headers continued. Guard on the window and rewind both with the position. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
echennells
force-pushed
the
reorg-window-rewind
branch
from
September 18, 2026 15:50
5758a7c to
89b04d6
Compare
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
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.
chaser_check::do_regressedrewinds the position and purges outstanding work but leavesrequested_andadvanced_at their pre-regression heights, and ignores a regression above the position even when it is inside the requested window. Either wayset_unassociatedthen defers all new work (position() < requested_) until the gap is filled, and the gap is the replaced block at the regression height, which only the deferred request can fill. Block download stops while headers continue; a restart clears it becausestart()re-seeds the window from the position.The guard now considers the window as well as the position, and both are rewound before the purge, as at start.
The validator has the same gap (second commit): after a regression it advances only on a checked event for the block above the branch point, which never arrives when that block is already associated, as when a reorg returns to a branch already downloaded. Validation stops, so the download window never advances either. It now resumes from the branch point as
startdoes.Reproduced on regtest against bitcoind: sync to N, invalidate N and mine two on a competing branch; master stays at N while patched follows. Issuing the same reorg while blocks below N are still downloading stalls at N-1 unless the guard is on the window. For the validator: mine A, invalidate it and mine B,C, then reconsider A and mine on it; the first commit alone stalls at C, both follow. The validator case was first observed as a 21 hour stall on a testnet3 block storm.
🤖 Generated with Claude Code