feat(key-wallet): seed sync checkpoint from birth_height#693
feat(key-wallet): seed sync checkpoint from birth_height#693xdustinface wants to merge 4 commits intorefactor/birth-height-constructionfrom
birth_height#693Conversation
Move committed sync height into wallet metadata and expose it through `WalletInfoInterface` so `WalletManager` no longer relies on global cached heights. Compute manager-level synced_height and tip_height as the minimum across wallet infos, propagate committed sync updates per wallet, and keep tip_height as per-wallet applied chain state. Update tests and example messaging to match the new aggregation semantics.
`WalletInfoInterface::from_wallet` and `from_wallet_with_name` (plus the inherent `ManagedWalletInfo` constructors) now take `birth_height: CoreBlockHeight` and seed both checkpoint heights (`synced_height`, `last_processed_height`) to `birth_height.saturating_sub(1)` so the next block to scan is always `birth_height`. Without this, every wallet-add path had to remember `set_birth_height` after construction. Forgetting it left the checkpoints at `0`, dragging `WalletManager::synced_height` (a min across wallets) back to genesis on every add. Moving the seed into construction makes the invariant a property of the type. `ManagedWalletInfo::with_birth_height` is removed. It set only `birth_height` and had no callers.
Move sync checkpoint seeding into `ManagedWalletInfo` construction so it can't be forgotten, and let callers control the scan range when importing. - `WalletInfoInterface::from_wallet` now takes `birth_height` and seeds `synced_height` and `last_processed_height` to `birth_height.saturating_sub(1)`. Previously every wallet-add path had to remember to call `set_birth_height` separately, and forgetting it dragged `WalletManager::synced_height` (a min across wallets) back to genesis on every add. - `WalletManager::import_wallet_from_extended_priv_key`, `import_wallet_from_xpub`, and `import_wallet_from_bytes` (plus the matching FFI) gain a `birth_height` parameter so previously-used keys can rescan from a chosen height instead of being silently anchored at the chain tip. - Unused `ManagedWalletInfo::with_birth_height` removed.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 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 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## refactor/birth-height-construction #693 +/- ##
======================================================================
- Coverage 70.09% 70.08% -0.02%
======================================================================
Files 319 319
Lines 66770 66771 +1
======================================================================
- Hits 46803 46797 -6
- Misses 19967 19974 +7
|
973115f to
5ee6537
Compare
|
This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them. |
5ee6537 to
0a49ef4
Compare
WalletManager::import_wallet_from_extended_priv_key,import_wallet_from_xpub, andimport_wallet_from_bytes(plus the matching FFI) gain abirth_heightparameter so previously-used keys can rescan from a chosen height instead of being silently anchored at the chain tip.Based on:
birth_heightinManagedWalletInfoctors #692