Skip to content

Conversation

@xdustinface
Copy link
Collaborator

@xdustinface xdustinface commented Feb 9, 2026

On restart, start_download() unconditionally set checkpoint_start_height which caused process_cfheaders() to store previous_filter_header at an offset that already contained data, triggering a debug_assert panic in debug builds.

Only set checkpoint_start_height when filter storage is empty not when resuming from existing stored state.

Summary by CodeRabbit

  • Bug Fixes
    • Improved filter header checkpoint synchronization to prevent duplicate header re-insertion when resuming interrupted syncs, enhancing sync reliability.

On restart, `start_download()` unconditionally set `checkpoint_start_height`
which caused `process_cfheaders()` to store `previous_filter_header` at an
offset that already contained data, triggering a `debug_assert` panic.

Only set `checkpoint_start_height` when filter storage is empty not when resuming from existing stored state.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

📝 Walkthrough

Walkthrough

The filter headers manager's start-download path now only sets checkpoint_start_height when both conditions are met: no existing filter headers exist (filter_headers_tip == 0) and start_height is greater than 0. This change prevents potential re-insertion of the previous filter header upon checkpoint sync resume.

Changes

Cohort / File(s) Summary
Filter Headers Manager
dash-spv/src/sync/filter_headers/manager.rs
Modified start-download checkpoint logic to only set checkpoint_start_height when filter_headers_tip == 0 and start_height > 0, preventing unintended re-insertion on sync resume.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A filter header stands its ground,
No re-insertion shall be found,
When checkpoints fresh begin their quest,
We guard the state, we know what's best,
One small condition makes it right,
Preventing bugs in blockchain's light! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely describes the main fix: preventing re-insertion of a previous filter header when syncing resumes, which directly matches the changeset's core objective.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/filter-sync-prev-header

No actionable comments were generated in the recent review. 🎉


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants