-
Notifications
You must be signed in to change notification settings - Fork 9
refactor: one storage type per file #395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Move out `FilterHeadersStorage` and `PersistentFilterHeadersStorage` into `storage/filters.rs` to have one storage type per file.
📝 WalkthroughWalkthroughRefactors storage architecture by extracting filter header persistence logic into a dedicated module. Moves Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@dash-spv/src/storage/filter_headers.rs`:
- Around line 10-34: get_filter_header currently constructs a range with height
+ 1 which can overflow for u32::MAX; change it to use height.checked_add(1) and
return Ok(None) if it returns None. Specifically, in the get_filter_header
method (which calls get_filter_tip_height, get_filter_start_height, and
load_filter_headers), replace the direct height + 1 usage with a checked_add(1)
call and early-return Ok(None) on None to avoid panic/wrap-around before calling
load_filter_headers(height..end). Ensure you still call load_filter_headers with
the computed end only when checked_add succeeds.
Move out
FilterHeadersStorageandPersistentFilterHeadersStorageintostorage/filters.rsto have one storage type per file.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.