fix(dash-spv): prevent filter sync crash on new block after full sync#816
Conversation
When a wallet boots already fully synced, `start_download` takes its early return before assigning `processing_height`, leaving it at the initial 0. The next block that extends the chain then drives `try_create_lookahead_batches`, which falls back to `processing_height` when no batches are active and creates a lookahead batch starting at height 0. Loading filters from height 0, which were never stored under checkpoint sync, reads an empty leading segment and panics in `SegmentCache::get_items` (debug) or returns sentinel filters as real data (release). Set `processing_height` to the computed `scan_start` before the early-return check so the scan frontier is recorded on every path. The genesis case (`committed_height == 0`) keeps starting at the wallet birth height because `scan_start` already encodes that distinction.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
Changesprocessing_height early-return fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #816 +/- ##
==========================================
+ Coverage 72.82% 73.01% +0.18%
==========================================
Files 323 323
Lines 72000 72021 +21
==========================================
+ Hits 52432 52583 +151
+ Misses 19568 19438 -130
|
When a wallet boots already fully synced,
start_downloadtakes its early return before assigningprocessing_height, leaving it at the initial 0. The next block that extends the chain then drivestry_create_lookahead_batches, which falls back toprocessing_heightwhen no batches are active and creates a lookahead batch starting at height 0. Loading filters from height 0, which were never stored under checkpoint sync, reads an empty leading segment and panics inSegmentCache::get_items(debug) or returns sentinel filters as real data (release).Set
processing_heightto the computedscan_startbefore the early-return check so the scan frontier is recorded on every path. The genesis case (committed_height == 0) keeps starting at the wallet birth height becausescan_startalready encodes that distinction.Summary by CodeRabbit
Bug Fixes
Tests