Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
downloader: extract findAncestor search functions
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
- Loading branch information