Skip to content

ibd: ignore less-work high-height forks when finding tip - #315

Merged
reardencode merged 1 commit into
masterfrom
ibd/most-work-tip-horizon
Sep 3, 2026
Merged

ibd: ignore less-work high-height forks when finding tip#315
reardencode merged 1 commit into
masterfrom
ibd/most-work-tip-horizon

Conversation

@rearden-grok

@rearden-grok rearden-grok Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Why

Restart at mainnet tip 965251 immediately sat in empty-headers with
lag=993 behind max_peer_height=966244. Honest peers and explorers
were at ~965249. 60.228.121.28 (and version.start_height max) advertised
~900 extra height. That is not more work on our path.

We were not on a minority fork we failed to reorg. Confirm followed
most-work to the real tip. Catch-up then refused to finish because lag is
max_peer_height − path HWM, and empty replies with lag>2 never set
headers_done.

Change

  • Off-path headers: register_explore only (potential future path). Do
    not raise max_peer_height / max_ordered_height.
  • Empty headers with a drained work path is EOF even if advertised
    height is hundreds ahead.
  • ibd_caught_up: headers_done at the most-work path completes; lag>2
    is not a tip we chase. A 2-block connecting hole still holds exit.
  • should_unlatch_headers_done: only a 1–2 block hole, not a 900-block
    less-work claim.

Related: #314 (reseed CPU). This is the actual stuck-at-tip latch.

Restart-at-tip treated max(version.start_height) / off-path header
height as the horizon. Empty getheaders at the most-work path then
never counted as EOF (lag≈900), so IBD stayed in catch-up.

Off-path headers still register_explore. They no longer raise
max_peer_height. Empty replies with a drained work path mark
headers_done even when advertised height is far ahead; catch-up
completes. A 1–2 block connecting hole still unlatches.
@rearden-grok
rearden-grok Bot force-pushed the ibd/most-work-tip-horizon branch from e6d5ee2 to 452ecb7 Compare September 3, 2026 03:54
@reardencode
reardencode merged commit 878b847 into master Sep 3, 2026
13 checks passed
@rearden-grok
rearden-grok Bot deleted the ibd/most-work-tip-horizon branch September 4, 2026 15:09
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