Skip to content

bugfix: truncate header sync percentage#935

Open
arejula27 wants to merge 1 commit intobitcoin-core:masterfrom
arejula27:gui-ibd-fix-header-sync-percentage
Open

bugfix: truncate header sync percentage#935
arejula27 wants to merge 1 commit intobitcoin-core:masterfrom
arejula27:gui-ibd-fix-header-sync-percentage

Conversation

@arejula27
Copy link
Copy Markdown

During IBD, if LoadingBlocks() is true (e.g. during a chainstate rebuild after a crash), the node rejects incoming headers from peers. The GUI has headers loaded from the block index on disk, but bestHeaderDate becomes stale over time.

After ~4 hours (HEADER_HEIGHT_DELTA_SYNC * nPowTargetSpacing), the time-based heuristic in modaloverlay.cpp considers headers as "not synced" and falls into the else branch, displaying "Unknown" for both blocks remaining and estimated time. Meanwhile, UpdateHeaderSyncLabel() computes a percentage that rounds up to 100.0%, creating a contradictory display: "Unknown. Syncing Headers (942188, 100.0%)". Please read issue #65 for more context.

This patch truncates the percentage to one decimal place instead of rounding, so it only shows 100.0% when headers are truly up to date. The same fix is applied to
UpdateHeaderPresyncLabel() for consistency.

Fixes #65 .

@DrahtBot
Copy link
Copy Markdown
Contributor

DrahtBot commented Mar 28, 2026

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

LLM Linter (✨ experimental)

Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):

  • QString::number(pct, 'f', 1) in src/qt/modaloverlay.cpp (ModalOverlay::UpdateHeaderSyncLabel)
  • QString::number(pct, 'f', 1) in src/qt/modaloverlay.cpp (ModalOverlay::UpdateHeaderPresyncLabel)

2026-03-28 12:54:29

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.

GUI misses some header updates when in IBD

2 participants