diff --git a/client/network/src/protocol.rs b/client/network/src/protocol.rs index b39d0d1b8428b..eb634ca5be764 100644 --- a/client/network/src/protocol.rs +++ b/client/network/src/protocol.rs @@ -465,12 +465,6 @@ impl Protocol { self.behaviour.open_peers() } - /// Returns the list of all the peers that the peerset currently requests us to be connected - /// to on the default set. - pub fn requested_peers(&self) -> impl Iterator { - self.behaviour.requested_peers(HARDCODED_PEERSETS_SYNC) - } - /// Returns the number of discovered nodes that we keep in memory. pub fn num_discovered_peers(&self) -> usize { self.behaviour.num_discovered_peers() @@ -496,7 +490,7 @@ impl Protocol { /// Returns the number of peers we're connected to. pub fn num_connected_peers(&self) -> usize { - self.peers.values().count() + self.peers.len() } /// Returns the number of peers we're connected to and that are being queried. diff --git a/client/network/src/protocol/notifications/behaviour.rs b/client/network/src/protocol/notifications/behaviour.rs index 97047201c308c..b47216473970e 100644 --- a/client/network/src/protocol/notifications/behaviour.rs +++ b/client/network/src/protocol/notifications/behaviour.rs @@ -251,16 +251,6 @@ impl PeerState { _ => None, } } - - /// True if that node has been requested by the PSM. - fn is_requested(&self) -> bool { - matches!( - self, - Self::PendingRequest { .. } | - Self::Requested | Self::DisabledPendingEnable { .. } | - Self::Enabled { .. } - ) - } } /// State of the handler of a single connection visible from this state machine. @@ -560,17 +550,6 @@ impl Notifications { } } - /// Returns the list of all the peers that the peerset currently requests us to be connected to. - pub fn requested_peers<'a>( - &'a self, - set_id: sc_peerset::SetId, - ) -> impl Iterator + 'a { - self.peers - .iter() - .filter(move |((_, set), state)| *set == set_id && state.is_requested()) - .map(|((id, _), _)| id) - } - /// Returns the list of reserved peers. pub fn reserved_peers<'a>( &'a self, diff --git a/client/network/src/service.rs b/client/network/src/service.rs index b6a1d3c88e7f3..a02aa982318a9 100644 --- a/client/network/src/service.rs +++ b/client/network/src/service.rs @@ -2108,10 +2108,6 @@ impl Future for NetworkWorker { .peerset_num_discovered .set(this.network_service.behaviour_mut().user_protocol().num_discovered_peers() as u64); - metrics.peerset_num_requested.set( - this.network_service.behaviour_mut().user_protocol().requested_peers().count() - as u64, - ); metrics.pending_connections.set( Swarm::network_info(&this.network_service).connection_counters().num_pending() as u64, diff --git a/client/network/src/service/metrics.rs b/client/network/src/service/metrics.rs index bf94287d12918..ad30b1b093ff9 100644 --- a/client/network/src/service/metrics.rs +++ b/client/network/src/service/metrics.rs @@ -69,7 +69,6 @@ pub struct Metrics { pub notifications_streams_closed_total: CounterVec, pub notifications_streams_opened_total: CounterVec, pub peerset_num_discovered: Gauge, - pub peerset_num_requested: Gauge, pub pending_connections: Gauge, pub pending_connections_errors_total: CounterVec, pub requests_in_failure_total: CounterVec, @@ -204,10 +203,6 @@ impl Metrics { "substrate_sub_libp2p_peerset_num_discovered", "Number of nodes stored in the peerset manager", )?, registry)?, - peerset_num_requested: prometheus::register(Gauge::new( - "substrate_sub_libp2p_peerset_num_requested", - "Number of nodes that the peerset manager wants us to be connected to", - )?, registry)?, pending_connections: prometheus::register(Gauge::new( "substrate_sub_libp2p_pending_connections", "Number of connections in the process of being established",