Repository navigation
fix(scan): make payment checks awaitable and self-healing - #211
Open
theanmolsharma wants to merge 1 commit into
Open
theanmolsharma wants to merge 1 commit into
theanmolsharma wants to merge 1 commit into
Conversation
The Sync screen's "Check again" couldn't tell when a check ended or how it went: a check that found the wallet caught up returned without a word, and fetchTransactions only starts the scan. - checkForPayments() syncs the regular addresses and scans side by side, joining a scan already in flight, and settles once both have. It rejects when the scan fails. - A caught-up check counts as a successful one: it clears an error an earlier check left behind and starts polling, so a wallet already at the tip at launch watches for new blocks too. - Polling carries on after a failed check, backing off to every 5 minutes, so the error clears itself once the indexer is back. - The scan slot is freed before the spent check, so a tap right after "caught up" runs a real check, and an Electrum call that never answers can't wedge every later scan. - The home banner's Retry uses checkForPayments too. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of four stacked PRs that fix the Sync screen's "Check again" giving no feedback and the screen feeling janky. This one is the engine half. The screen itself is in the next PR.
Why "Check again" usually did nothing visible
performScanreturned 0 at its early returns, so the screen couldn't tell that anything had happened.fetchTransactions()only starts the scan. It awaits the Electrum sync and then fires the scan without awaiting it, so a caller can't know when a check ends or whether it failed.errorstuck. A later successful check that found no new block didn't clear it, so Retry couldn't either.activeScanPromisestayed set during the spent check, afteridlehad already been emitted, and Electrum calls have no timeout.What changes
checkForPayments()is added toHDSilentPaymentsWallet,IScannableWalletandisScannable.fetchBalance→fetchTransactions) and scans side by side. If a scan is already running, it joins it._utxo, which is also whyfetchUtxoisn't part of the check.fetchTransactions()stays fire-and-forget for pull-to-refresh, which holds a lock and gives up after 30 s.checkForPayments.Not in this PR
Two causes are already covered by open PRs, so they're left alone here:
fetchUtxorace that can drop silent-payment coins is fix: prevent SP UTXO loss during fetchUtxo #154 and fix: keep SP utxos out of the parent-owned _utxo array #173.Runtime version
JS only, so it ships over the air.
Testing
sp-scan-lifecycle.test.tswith 16 cases. All but one fail against master; the exception is the regression guard against re-emitting an unchanged state.Stack
🤖 Generated with Claude Code