-
Notifications
You must be signed in to change notification settings - Fork 396
fix(bitcoind_rpc): properly handle reorgs in FilterIter
#1985
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
LagginTimes
wants to merge
4
commits into
bitcoindevkit:master
Choose a base branch
from
LagginTimes:filter_iter
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
Show all changes
4 commits
Select commit
Hold shift + click to select a range
10fa62a
test(bitcoind_rpc): update `FilterIter` tests
Musab1258 7e1cc26
fix(bitcoind_rpc): `FilterIter` detects reorgs
LagginTimes c2ae4da
test(bitcoind_rpc): tests for reorg between `next()` and MAX_REORG_DEPTH
LagginTimes 071fe40
feat(bitcoind_rpc): Various fixes for `FilterIter`
evanlinjin 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
Oops, something went wrong.
Oops, something went wrong.
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.
Maybe a little out of scope for this PR, but the documentation here is a little lacking.
get_tip
, as I understand, serves the following purposes:FilerIter
. Without calling it,FilterIter
returns nothing.None
, it means we are up to date with remote.Is this the case?
If so, purpose
2.
is not satisfied because reorgs are not detected byget_tip
.@ValuedMammal are you able to provide some clarity, thanks!
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.
get_tip
is used to set the start and stop height of a scan and is only necessary to call once per instance of FilterIter. During review I was going to mention that I thinkget_tip
should actually clearself.blocks
, because I didn't anticipate the user interleaving calls toget_tip
andnext
.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.
@ValuedMammal Thank you for the update.
The internal implementation of
FilterIter
implies that it is a single-use structure (construct once, call.next
till end). However, the API design of it implies something different.What do you think about changing the API to properly represent a "single-use" workflow? I.e. I would change the following:
add_spk{s}
.None
if there are no spks provided.get_tip
logic is run on the first call tonext
.get_tip
toinit
which would return the target height.(Separate PR of course)
Let me know what you think.
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 like this idea, and can make a follow up PR to implement this.
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 agree it makes sense to make the API simpler/safer by making it a one time use struct that takes spks in the constructor. @LagginTimes please open a new issue or PR so we can continue exact implementation changes there.