From f42f5c3697497e777fa613519ac3b7d13dc9b410 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 16 Jun 2026 00:30:52 -0700 Subject: Show pending txs in history with a clear unconfirmed indicator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WS-detected deposits now get added to history (previously the ingest advanced past the address so the tx never entered history — balance showed but History was empty). Pending txs render with a "⏳ pending" badge, an orange-tinted row, and "awaiting confirmation" so they're clearly distinct from confirmed ones. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/wallet.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/wallet.js') diff --git a/src/wallet.js b/src/wallet.js index f47d2f1..ba22af2 100644 --- a/src/wallet.js +++ b/src/wallet.js @@ -686,11 +686,14 @@ export class Wallet { let changed = false; const have = new Set(this.utxos.map(utxoId)); + const mine = new Set(this.addrMap.keys()); for (const tx of txs) { if (!tx || !Array.isArray(tx.vout)) continue; + let relevant = false; tx.vout.forEach((vo, i) => { const a = vo && vo.scriptpubkey_address; if (!a || !this.addrMap.has(a)) return; + relevant = true; const id = `${tx.txid}:${i}`; if (have.has(id)) return; const p = this.addrMap.get(a); @@ -710,11 +713,21 @@ export class Wallet { else entry.pending = (entry.pending || 0) + vo.value; changed = true; }); + for (const vin of tx.vin || []) { + const a = vin.prevout && vin.prevout.scriptpubkey_address; + if (a && mine.has(a)) relevant = true; + } + // Record it in history (so a pending deposit shows up there too). + if (relevant && !this.txs.some((t) => t.txid === tx.txid)) { + this.txs.push(this._txSummary(tx)); + changed = true; + } } if (changed) { this.nextReceiveIndex = firstUnused(this.receive); this.nextChangeIndex = firstUnused(this.change); this._recomputeBalanceFromChains(); + this._sortTxs(); this.retrack(); // start watching the new fresh address this.emit(); } -- cgit v1.2.3