feat(wallet): add RestoreOptions to tune Wallet::restore batching#1923
Open
Forte11Cuba wants to merge 2 commits into
Open
feat(wallet): add RestoreOptions to tune Wallet::restore batching#1923Forte11Cuba wants to merge 2 commits into
Forte11Cuba wants to merge 2 commits into
Conversation
thesimplekid
requested changes
Apr 22, 2026
Collaborator
thesimplekid
left a comment
There was a problem hiding this comment.
Think this is a useful addition just a few comments.
Comment on lines
+315
to
+320
| /// | ||
| /// Degenerate configurations (`batch_size == 0` and/or `max_gap == 0`) do | ||
| /// not panic but produce a scan that terminates without recovering proofs: | ||
| /// `max_gap == 0` skips the scan entirely, and `batch_size == 0` sends | ||
| /// empty requests until `max_gap` is reached. Both are configuration | ||
| /// errors; callers should use `Default` or positive values. |
Collaborator
There was a problem hiding this comment.
Suggested change
| /// | |
| /// Degenerate configurations (`batch_size == 0` and/or `max_gap == 0`) do | |
| /// not panic but produce a scan that terminates without recovering proofs: | |
| /// `max_gap == 0` skips the scan entirely, and `batch_size == 0` sends | |
| /// empty requests until `max_gap` is reached. Both are configuration | |
| /// errors; callers should use `Default` or positive values. |
| /// empty requests until `max_gap` is reached. Both are configuration | ||
| /// errors; callers should use `Default` or positive values. | ||
| #[derive(Debug, Clone)] | ||
| pub struct RestoreOptions { |
Collaborator
There was a problem hiding this comment.
Maybe just call this NUT13Options so we don't have to rename the nostr at least in this PR?
Comment on lines
+534
to
+535
| #[instrument(skip(self))] | ||
| pub async fn restore_with_opts(&self, opts: RestoreOptions) -> Result<Restored, Error> { |
Collaborator
There was a problem hiding this comment.
We need to add new fns to the Wallet trait and then expose them in ffi as well.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1923 +/- ##
=======================================
Coverage 65.16% 65.17%
=======================================
Files 330 330
Lines 56742 56818 +76
=======================================
+ Hits 36976 37031 +55
- Misses 19766 19787 +21 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3c2c4ef to
b729ad1
Compare
2b1783f to
54276e4
Compare
54276e4 to
9713d1c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Makes Wallet::restore()'s batch size and gap limit configurable via a new RestoreOptions struct, as requested by @thesimplekid in the thread on #1914. Defaults match the NUT-13 spec recommendation (100 / 3), so existing callers see no behavior change.
Partial fix for #1914
Notes to the reviewers
Suggested CHANGELOG Updates
CHANGED
ADDED
REMOVED
FIXED
Checklist
just quick-checkbefore committingcrates/cdk-ffi)