From 131efe1c7a08850c2391a042dd27c15cf5139e1d Mon Sep 17 00:00:00 2001 From: Roland Sherwin Date: Fri, 5 Apr 2024 01:43:32 +0530 Subject: [PATCH] fix(network): clients should not perform farthest relevant record check --- sn_networking/src/driver.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sn_networking/src/driver.rs b/sn_networking/src/driver.rs index c9f0148b95..42d5a2c5cd 100644 --- a/sn_networking/src/driver.rs +++ b/sn_networking/src/driver.rs @@ -602,14 +602,15 @@ impl SwarmDriver { } } _ = set_farthest_record_interval.tick() => { - let closest_k_peers = self - .get_closest_k_value_local_peers(); - - if let Some(distance) = self.get_farthest_relevant_address_estimate(&closest_k_peers) { - // set any new distance to fathest record in the store - self.swarm.behaviour_mut().kademlia.store_mut().set_distance_range(distance); - // the distance range within the replication_fetcher shall be in sync as well - self.replication_fetcher.set_distance_range(distance); + if !self.is_client { + let closest_k_peers = self.get_closest_k_value_local_peers(); + + if let Some(distance) = self.get_farthest_relevant_address_estimate(&closest_k_peers) { + // set any new distance to farthest record in the store + self.swarm.behaviour_mut().kademlia.store_mut().set_distance_range(distance); + // the distance range within the replication_fetcher shall be in sync as well + self.replication_fetcher.set_distance_range(distance); + } } } }