From b7e73b295311fcfcff3e247bb4451fbf757cefb9 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 15 Jun 2026 22:14:54 -0700 Subject: Use cached state on reload; light poll instead of full re-scan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On load we restored the cache for instant display but then always ran a full scan (every address's /address + /utxo + /txs) — so a refresh re-fetched everything. Now when a cache exists, the load path runs the light frontier poll (only live addresses, no utxo/txs re-fetch) and escalates to a full scan only if something changed. A brand-new wallet still does a full scan, and the periodic deep scan still runs. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/app.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/app.js') diff --git a/src/app.js b/src/app.js index 5f1f412..789f12c 100644 --- a/src/app.js +++ b/src/app.js @@ -375,7 +375,7 @@ async function openWallet(mnemonic) { async function enterWallet(mnemonic, passphrase) { wallet.load({ mnemonic, passphrase, netName: 'mainnet', offline: false }); persistSession(mnemonic, passphrase); - wallet.restoreCache(); // show last-known balance/history instantly, if cached + const hadCache = wallet.restoreCache(); // show last-known balance/history instantly ui.screen = 'wallet'; ui.tab = 'receive'; ui.send = blankSend(); @@ -391,7 +391,10 @@ async function enterWallet(mnemonic, passphrase) { return; } try { - await wallet.scan(); + // With a cache, only check the live frontier (cheap) instead of a full + // re-scan; a full scan still runs for a brand-new wallet and periodically. + if (hadCache) await wallet.refreshLive(); + else await wallet.scan(); wallet.startRealtime(); } catch { enterOfflineFallback(); -- cgit v1.2.3