From 401bdfd52b17622474dbe68bbbb7f673101253cf Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 15 Jun 2026 23:31:44 -0700 Subject: Watch only the fresh receive + change address over the WS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- src/wallet.js | 16 +++++++++------- 1 file 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() { -- cgit v1.2.3