fix(bitcoin-wallet-snap): use BIP44 gap limit for full account scans - #224
Open
jeremytsng wants to merge 3 commits into
Open
fix(bitcoin-wallet-snap): use BIP44 gap limit for full account scans#224jeremytsng wants to merge 3 commits into
jeremytsng wants to merge 3 commits into
Conversation
Split the chain stopGap config into { discovery: 5, scan: 20 }. Account
discovery keeps the cheap 5-address probe; a full scan of an account the
user owns walks until 20 consecutive empty addresses, the BIP44 gap
limit, so it cannot stop before funds parked deeper in the address
chain.
4 tasks
This was referenced Aug 27, 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.
Explanation
First of three PRs splitting #201 per review feedback. This one only splits the chain
stopGapconfiguration.stopGapserved two jobs with opposite cost profiles: probing many candidate accounts at boot (wants a cheap, small gap) and scanning an account the user owns (wants the BIP44 gap limit, because quitting early means missing the user's funds). The single value of 5 — a quarter of the BIP44 limit of 20 — meant a full scan could stop before reaching a coin parked behind 5 consecutive unused addresses.ChainConfig.stopGapbecomes{ discovery: 5, scan: 20 }.BlockchainClient.fullScangains amodeparameter, defaulting to'scan';discover()passes'discovery'.Note for reviewers: on its own this changes little in the field, because a full scan currently runs only at account creation. It becomes load-bearing with the follow-up PRs (reveal-at-sign, one-time repair rescan).
References
Checklist