From 2d29a0498180d019630473ed7fe378c28fa1b533 Mon Sep 17 00:00:00 2001 From: DanS Date: Sat, 3 Oct 2026 19:52:09 -0500 Subject: [PATCH] perf(ui): stop forcing full wallet re-scans on restore and peers refresh Restoring or un-maximizing the window called refreshNow(), which wipes the history-scan progress and re-scans every z-address (a z_listreceivedbyaddress per address, each holding cs_main). The Peers tab's refresh button did the same, and holding F5 auto-repeated it. - Window restore no longer forces a refresh; the regular timers catch up (skipping the daemon-output backlog stays). - The Peers refresh button refreshes peers only. - F5 ignores key repeat. An explicit F5 or History refresh still does the full re-scan. Co-Authored-By: Claude Opus 5.5 --- src/app.cpp | 4 ++-- src/main.cpp | 8 ++++---- src/ui/windows/peers_tab.cpp | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/app.cpp b/src/app.cpp index f2ecb66..ed495ea 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -1515,8 +1515,8 @@ void App::handleGlobalShortcuts() } } - // Keyboard shortcut: F5 to refresh - if (ImGui::IsKeyPressed(ImGuiKey_F5)) { + // Keyboard shortcut: F5 to refresh (no key repeat: each refresh is a full wallet re-scan) + if (ImGui::IsKeyPressed(ImGuiKey_F5, false)) { refreshNow(); } diff --git a/src/main.cpp b/src/main.cpp index e3fdb7c..d8f313a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1705,11 +1705,12 @@ int main(int argc, char* argv[]) lastKnownH = waitEvent.window.data2; } } - // Window restored from minimized — trigger immediate data refresh + // Window restored. No forced refresh: update() keeps running while minimized, so the data + // is current, and refreshNow() wiped the shielded-scan progress and re-scanned every + // z-address (SDL also sends RESTORED on un-maximize, so a title-bar double-click did it). if (waitEvent.type == SDL_EVENT_WINDOW_RESTORED && waitEvent.window.windowID == SDL_GetWindowID(window)) { app.skipDaemonOutputBacklog(); // drop the minimized-period backlog (avoids a spurious "rescan complete" toast) - app.refreshNow(); } // Handle DPI change that arrived while idle (same logic as poll loop) if (waitEvent.type == SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED && @@ -1852,11 +1853,10 @@ int main(int argc, char* argv[]) } } } - // Window restored from minimized — trigger immediate data refresh + // Window restored: no forced refresh (see the wait branch above). if (event.type == SDL_EVENT_WINDOW_RESTORED && event.window.windowID == SDL_GetWindowID(window)) { app.skipDaemonOutputBacklog(); // drop the minimized-period backlog (avoids a spurious "rescan complete" toast) - app.refreshNow(); } // Handle DPI/display scale changes (e.g. window dragged to a // different-DPI monitor, or user changes Windows scaling) diff --git a/src/ui/windows/peers_tab.cpp b/src/ui/windows/peers_tab.cpp index ac06880..32cf0f3 100644 --- a/src/ui/windows/peers_tab.cpp +++ b/src/ui/windows/peers_tab.cpp @@ -587,8 +587,9 @@ void RenderPeersTab(App* app) ImGui::PushID("##peersRefresh"); if (ImGui::InvisibleButton("##btn", ImVec2(btnW, btnH))) { if (!isRefreshing) { + // Peers only: refreshNow() also forced a full wallet re-scan (every z-address) + // for a button that says "Refresh peer list". app->refreshPeerInfo(); - app->refreshNow(); } } if (ImGui::IsItemHovered()) {