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.

12b785e94e/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.
This commit is contained in:
Lin Oshitani 2023-03-22 07:04:57 +09:00 committed by GitHub
parent f64187049d
commit 64cd225dca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -580,7 +580,7 @@ fn test_join() {
// add 3 random peers to the fanout[topic1] // add 3 random peers to the fanout[topic1]
gs.fanout gs.fanout
.insert(topic_hashes[1].clone(), Default::default()); .insert(topic_hashes[1].clone(), Default::default());
let new_peers: Vec<PeerId> = vec![]; let mut new_peers: Vec<PeerId> = vec![];
for _ in 0..3 { for _ in 0..3 {
let random_peer = PeerId::random(); let random_peer = PeerId::random();
// inform the behaviour of a new peer // inform the behaviour of a new peer
@ -598,6 +598,7 @@ fn test_join() {
// add the new peer to the fanout // add the new peer to the fanout
let fanout_peers = gs.fanout.get_mut(&topic_hashes[1]).unwrap(); let fanout_peers = gs.fanout.get_mut(&topic_hashes[1]).unwrap();
fanout_peers.insert(random_peer); fanout_peers.insert(random_peer);
new_peers.push(random_peer);
} }
// subscribe to topic1 // subscribe to topic1