-
Notifications
You must be signed in to change notification settings - Fork 427
Remove panic from stop gap scan loop #2053
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
Open
reez
wants to merge
1
commit into
bitcoindevkit:master
Choose a base branch
from
reez:esplora
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
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.
@reez this is the only place that
gap_limitis used. Can you explain what is functionally different when thegap_limitis minimally bound toparallel_requestsvs when it's not?I may be missing something, but I'm failing to see a clear rationale for the bound.
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.
I took a look at this original issue: bitcoindevkit/bdk_wallet#63
I think bounding to 1 makes more sense - since a
stop_gapof 0 is undefined and the behaviour we want is to "treat 0 as 1".Bounding it to parallel requests does the same thing, but the intention is obscured imo. It seems like the intention is to have
consecutive_usedbe a multiple ofgap_limitif thegap_limitis originally set lower thanparallel_requests? However we are using>=, and this breaks down whengap_limit > parallel_requestsanyway.If the rationale is not obvious, the reader might assume they are missing something and spend time trying to understand it and then find out there is nothing to be understood.
Uh oh!
There was an error while loading. Please reload this page.
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.
Consider
parallel_requests=10,stop_gap=5, first batch processes indices 0-9 where indices 0-4 have transactions and 5-9 are empty:Original code:
last_active_index=4,last_index=9If we do
.max(1):If we keep this PR as is with
.max(parallel_requests):consecutive_unused=5,gap_limit=10So
.max(parallel_requests)changes the effectivestop_gapwhen the user provides a value less thanparallel_requests, which is a behavioral change from the original code..max(1)preserves the original semantics while handling thestop_gap=0edge case.Suggestion
Change to
.max(1).Uh oh!
There was an error while loading. Please reload this page.
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.
Updated to
.max(1)thanks for the deep dive review of that. Also tweaked the rationale comments. Updated PR description to mention.max(1)too now. Happy to adjust further if needed.