diff options
| author | Adam Soltys <[email protected]> | 2026-07-05 18:07:14 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-07-05 18:07:14 -0700 |
| commit | 89a87b6b7866240a9289aefb3975a607d61bf371 (patch) | |
| tree | 2a8c4af701de63fcc631e7dc28f364b3675fbd40 /src/features/sync.js | |
| parent | 191f6f757c596cf974ba4ee63967cdf19389fd58 (diff) | |
| download | coinosv3-89a87b6b7866240a9289aefb3975a607d61bf371.tar.gz coinosv3-89a87b6b7866240a9289aefb3975a607d61bf371.zip | |
Never apply legacy netName-less nostr snapshots
A pre-per-network-dtag event can hold ANY network's state; applying one
put regtest coins into a mainnet wallet (and its board tx was then
rightly rejected by the network). Unstamped snapshots are now skipped —
a full scan is safer than a wrong snapshot.
Co-Authored-By: Claude Fable 5 <[email protected]>
Diffstat (limited to 'src/features/sync.js')
| -rw-r--r-- | src/features/sync.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/features/sync.js b/src/features/sync.js index 41d772e..f927aef 100644 --- a/src/features/sync.js +++ b/src/features/sync.js @@ -36,9 +36,12 @@ export function installSyncWallet(wallet) { return false; } if (!remote) return false; - // A snapshot for another network must never apply here (events published - // before per-network d-tags all live under the mainnet tag). - if (remote.netName && remote.netName !== this.netName) return false; + // A snapshot for another network must never apply here. Legacy events + // (published before snapshots carried netName) are ambiguous — they can + // hold ANY network's state under the shared d-tag, and applying one + // poisoned a mainnet wallet with regtest coins — so they are never + // applied either; a full scan is safer than a wrong snapshot. + if (remote.netName !== this.netName) return false; if ((remote.savedAt || 0) > (this._savedAt || 0)) { this._applySnapshot(remote); this.saveCache(); // mirror into localStorage |
