Skip to content

Commit

Permalink
fix(gossipsub): fix check for fanout peer inclusion in test_join
Browse files Browse the repository at this point in the history
The check for fanout peer inclusion in `test_join` does not check anything since `new_peers` is always empty.

https://github.com/libp2p/rust-libp2p/blob/12b785e94ede1e763dd041a107d3a00d5135a213/protocols/gossipsub/src/behaviour/tests.rs#L611

I assume the intention was to fill the `new_peers` with the fanout peers. In this MR I do just that.

Pull-Request: #3628.
  • Loading branch information
linoscope committed Mar 21, 2023
1 parent f641870 commit 64cd225
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion protocols/gossipsub/src/behaviour/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ fn test_join() {
// add 3 random peers to the fanout[topic1]
gs.fanout
.insert(topic_hashes[1].clone(), Default::default());
let new_peers: Vec<PeerId> = vec![];
let mut new_peers: Vec<PeerId> = vec![];
for _ in 0..3 {
let random_peer = PeerId::random();
// inform the behaviour of a new peer
Expand All @@ -598,6 +598,7 @@ fn test_join() {
// add the new peer to the fanout
let fanout_peers = gs.fanout.get_mut(&topic_hashes[1]).unwrap();
fanout_peers.insert(random_peer);
new_peers.push(random_peer);
}

// subscribe to topic1
Expand Down

0 comments on commit 64cd225

Please sign in to comment.