Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Max Inden <mail@max-inden.de>
  • Loading branch information
rklaehn and mxinden committed Aug 4, 2020
1 parent 62f30cf commit 7738745
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions protocols/gossipsub/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@ impl Gossipsub {
self.mesh.keys()
}

/// lists peers for a certain topic hash
/// Lists peers for a certain topic hash.
pub fn peers(&self, topic_hash: &TopicHash) -> impl Iterator<Item = &PeerId> {
self.mesh.get(topic_hash).into_iter().map(|x| x.into_iter()).flatten()
}

/// lists all peers for any topic
/// Lists all peers for any topic.
pub fn all_peers(&self) -> impl Iterator<Item = &PeerId> {
let mut res = BTreeSet::new();
for peers in self.mesh.values() {
Expand Down
2 changes: 1 addition & 1 deletion protocols/gossipsub/src/behaviour/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ mod tests {
assert_eq!(gs.mesh.get(&topics[0]).unwrap().len(), config.mesh_n);
}

// some very basic test of public api methods
// Some very basic test of public api methods.
#[test]
fn test_public_api() {
let (gs, peers, topic_hashes) =
Expand Down

0 comments on commit 7738745

Please sign in to comment.