Repository navigation
Conversation
This was referenced Oct 26, 2026
fix(stellar): run account reads under the fetch policy and report stale balances as unavailable
#525
Closed
… scan - FullScanQueue: persistent per-account full-scan queue (reuses the rescanV1 state) with backoff 30 s..5 min; a failing account rotates to the tail, so neither new accounts nor the repair migration are blocked by a stuck one; never-synced accounts are re-queued - the balance is treated as unknown (isBalanceUnknown) until the first full scan succeeds; BitcoinAccount.hasSynchronized() tells a never-synced wallet (genesis checkpoint) apart - one scan per account: single-flight full scans, discovery scans reused for account creation (10 min TTL), at most 2 immediate scans on create; a reused discovery scan (discovery gap) that found activity is followed by a standard-gap scan - a balance request on an unknown account (the wallet's Retry) requests an on-demand full scan (30 s..2 min backoff) - the first successful sync after a failed scan requests a recovery scan within 5 s
rvelaz
force-pushed
the
fix/stale-balances-03-btc-scan-reliability
branch
from
October 28, 2026 10:27
d0acea0 to
679210f
Compare
rvelaz
changed the base branch from
fix/stale-balances-02-btc-requests
to
main
October 28, 2026 10:27
Resolve CronHandler conflicts: keep #543 publish-before-repair flow and rescanV1 repair; retain PR full-scan queue reliability after regular sync. Adapt createMany to main repository API; migrate affected tests to Vitest. Co-authored-by: Raul Velaz <rvelaz@users.noreply.github.com>
Co-authored-by: Raul Velaz <rvelaz@users.noreply.github.com>
Co-authored-by: Raul Velaz <rvelaz@users.noreply.github.com>
Co-authored-by: Raul Velaz <rvelaz@users.noreply.github.com>
Co-authored-by: Raul Velaz <rvelaz@users.noreply.github.com>
|
This branch has not been deployed
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.



@metamask/bitcoin-wallet-snapExplanation
Bug
After a failed first full scan, BTC can stay “Balance unavailable” long after the network recovers. Retry does not start a new scan; cron may not retry the initial scan promptly.
How to reproduce
Expected: Retry triggers a real scan; first heal retries within seconds.
Actual on
main(with #519 only): Retry re-reads local state; recovery can take minutes.Without a browser:
AccountUseCases.test.tsfirst-heal / full-scan queue cases.Summary
Persistent full-scan queue with backoff; one scan per account; onboarding avoids duplicate discovery+full scans; balance requests on unknown accounts trigger scans.
Why
Generic upstream failures (timeouts, 5xx, rate limits) abort the first full scan. On
main, failed initial scans were not reliably retried, Retry was a no-op, and repair migration could block behind a stuck account.Relation to #543 (merged 3 Nov 2026): #543 fixes stale balances when repair scans blocked publishing updates (
CronHandlerpublishes sync results before#repairNextAccount). This PR targets never-synced accounts and explicit Retry—not duplicated. Merge kept #543 publish-before-repair; dropped any pre-sync queue path that fought that ordering.Validation
yarn workspace @metamask/bitcoin-wallet-snap test: 794 passed, 2026-11-09 (ac0b4430).Changelog
Unreleased → Fixed: retry first full scan; Retry triggers scan (#521).