Skip to content

Commit 64cd225

Browse files
authored
fix(gossipsub): fix check for fanout peer inclusion in test_join
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.
1 parent f641870 commit 64cd225

File tree

1 file changed

+2
-1
lines changed
  • protocols/gossipsub/src/behaviour

1 file changed

+2
-1
lines changed

protocols/gossipsub/src/behaviour/tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ fn test_join() {
580580
// add 3 random peers to the fanout[topic1]
581581
gs.fanout
582582
.insert(topic_hashes[1].clone(), Default::default());
583-
let new_peers: Vec<PeerId> = vec![];
583+
let mut new_peers: Vec<PeerId> = vec![];
584584
for _ in 0..3 {
585585
let random_peer = PeerId::random();
586586
// inform the behaviour of a new peer
@@ -598,6 +598,7 @@ fn test_join() {
598598
// add the new peer to the fanout
599599
let fanout_peers = gs.fanout.get_mut(&topic_hashes[1]).unwrap();
600600
fanout_peers.insert(random_peer);
601+
new_peers.push(random_peer);
601602
}
602603

603604
// subscribe to topic1

0 commit comments

Comments
 (0)