-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
downloader: extract findAncestor search functions #21744
Merged
holiman
merged 3 commits into
ethereum:master
from
meowsbits:feat/downloader-refactor2-squash
Jan 20, 2021
Merged
downloader: extract findAncestor search functions #21744
holiman
merged 3 commits into
ethereum:master
from
meowsbits:feat/downloader-refactor2-squash
Jan 20, 2021
Conversation
This file contains 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
meowsbits
requested review from
holiman,
karalabe and
rjl493456442
as code owners
October 23, 2020 12:54
holiman
reviewed
Nov 3, 2020
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.
Looks good to me, aside from a nitpick
holiman
approved these changes
Nov 4, 2020
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.
LGTM
I'll merge this after #21482, to not add more rebase-work on Peter |
This is a simple refactoring, extracting common ancestor negotiation logic to named functions. This commit addresses the concern at the following link: ethereum#21063 (comment) --- This is a combination of 6 commits. This is the 1st commit message: downloader: extract span search to function This is a plain refactoring, extracting span search logic to its own function. An error 'errNoAncestor' is introduced to handle the case when the function does not find a common ancestor. Signed-off-by: meows <b5c6@protonmail.com> downloader: extract binary search to function This is a simple refactoring extracting the binary search for common ancestor logic to its own function. A tweak was made to the 'floor' variable(s) which I'm still not happy with, but logic is functional -- passing tests -- for now. Signed-off-by: meows <b5c6@protonmail.com> downloader: fixup floor type and logic to minimize change This minimizes the diff, keeping the logic as nearly the same as possible, limiting the span and binary search logic extraction to functions as cleanly as possible. Signed-off-by: meows <b5c6@protonmail.com> downloader: remove limiting ancestor to localheight This is logic not existing at ethereum/go-ethereum master, and thus is not pertinent to a just-refactor. Signed-off-by: meows <b5c6@protonmail.com> downloader: tweaks to get the diff as clean as possible Signed-off-by: meows <b5c6@protonmail.com> downloader: rename error noAncestor -> noAncestorFound Signed-off-by: meows <b5c6@protonmail.com> sq
This is preferred to the value equality check. Co-authored-by: Martin Holst Swende <martin@swende.se>
holiman
force-pushed
the
feat/downloader-refactor2-squash
branch
from
January 20, 2021 18:42
b956722
to
5f00c08
Compare
bulgakovk
pushed a commit
to bulgakovk/go-ethereum
that referenced
this pull request
Jan 26, 2021
This is a simple refactoring, extracting common ancestor negotiation logic to named function
9 tasks
This was referenced Sep 23, 2022
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.
This is a simple refactoring, extracting common ancestor
negotiation logic to named functions.
This commit addresses the concern at the following link:
#21063 (comment)