From 197ab88cec2f05b7ad45323b396a6e34b8b5edca Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 10 Sep 2026 07:33:05 -0700 Subject: Electrum source: answer txStatus, so the replaced/evicted-tx pruner actually prunes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _pruneReplaced only drops a pending row on a definitive "not found", and the Electrum adapter had no txStatus at all — the call threw, the catch said "transient", and nothing was ever pruned on the default data source. A 5,000-sat send the network never accepted sat in History as a pending withdrawal for four days (and the cross-device union kept it fed). Fulcrum's verbose transaction.get answers both halves: bitcoind's "No such mempool or blockchain transaction" is the definitive miss (→ null), a blockhash means confirmed. Other failures still throw. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01Nw1Dijik1tLVKRM1WkU7xE --- src/electrum.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/electrum.js b/src/electrum.js index dc3c1c9..64cc514 100644 --- a/src/electrum.js +++ b/src/electrum.js @@ -194,6 +194,22 @@ export class ElectrumApi { return this._esploraTx(txid, height); } + // A definitive answer for the replaced/evicted-tx pruner: null when neither + // the mempool nor the chain knows the txid (Fulcrum relays bitcoind's "No + // such mempool or blockchain transaction"), else an esplora-shaped status. + // Anything else (timeout, socket churn) throws, so a flaky link never + // prunes. Without this method the pruner silently skipped every tx on the + // Electrum source, and a never-broadcast send haunted History for days. + async txStatus(txid) { + let v; + try { v = await this.call('blockchain.transaction.get', [txid, true]); } catch (e) { + if (/no such mempool or blockchain transaction/i.test(String((e && e.message) || e))) return null; + throw e; + } + const confirmed = !!(v && v.blockhash); + return confirmed ? { confirmed: true, block_time: v.blocktime || 0 } : { confirmed: false }; + } + // Is output (txid:vout) spent? (used to detect an already-claimed gift). Scan // the output address's history for a tx that spends this exact outpoint. async outspend(txid, vout) { -- cgit v1.2.3