chainntnfs: retry failed historical rescans in the backends
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 62/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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/UpdateSpendDetailsis 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
RescanAsyncspends, 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.
- Dominant language
- Go
- Stars
- 8.2k
- Forks
- 2.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 103
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lightningnetwork/lnd
-
funding: failure logs print `<nil>` error and zero channel IDPossibly taken @litbot-9000 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
lightningnetwork/lnd#11676 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 Half a day Newbie friendliness 85/100
lightningnetwork/lnd#11674 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
lightningnetwork/lnd#11672 ·
Maintainers usually reply within 1 day
-
test flake
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
lightningnetwork/lnd#11663 · 1 comment ·
Maintainers usually reply within 1 day
-
[flake]: lnwallet/test/bitcoind.TestLightningWalletBitcoindRPCPolling/spend_unconfirmed_outputsOpentest flake
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
lightningnetwork/lnd#11642 · 1 comment ·
Maintainers usually reply within 1 day
All issues in lightningnetwork/lnd
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
containers/gvisor-tap-vsock#796 ·
Maintainers usually reply within 2 days
-
external needs:triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
celestiaorg/celestia-node#5448 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day
-
[Bug]: Azure SAS signing uses local time instead of UTC, shifting validity window on non-UTC hostsPossibly taken @huanghaoyuanhhy claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
zilliztech/milvus-backup#1418 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
projectdiscovery/nuclei#8423 ·
Maintainers usually reply within 1 day