Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Electrum outpoint sync silently ignores transaction fetch errors

Abierto Apto para principiantes
#2,293 1 comentario 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 2 días

@chaitika ya está trabajando en esto.

Desde el 25/9/2026.

  • #2325 de @chaitika — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
88/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
rust
Área
backend

Línea de trabajo

Comienza en crates/electrum/src/bdk_electrum_client.rs:362-368 y compara el manejo de outpoints con populate_with_txids, que ya distingue los errores de protocolo de otros fallos de obtención. Ejecuta crates/electrum/tests/test_outpoint_fetch_errors.rs con cargo test -p bdk_electrum --test test_outpoint_fetch_errors. Está hecho cuando sync informa de los errores de red de los outpoints solicitados, mientras que las respuestas de transacción no encontrada siguen pudiéndose omitir.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug

Describe the bug

BdkElectrumClient::sync discards every error returned by fetch_tx while collecting the requested outpoints (crates/electrum/src/bdk_electrum_client.rs:362-368):

for op in outpoints {
    if let Ok(tx) = self.fetch_tx(op.txid) {

Only a "transaction not found" response (Error::Protocol) means there is nothing to sync for that outpoint. Connection, TLS and timeout errors are swallowed too, so the outpoint is skipped and sync reports success without any data for it. A spend of that outpoint is missed and the wallet keeps treating the UTXO as unspent until a later sync happens to succeed.

The txid path (populate_with_txids) treats the same situation differently: it skips only on Error::Protocol(_) and propagates every other error.

This issue was found by AI.

To Reproduce

Add crates/electrum/tests/test_outpoint_fetch_errors.rs and run cargo test -p bdk_electrum --test test_outpoint_fetch_errors. No Electrum server is needed:

use std::net::TcpListener;

use bdk_chain::bitcoin::{hashes::Hash, OutPoint, Txid};
use bdk_chain::spk_client::SyncRequest;
use bdk_electrum::electrum_client::{Client, ConfigBuilder};
use bdk_electrum::BdkElectrumClient;

#[test]
fn outpoint_sync_reports_connection_errors() {
    // A "server" that accepts the connection and immediately closes it.
    let listener = TcpListener::bind("127.0.0.1:0").unwrap();
    let url = format!("tcp://{}", listener.local_addr().unwrap());
    std::thread::spawn(move || listener.incoming().for_each(drop));

    let config = ConfigBuilder::new().retry(0).build();
    let client = BdkElectrumClient::new(Client::from_config(&url, config).unwrap());
    let outpoint = OutPoint::new(Txid::from_byte_array([1; 32]), 0);
    let request = SyncRequest::<()>::builder_at(0).outpoints([outpoint]);

    let response = client.sync(request, 1, false);
    assert!(response.is_err(), "sync dropped the outpoint and returned {response:?}");
}

The assertion fails with Ok(SyncResponse { tx_update: TxUpdate { txs: [], .. }, chain_update: None }). The same request built with .txids([outpoint.txid]) instead of .outpoints(..) returns Err(AllAttemptsErrored(..)).

Expected behavior

A sync that could not fetch the transaction of a requested outpoint because of a network error should not be reported as successful. The outpoint and txid paths should handle fetch errors consistently.

Lenguaje dominante
Rust
Estrellas
1.1k
Forks
516
Merge medio
7 d 10 h
PR fusionados (30 d)
10

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de bitcoindevkit/bdk

Todos los issues de bitcoindevkit/bdk

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.