Skip to content
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

Gossipsub: Use sets instead of vectors inside behaviour state #1675

Closed
wants to merge 3 commits into from

Conversation

rklaehn
Copy link
Contributor

@rklaehn rklaehn commented Jul 23, 2020

To completely eliminate the possibility of having duplicate peers in these sets

@@ -771,7 +766,9 @@ impl Gossipsub {
}
}
}
peers.retain(|peer| to_remove_peers.contains(&peer));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is different than in the old code, but I think the old code has the condition flipped.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes true. Nice catch

@rklaehn rklaehn changed the title Use sets for peer sets etc Gossipsub: Use sets instead of vectors inside behaviour state Jul 23, 2020
@AgeManning
Copy link
Contributor

This a nice addition. There are some extra checks (for duplicates in the Vectors) that we no longer need and can be removed.

I'm going to try and finish up fixing all these bugs and hopefully address your issue in #1583. To this end, I've merged these into there.

AgeManning added a commit to sigp/rust-libp2p that referenced this pull request Jul 24, 2020
@rklaehn
Copy link
Contributor Author

rklaehn commented Jul 24, 2020

So the signing PR is basically your development branch? I might have a few DRY refactoring improvements that I will PR against that one then.

Anyway, I am going to close this PR. Thanks for the inclusion.

@rklaehn rklaehn closed this Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants