From: chaitika Date: Sat, 26 Sep 2026 15:17:00 +0000 (+0530) Subject: fix(electrum): propagate transport errors when syncing outpoints X-Git-Url: http://internal-gitweb-vhost/-script/src/consensus/encode/scripts/-script-interface/FromScriptException.UnrecognizedScript.html?a=commitdiff_plain;h=84b0acf323e2f95919f39a3c3102925ce64174dd;p=bdk fix(electrum): propagate transport errors when syncing outpoints `populate_with_outpoints` discarded every error returned by `fetch_tx`, so a connection, TLS or timeout failure made `sync` report success without any data for the requested outpoint. A spend of that outpoint was then missed and the UTXO kept being treated as unspent. Skip the outpoint only on `Error::Protocol` and propagate all other errors, matching `populate_with_txids`. --- diff --git a/crates/electrum/src/bdk_electrum_client.rs b/crates/electrum/src/bdk_electrum_client.rs index a7c94315..ba1f1043 100644 --- a/crates/electrum/src/bdk_electrum_client.rs +++ b/crates/electrum/src/bdk_electrum_client.rs @@ -360,10 +360,13 @@ impl BdkElectrumClient { // Collect valid outpoints with their corresponding `spk` and `tx`. let mut ops_spks_txs = Vec::new(); for op in outpoints { - if let Ok(tx) = self.fetch_tx(op.txid) { - if let Some(txout) = tx.output.get(op.vout as usize) { - ops_spks_txs.push((op, txout.script_pubkey.clone(), tx)); - } + let tx = match self.fetch_tx(op.txid) { + Ok(tx) => tx, + Err(electrum_client::Error::Protocol(_)) => continue, + Err(e) => return Err(e), + }; + if let Some(txout) = tx.output.get(op.vout as usize) { + ops_spks_txs.push((op, txout.script_pubkey.clone(), tx)); } }