fix(ui): stop spurious "Blockchain rescan complete" toast after restoring from minimize

While minimized the main loop skips the frame body (SDL_Delay+continue), so App::update() —
which drains the daemon output via outputSince(daemon_output_offset_) — never runs and the
offset isn't advanced. On restore the whole accumulated backlog is parsed in one batch: a
background witness rebuild's progress lines (parsed as a rescan → state_.sync.rescanning=true)
AND its "rebuilt … in Xms" completion (parsed as finished) arrive together and fire
"Blockchain rescan complete" for a scan the user never initiated.

On WINDOW_RESTORED, discard the daemon-output backlog (advance the offset to the current end,
via App::skipDaemonOutputBacklog) before the resumed update parses it — so only new output is
parsed. Genuine user-initiated rescans still surface completion via the getrescaninfo monitor.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-01 00:49:06 -05:00
co-authored by Claude Opus 4.8
parent f7df315695
commit a3892c0fd3
3 changed files with 49 additions and 0 deletions
+12
View File
@@ -5047,6 +5047,18 @@ void App::refreshNow()
invalidateShieldedHistoryScanProgress(true);
}
void App::skipDaemonOutputBacklog()
{
// While minimized, App::update() is paused, so daemon_output_offset_ is never advanced and a large
// backlog of daemon output piles up. Parsing it all at once on restore would replay a background
// witness rebuild's progress + completion in a single batch and fire a spurious "Blockchain rescan
// complete" toast. Advance the offset to the current end so only NEW (post-restore) output is parsed.
// A genuine user-initiated rescan still surfaces completion via the getrescaninfo monitor.
if (daemon_controller_ && daemon_controller_->isRunning()) {
(void)daemon_controller_->outputSince(daemon_output_offset_); // advances daemon_output_offset_ to the end
}
}
void App::handlePaymentURI(const std::string& uri)
{
auto payment = util::parsePaymentURI(uri);