chainntnfs: retry failed historical rescans in the backends

Aperta
#11,234 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
62/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
backend

Direzione di ricerca

Start in the chainntnfs package to understand how request sets track in-flight scans after #11183, then read the three backends named in the issue: bitcoindnotify/bitcoind.go, btcdnotify/btcd.go, neutrinonotify/neutrino.go, focusing on where historical conf/spend rescans fail and the TODO(wilmer) retry markers. Done means every failure path eventually calls UpdateConfDetails or UpdateSpendDetails (with backoff until notifier quit), non-retryable errors like pruned blocks are logged without spinning, and TestTxNotifierAsyncModelProperty's FailScan action drops the liveness carve-out and passes.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

When a historical conf or spend rescan fails, all three chain notifier backends log the error and return without ever reporting back to the TxNotifier (bitcoindnotify/bitcoind.go, btcdnotify/btcd.go, neutrinonotify/neutrino.go, several of which still carry a TODO(wilmer): add retry logic if rescan fails?). Neutrino's GetUtxo path does the same for spends, and bitcoind's outpoint spend path returns early when the funding tx is found but unconfirmed.

Since #11183, a request set counts its in-flight scans, so a scan that never reports keeps the set in rescanPending for the life of the process. That's fail safe: the hint can't advance past the range that was never verified, and since the persisted hint's origin sits above that range, the next restart scans it again. Details found by any other scan, or at tip, are still dispatched. What we lose is the event itself for this run: a subscriber whose confirmation or spend only lies in the failed range won't be notified until lnd restarts.

In this issue, we want the backends to retry failed historical scans rather than dropping them. Roughly:

  • Retry the scan with backoff until it succeeds or the notifier quits, so UpdateConfDetails / UpdateSpendDetails is always eventually called and the pending count always unwinds.
  • Distinguish errors that won't resolve on retry (e.g. a pruned block bitcoind can't fetch) from transient RPC or peer errors, and log loudly for the former instead of spinning.
  • Cover the early-return paths that never report at all (bitcoind's unconfirmed funding tx case, btcd's RescanAsync spends, Neutrino's script spend rewind), since those also leave a pending scan behind.

The async state machine model added in #11183 (TestTxNotifierAsyncModelProperty) already has a FailScan action. Once retries exist, the model can treat a failed scan as delayed instead of lost, and drop the carve-out in its liveness check for requests with a failed scan.

Lingua principale
Go
Stelle
8.2k
Fork
2.3k
Merge medio
1g 11h
PR unite (30g)
103

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di lightningnetwork/lnd

Tutte le issue di lightningnetwork/lnd

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.