Skip initial full scan for freshly generated wallets - #857
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| // perform that scanning in a background task | ||
| let addr = self.addr.clone(); | ||
| match initial_scan_route(completed_initial_scan) { | ||
| match initial_scan_route(completed_initial_scan, self.wallet_generated_in_app()) { |
There was a problem hiding this comment.
When a generated wallet completes its initial incremental scan, performed_full_scan_at remains unset, so the shared ledger state stays InitialScanIncomplete; this leaves the balance provisional and the UI loading or scanning indefinitely, while manager-level spend readiness can still reject the wallet.
Knowledge Base Used: Wallet Manager and Wallet State
| #[serde(default)] | ||
| /// True only for wallets whose key material was generated by Cove itself | ||
| /// (never imported/typed/scanned in). A freshly generated seed cannot have | ||
| /// on-chain history, so wallets marked here can skip the initial full scan. | ||
| /// | ||
| /// Must only be set at creation time by `WalletMetadata::new_cove_created_wallet`, | ||
| /// never inferred from other state (e.g. `discovery_state`). | ||
| pub generated_in_app: bool, |
There was a problem hiding this comment.
Freshness marker survives reconstruction
When a generated wallet is restored from backup or its BDK store is recreated during an address-type switch, generated_in_app remains true even though local scan state is cleared. Startup then uses the 30-address incremental gap instead of the initial 150-address full scan, omitting historical transactions, balance, or spendable outputs beyond that gap.
Knowledge Base Used: Wallet Manager and Wallet State
Greptile SummaryThe PR adds a persisted generated-wallet marker and uses it to bypass the initial full scan and actor-level spend guard.
Confidence Score: 2/5The PR should not merge until generated wallets can reach a consistent completed ledger state and restored or reconstructed wallets no longer reuse the fresh-creation scan bypass. Incremental completion never satisfies the existing performed_full_scan_at-based state model, while the persisted marker survives backup restoration and BDK-store recreation where the assumption of no history is no longer valid. Files Needing Attention: rust/src/manager/wallet_manager/actor.rs, rust/src/wallet/metadata.rs Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Create wallet in Cove] --> B[generated_in_app = true]
B --> C{Fresh local wallet?}
C -->|Initial creation| D[Incremental scan]
C -->|Backup restore or store recreation| E[Marker remains true]
E --> D
D --> F[performed_full_scan_at remains unset]
F --> G[Shared ledger state remains incomplete]
E --> H[Historical scan uses 30-address gap]
H --> I[History beyond gap may be omitted]
Reviews (1): Last reviewed commit: "Skip initial full scan for freshly gener..." | Re-trigger Greptile |
Summary
Generated (in-app) wallets no longer run the 150-address full scan — a new mnemonic can't have history. Added a generated_in_app marker set only at creation time; import paths (mnemonic, xpub, hardware, TapSigner) still get the full scan. #848
Testing
Added unit tests for routing + migration + spend-readiness. Full cargo test -p cove --lib suite passes.
Platform Coverage
Checklist