Add FastSync scanning mode for rapid wallet balance recovery#101
Draft
Add FastSync scanning mode for rapid wallet balance recovery#101
Conversation
Co-authored-by: SWvheerden <2579813+SWvheerden@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for fast sync method in wallet
Add FastSync scanning mode for rapid wallet balance recovery
Mar 16, 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.
Normal wallet scanning must traverse every block from birthday to tip to build the UTXO set, which is slow for wallets with long history. This adds a three-phase
FastSyncmode that delivers an accurate current balance quickly, then fills in complete history as a second pass.Scan phases
tip - safety_buffer, then the recent blocks to tip. After this phase the balance is accurate.New
ScanMode::FastSyncCLI
Config
Key changes
scan/config.rs: NewScanMode::FastSync { safety_buffer: u64 }variant;DEFAULT_FAST_SYNC_SAFETY_BUFFER = 720scan/coordinator.rs:run_fast_sync()captures Phase 3 target data (account, key manager, birthday height) before Phase 1+2 consumes the targets, then reconstructs fresh targets for the history passdb/accounts.rs: AddedClonetoAccountRow(required to snapshot target metadata before consumingsync_targets)cli.rs/main.rs:--fast-sync/--fast-sync-safety-bufferflags;fast_sync_scan()helperconfig/defaults.rs:fast_sync_safety_buffer: Option<u64>inWalletConfig; CLI flag takes precedence over config, config over the compiled defaultOriginal prompt
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.