diff options
| author | Adam Soltys <[email protected]> | 2026-06-15 23:31:44 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-06-15 23:31:44 -0700 |
| commit | 401bdfd52b17622474dbe68bbbb7f673101253cf (patch) | |
| tree | 0e14725ea7cafd6f6b2b42eeee5541df31696474 /src | |
| parent | 60db237749a1189d57b8783cd318c60d6df0cbcc (diff) | |
| download | coinosv3-401bdfd52b17622474dbe68bbbb7f673101253cf.tar.gz coinosv3-401bdfd52b17622474dbe68bbbb7f673101253cf.zip | |
Watch only the fresh receive + change address over the WS
mempool's track-addresses caps at 10 per connection; we were sending all coin
addresses + a 15-wide frontier, so the subscription was rejected and realtime
updates silently stopped. With the frontier model (coins handled by post-send
refresh + Nostr sync), only the next receive and change address need watching
— so track exactly those two.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Diffstat (limited to 'src')
| -rw-r--r-- | src/wallet.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/wallet.js b/src/wallet.js index 4e1a43c..848078d 100644 --- a/src/wallet.js +++ b/src/wallet.js @@ -496,14 +496,16 @@ export class Wallet { return wsUrl(this.netName); } - // Addresses worth watching: those holding coins (to catch spends) plus a - // window of upcoming fresh receive/change addresses (to catch deposits). + // Only the fresh frontier needs realtime watching: the next receive address + // (incoming deposits) and the next change address (our change landing). Coin + // spends are handled by the post-send refresh and cross-device Nostr sync, so + // we don't track coin addresses — which also stays under the relay's 10-addr + // per-connection limit. watchedAddresses() { - const set = new Set(); - for (const u of this.utxos) set.add(u.address); - for (let i = 0; i < 10; i++) set.add(this.derive(0, this.nextReceiveIndex + i).address); - for (let i = 0; i < 5; i++) set.add(this.derive(1, this.nextChangeIndex + i).address); - return [...set]; + return [ + this.derive(0, this.nextReceiveIndex).address, + this.derive(1, this.nextChangeIndex).address, + ]; } startRealtime() { |
