diff --git a/zebra-network/src/peer_set/initialize.rs b/zebra-network/src/peer_set/initialize.rs index ab355b6fcbb..ece01b72bfb 100644 --- a/zebra-network/src/peer_set/initialize.rs +++ b/zebra-network/src/peer_set/initialize.rs @@ -199,8 +199,12 @@ where ); let _ = candidates.update_initial(active_initial_peer_count).await; - // TODO: reduce demand by `active_outbound_connections.update_count()` (#2902) - for _ in 0..config.peerset_initial_target_size { + // Compute remaining connections to open. + let demand_count = config + .peerset_initial_target_size + .saturating_sub(active_outbound_connections.update_count()); + + for _ in 0..demand_count { let _ = demand_tx.try_send(MorePeers); }