-
Notifications
You must be signed in to change notification settings - Fork 990
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
Flexible peer filtering #3458
Merged
antiochp
merged 8 commits into
mimblewimble:master
from
antiochp:most_work_peers_capabilities
Oct 27, 2020
Merged
Flexible peer filtering #3458
antiochp
merged 8 commits into
mimblewimble:master
from
antiochp:most_work_peers_capabilities
Oct 27, 2020
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
antiochp
force-pushed
the
most_work_peers_capabilities
branch
2 times, most recently
from
October 8, 2020 15:50
60a5eac
to
74523f4
Compare
reorder peers filters so expensive filters come later
antiochp
force-pushed
the
most_work_peers_capabilities
branch
from
October 19, 2020 15:29
74523f4
to
609c965
Compare
jaspervdm
reviewed
Oct 25, 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.
Apologies for the delay in review. I really like the approach here 👍 Just have a few small comments
jaspervdm
approved these changes
Oct 26, 2020
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.
Takes inspiration from #3021 replacing custom cursor impl with
impl Iterator
.As part of the PIBD work we will want to run nodes on the network that support various different sync strategies. some nodes may support PIBD while others only support "legacy" txhashset downloads.
So we need more flexible peer management and filtering of connected peers. This PR is a step toward this.
Introduce
PeersIter
so we can return iterator via "newtype iterator delegation".Then expose various filters and operators on
PeersIter
so we can chain them in various flexible ways -choose_random()
filter onPeersIter
with_difficulty()
filtering to filter based on minimum difficultywith_capabilities()
filtering that can be combined with other chain-able filtersThe following fns have all been replaced with the flexible
with_difficulty()
filter -more_work_peers()
more_or_same_work_peers()
more_work_peer()
most_work_peers()
most_work_peer()
Note: As part of this PR the sync process has been modified slightly.
During sync (both header_sync and state_sync) we now sync explicitly against outbound peers.
This makes the sync process more consistent across "public" and "private" nodes. We no longer attempt to sync against inbound nodes regardless of whether we accept incoming connections or not.