Skip to content

Skip deep-reorg parking during initial block download / reindex#136

Open
VictorLux wants to merge 1 commit into
ZclassicCommunity:masterfrom
VictorLux:pr/parkdeepreorg-ibd-gate
Open

Skip deep-reorg parking during initial block download / reindex#136
VictorLux wants to merge 1 commit into
ZclassicCommunity:masterfrom
VictorLux:pr/parkdeepreorg-ibd-gate

Conversation

@VictorLux

Copy link
Copy Markdown

Summary

The deep-reorg park in AcceptBlock fires spuriously during -reindex, because blocks are loaded from blk*.dat out of height order — so the "would cause a deep reorg" test (fork depth > 1) triggers and parks large swaths of the chain, stalling a from-genesis reindex. Gate the park behind !IsInitialBlockDownload().

Safety

At-tip behaviour is unchanged: IsInitialBlockDownload() latches to false after first catch-up, so once synced the parking is always active again (an attacker cannot disable it by staling the tip). During IBD the node only follows the best-work chain forward; deep-reorg protection is an at-tip defense, and the skip window remains backstopped by depth-N auto-finalization and the MAX_REORG_LENGTH cap.

… stall)

The deep-reorg park in AcceptBlock fired during -reindex because blocks are loaded from blk*.dat out of height order, so 'would cause a deep reorg' (fork depth > 1) triggers spuriously and parks large swaths of the chain — the stall that forces -parkdeepreorg=0 on a from-genesis reindex (observed at ~478543). Gate the park behind !IsInitialBlockDownload(): deep-reorg/51% protection is an at-tip defense; during IBD the node only follows the best chain forward, so there is nothing to protect. Behaviour at tip is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant