From 125ffa8863e80d3b787ee7a48a8446859af219de Mon Sep 17 00:00:00 2001 From: DanS Date: Fri, 17 Jul 2026 00:58:42 -0500 Subject: [PATCH] feat(chat): dedicated ~2.5s poll for the 0-conf fast-scan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The fast-scan was hung on the page's Transactions timer, which is 10–15s on most pages (15s on Chat), so incoming messages still took up to ~15s to appear. Give it its own ~2.5s accumulator (delta-time based, independent of the page cadence) so messages land in a few seconds — network propagation then dominates, which is as fast as 0-conf gets. Still gated behind the warmup/rescan block and self-gated in fastScanChatMemos; the in-flight guard prevents overlapping RPCs. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/app.cpp | 10 ++++++++-- src/app.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/app.cpp b/src/app.cpp index 4230117..6e985a6 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -1168,8 +1168,14 @@ void App::update() } else if (walletDataPage && shouldRefreshRecentTransactions()) { refreshRecentTransactionData(); } - // 0-conf chat: the normal harvest above only re-scans on a new block, so also do a light - // mempool scan of the chat address every cycle to surface messages before confirmation. + } + // 0-conf chat: a DEDICATED ~2.5s mempool scan of the chat address, independent of the page's + // (slower, 10–15s) Transactions cadence — so incoming messages surface in a few seconds. The + // normal harvest only re-scans on a new block. Self-gated (no-op without a chat identity / + // connection / on lite); the in-flight guard keeps overlapping RPCs from stacking. + chat_fast_scan_accum_ += ImGui::GetIO().DeltaTime; + if (chat_fast_scan_accum_ >= 2.5f) { + chat_fast_scan_accum_ = 0.0f; fastScanChatMemos(); } if (network_refresh_.consumeDue(RefreshTimer::Addresses)) { diff --git a/src/app.h b/src/app.h index f597db3..1140383 100644 --- a/src/app.h +++ b/src/app.h @@ -735,6 +735,7 @@ private: // (they still un-hide via the normal confirmed harvest). Self-gated; no-op without a chat identity. void fastScanChatMemos(); bool chat_fast_scan_in_flight_ = false; // guard against overlapping fast-scan RPCs + float chat_fast_scan_accum_ = 0.0f; // seconds since the last fast-scan (dedicated ~2.5s poll) // Lite first-run welcome prompt: dismissed for the session once the user picks an action. bool lite_firstrun_dismissed_ = false; // Lite send-time unlock: set to show the unlock modal when a spend is attempted while locked.