diff options
| author | Adam Soltys <[email protected]> | 2026-06-15 22:14:54 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-06-15 22:14:54 -0700 |
| commit | b7e73b295311fcfcff3e247bb4451fbf757cefb9 (patch) | |
| tree | 7c6809ea725e9d21d6d1c9879d9e2238e16cc69b | |
| parent | 011d18f65ca7895260370bbc2d29b513705593e3 (diff) | |
| download | coinosv3-b7e73b295311fcfcff3e247bb4451fbf757cefb9.tar.gz coinosv3-b7e73b295311fcfcff3e247bb4451fbf757cefb9.zip | |
Use cached state on reload; light poll instead of full re-scan
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) <[email protected]>
| -rw-r--r-- | src/app.js | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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(); |
