-
Notifications
You must be signed in to change notification settings - Fork 130
Description
Problem
BDK_CLIENT_STOP_GAP (20) and BDK_WALLET_SYNC_TIMEOUT_SECS (20s) are hardcoded constants in config.rs:
Line 61 in 63c7f9b
| pub(crate) const BDK_CLIENT_STOP_GAP: usize = 20; |
Line 36 in 63c7f9b
| const DEFAULT_LDK_WALLET_SYNC_TIMEOUT_SECS: u64 = 30; |
When a wallet has generated more than 20 consecutive unused addresses and needs to recover from keys_seed with a fresh database, BDK's full scan stops at the gap limit and fails to discover UTXOs at higher derivation indices. The funds appear lost even though they're on-chain and spendable.
What happened
Learned this once I already "lost funds". Could happen to anyone who simply spams the "generate address" button 20 times on a fully working wallet. Once he needs to recover from seed, funds won't show.
Proposal
Expose both values as configurable fields on the Config struct (or as Builder methods), with the current values as defaults.
This would allow wallet recovery without forking or patching the crate. The defaults remain conservative (20 / 30s) for normal operation, but operators/integrationrs can increase them or allow configuration for recovery scenarios.