Repository navigation
net: reconsiderblock connects restored paths as one branch - #1079
Closed
niteshbalusu11 wants to merge 1 commit into
Closed
niteshbalusu11 wants to merge 1 commit into
niteshbalusu11 wants to merge 1 commit into
Conversation
niteshbalusu11
marked this pull request as draft
October 18, 2026 21:52
reconsiderblock re-applied each restored path on its own. Each path had to outweigh the tip by itself, and a path whose parent sat in a refused path failed with "branch parent not on chain". A chain that only outweighed the tip as a whole stayed inactive. A restored block that lost was also forgotten, so a later invalidateblock could not fall back to it. Restored paths now join parent-first into branches, and the heaviest connects first, still from their recorded block lists. A restored tip that loses and came from the archive goes into fork_tips, so it is a valid fork and a fallback for invalidateblock, as in Core. Header-only and connected blocks are not added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
niteshbalusu11
force-pushed
the
net/reconsider-most-work
branch
from
October 18, 2026 22:14
5af8a59 to
b949829
Compare
Contributor
Author
|
Closing in favor of #1080. Two small fixes each broke other cases, so I'd like your view on the design first. |
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.
Summary
reconsiderblockre-applied each restored invalidated path on its own. Each path had to outweigh the current tip by itself, and a path whose parent sat in a refused path hitbranch parent not on chain, which was swallowed. Nothing then picked the best chain, and a reconsidered block that lost was forgotten as a candidate. Core clears the flags, re-adds the blocks tosetBlockIndexCandidates, and runsActivateBestChain.Evidence
Same RPC sequences on Core 31.1 and rbitcoin (regtest):
invalidateblock a10,invalidateblock a8; mine b8, b9;reconsiderblock a8invalidateblock a5; mine b5, b6;reconsiderblock a5;invalidateblock b5reconsider_activates_the_most_work_chain(A) andinvalidate_falls_back_to_a_reconsidered_block(B).invalid_child_missing_parent_and_linked_reconsiderstill passes.cargo test --workspace, andci-os-smoke.shpass locally.Merge Danger
Door: two-way
Blast Radius: chain selection
Only
reconsiderblockchanges, plus the laterinvalidateblockfallback. It now uses the same most-work pickinvalidateblockalready used, including its precious and first-seen tie-breaks. A losing branch stays a candidate infork_tipsand still needs strictly more work to connect. Peer-driven reorgs are unchanged.🤖 Generated with Claude Code