From: Wei Chen Date: Wed, 6 Nov 2024 16:33:51 +0000 (+0800) Subject: fix(electrum): prevent `fetch_prev_txout` from querying coinbase transactions X-Git-Tag: v1.0.0-beta.6~4^2~1 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/primitives/decode/struct.SegwitCodeLengthError.html?a=commitdiff_plain;h=0944b352156fcd797a5c199a462ccaed3761db0a;p=bdk fix(electrum): prevent `fetch_prev_txout` from querying coinbase transactions \`fetch_prev_txout\` should not try to query the prevouts of coinbase transactions, as it may result in the Electrum server returning an error which would cause the overall `sync` to fail. --- diff --git a/crates/electrum/src/bdk_electrum_client.rs b/crates/electrum/src/bdk_electrum_client.rs index f9e53bff..eb1d43e3 100644 --- a/crates/electrum/src/bdk_electrum_client.rs +++ b/crates/electrum/src/bdk_electrum_client.rs @@ -422,7 +422,7 @@ impl BdkElectrumClient { ) -> Result<(), Error> { let mut no_dup = HashSet::::new(); for tx in &tx_update.txs { - if no_dup.insert(tx.compute_txid()) { + if !tx.is_coinbase() && no_dup.insert(tx.compute_txid()) { for vin in &tx.input { let outpoint = vin.previous_output; let vout = outpoint.vout;