From b68e237d7ee7f39bef896f3afe56a0e18ce61fc1 Mon Sep 17 00:00:00 2001 From: Michael Sutton Date: Sun, 7 Jan 2024 18:17:35 +0000 Subject: [PATCH] restore collect --- protocol/p2p/src/core/hub.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/protocol/p2p/src/core/hub.rs b/protocol/p2p/src/core/hub.rs index 0bd9fe070..dad8ddd9d 100644 --- a/protocol/p2p/src/core/hub.rs +++ b/protocol/p2p/src/core/hub.rs @@ -110,7 +110,8 @@ impl Hub { let peers = self.peers.read().values().cloned().collect::>(); // TODO: At least some of the peers should be outbound, because an attacker can gain less control // over the set of outbound peers. - for router in peers.choose_multiple(&mut rand::thread_rng(), num_peers) { + let peers = peers.choose_multiple(&mut rand::thread_rng(), num_peers).cloned().collect::>(); + for router in peers { let _ = router.enqueue(msg.clone()).await; } }