aboutsummaryrefslogtreecommitdiffstats
path: root/src/wallet.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-17 14:44:26 -0700
committerAdam Soltys <[email protected]>2026-08-17 14:44:26 -0700
commit00a0be5fcd8157f145c63df44982b4f74960c815 (patch)
tree8a1bf48d3f36c907a162fa592c085681f33a6c28 /src/wallet.js
parenta2ff81a9389e2301255f3d1c6362e596d9def4ea (diff)
downloadcoinosv3-00a0be5fcd8157f145c63df44982b4f74960c815.tar.gz
coinosv3-00a0be5fcd8157f145c63df44982b4f74960c815.zip
A snapshot only counts on its own network: the seed-keyed cache stops showing mainnet money under a mutinynet flag, and staging forgives the mainnet default it stamped before it knew better
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JtaatFfAbx91Nh3xqKVqKz
Diffstat (limited to 'src/wallet.js')
-rw-r--r--src/wallet.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/wallet.js b/src/wallet.js
index cdae1ff..cce0a45 100644
--- a/src/wallet.js
+++ b/src/wallet.js
@@ -1871,7 +1871,12 @@ export class Wallet {
// cache yet — fall back to the xpub mirror so it shows instantly.
if (!raw && !this.watchOnly) raw = localStorage.getItem(this._xpubCacheKey());
if (!raw) return false;
- this._applySnapshot(JSON.parse(raw));
+ const snap = JSON.parse(raw);
+ // The seed-keyed cache slot is shared across networks (the key hashes
+ // only the seed), so a wallet switched to mutinynet would restore — and
+ // show — its mainnet balance. A snapshot only counts on its own network.
+ if (snap.netName && snap.netName !== this.netName) return false;
+ this._applySnapshot(snap);
this.emit();
return true;
} catch {