Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (7)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change propagates buffered chainlock heights to wallets, enables observed-spend pruning before chainlock application, and prevents reprocessed spent outputs from returning to the UTXO set. Tests cover both behaviors. ChangesChainlock-aware wallet pruning
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The available evidence identifies no confirmed behavior that would block merging. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Warning Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use 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 @@
## dev #1014 +/- ##
==========================================
- Coverage 77.20% 77.19% -0.02%
==========================================
Files 329 329
Lines 83862 83880 +18
==========================================
Hits 64747 64747
- Misses 19115 19133 +18
|
`observed_spent_outpoints` records every input of every transaction in every block the wallet processes, false positives included, and is pruned only up to a chainlock the wallet has applied. The client defers chainlocks until `SyncComplete`, so nothing is pruned during an initial sync. On a mainnet restore of the bench wallet the map reached 1 487 967 entries (every input of 10 295 blocks, 505 946 transactions), above the 1 000 000 entries the serde adapter accepts on load, so a wallet persisted mid-sync could not be loaded back. The dispatcher still defers applying chainlocks, but now passes the deferred chainlock's height on through `note_chain_lock_height`. The wallet uses it only as a finality boundary for pruning: entries at or below min(synced_height, highest chainlock applied or noted) are evicted. As before, only chain-locked spends are forgotten, and no record is promoted. Pruning mid-sync opened one path: redelivering a funding transaction whose output sits in `spent_before_funded`, after its observed-spend entry was evicted, re-inserted the spent coin into `utxos`. `update_utxos` now keeps such an output held; the new test fails without that guard. Validated with 5 consecutive mainnet restores at 100 Mbit / 100 ms, all ending at 7112 records, 14 114 383 sat and 13 389 addresses. Peak RSS was 1378–1724 MiB against 1488 MiB before, within run-to-run spread. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017DruChNTWXwJoWPartZwCf
026fba0 to
3a427a4
Compare
|
Ready for review — needs QuantumExplorer or xdustinface. |
|
/self-reviewed |
observed_spent_outpointsrecords every input of every transaction in every block the wallet processes, false positives included, and is pruned only up to a chainlock the wallet has applied. The client defers chainlocks untilSyncComplete, so nothing is pruned during an initial sync. On a mainnet restore of the bench wallet the map reached 1 487 967 entries (every input of 10 295 blocks, 505 946 transactions), above the 1 000 000 entries the serde adapter accepts on load, so a wallet persisted mid-sync could not be loaded back.The dispatcher still defers applying chainlocks, but now passes the deferred chainlock's height on through
note_chain_lock_height. The wallet uses it only as a finality boundary for pruning: entries at or below min(synced_height, highest chainlock applied or noted) are evicted. As before, only chain-locked spends are forgotten, and no record is promoted.Pruning mid-sync opened one path: redelivering a funding transaction whose output sits in
spent_before_funded, after its observed-spend entry was evicted, re-inserted the spent coin intoutxos.update_utxosnow keeps such an output held; the new test fails without that guard.Validated with 5 consecutive mainnet restores at 100 Mbit / 100 ms
Closes #899
Summary by CodeRabbit
Bug Fixes
Tests
PR Hygiene ·
3a427a4dash-spv(dash-spv/src/client/event_handler.rs) — QuantumExplorer or xdustinfacekey-wallet-manager(key-wallet-manager/src/process_block.rs,key-wallet-manager/src/wallet_interface.rs) — QuantumExplorer or xdustinfacekey-wallet(key-wallet/src/managed_account/managed_core_funds_account.rs,key-wallet/src/tests/observed_spent_outpoints_tests.rs,key-wallet/src/wallet/managed_wallet_info/mod.rsand 1 more) — QuantumExplorer or xdustinfaceWhen every box is checked the
PR Hygienecheck passes and this can merge.