fix(bitcoin-wallet-snap): repair drifted wallets with a one-time full rescan - #226
Open
jeremytsng wants to merge 2 commits into
Open
fix(bitcoin-wallet-snap): repair drifted wallets with a one-time full rescan#226jeremytsng wants to merge 2 commits into
jeremytsng wants to merge 2 commits into
Conversation
… rescan A full scan runs only once in an account's life, at creation, so a wallet whose funds landed outside the revealed set stays wrong forever. The first regular sync after this update schedules one full scan per existing account, gated by a rescanV1 state marker set after scheduling so a crash retries with duplicate scans instead of silently skipping the repair. Repair scans emit a Scan Discovered Missed Transactions tracking event for each transaction routine sync did not know about, which measures whether the coverage fixes hold in the field.
4 tasks
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.
Explanation
Last of three PRs splitting #201 per review feedback. Stacked on #225.
The wide address scan runs exactly once in an account's life — at creation. A wallet whose funds landed outside the revealed set before the reveal-at-sign fix (#225) stays wrong forever; nothing in the product re-searches. Two support cases (0.09 BTC and 6.9 BTC) sat in exactly that state until the users recovered manually.
This PR adds a one-time repair, deliberately not a recurring job:
FullScanAccountbackground events), then sets arescanV1state marker and never repeats. The scan uses the BIP44 gap from fix(bitcoin-wallet-snap): use BIP44 gap limit for full account scans #224.Scan Discovered Missed Transactionstracking event per transaction routine sync did not know about. This is the acceptance metric for the stack: its rate should go to zero. Creation-time scans do not emit it, so expected discovery never pollutes the signal.CronHandlerbecame one typed#finishSynchelper, removing aRecord<string, any>.Recurring coverage (periodic rescans, all-account sync) is out of scope pending an infra discussion on Esplora load: a recurring full scan costs roughly 40 requests per account per run across the fleet, and the drifted-wallet population is a one-time problem.
References
Checklist