diff options
| author | Adam Soltys <[email protected]> | 2026-09-10 07:33:05 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-09-10 07:33:05 -0700 |
| commit | 197ab88cec2f05b7ad45323b396a6e34b8b5edca (patch) | |
| tree | 8ac0d7ebf8fdc7017d884c125f57edde62bcc431 /src/electrum.js | |
| parent | f2de9b1330dfad5990f8e0ea6130b91096a60e54 (diff) | |
| download | coinosv3-197ab88cec2f05b7ad45323b396a6e34b8b5edca.tar.gz coinosv3-197ab88cec2f05b7ad45323b396a6e34b8b5edca.zip | |
Electrum source: answer txStatus, so the replaced/evicted-tx pruner actually prunes.
_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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Nw1Dijik1tLVKRM1WkU7xE
Diffstat (limited to 'src/electrum.js')
| -rw-r--r-- | src/electrum.js | 16 |
1 files changed, 16 insertions, 0 deletions
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) { |
