diff --git a/p2p/src/block_sync_service.rs b/p2p/src/block_sync_service.rs index 70117a7c..a735d250 100644 --- a/p2p/src/block_sync_service.rs +++ b/p2p/src/block_sync_service.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use anyhow::Result; use database::Database; use eth1_api::RealController; -use eth2_libp2p::{rpc::StatusMessage, PeerAction, PeerId, ReportSource}; +use eth2_libp2p::{PeerAction, PeerId, ReportSource}; use fork_choice_control::SyncMessage; use futures::{ channel::mpsc::{UnboundedReceiver, UnboundedSender}, @@ -236,7 +236,6 @@ impl BlockSyncService

{ } P2pToSync::AddPeer(peer_id, status) => { self.sync_manager.add_peer(peer_id, status); - self.request_peer_status_update(status)?; self.request_blobs_and_blocks_if_ready()?; } P2pToSync::RemovePeer(peer_id) => { @@ -553,15 +552,6 @@ impl BlockSyncService

{ Ok(()) } - fn request_peer_status_update(&mut self, status: StatusMessage) -> Result<()> { - for peer_id in self.sync_manager.outdated_peers(status) { - debug!("Update outdated peer: {peer_id}"); - self.request_peer_status(peer_id)?; - } - - Ok(()) - } - fn request_id(&mut self) -> Result { let request_id = self.next_request_id; self.next_request_id = self.next_request_id.checked_add(1).ok_or(Error)?; diff --git a/p2p/src/sync_manager.rs b/p2p/src/sync_manager.rs index 3a42f000..5f33d9d7 100644 --- a/p2p/src/sync_manager.rs +++ b/p2p/src/sync_manager.rs @@ -45,7 +45,6 @@ const GREEDY_MODE_PEER_LIMIT: usize = 2; const MAX_SYNC_DISTANCE_IN_SLOTS: u64 = 10000; const NOT_ENOUGH_PEERS_MESSAGE_COOLDOWN: Duration = Duration::from_secs(10); const PEER_UPDATE_COOLDOWN_IN_SECONDS: u64 = 12; -const PEERS_BEFORE_STATUS_UPDATE: usize = 1; const SEQUENTIAL_REDOWNLOADS_TILL_RESET: usize = 5; #[derive(Debug, Eq, PartialEq, Clone, Copy)] @@ -603,33 +602,6 @@ impl SyncManager { self.block_requests.expired_range_batches() } - pub fn outdated_peers(&mut self, status: StatusMessage) -> Vec { - if let Some(chain) = self.chain_with_max_peer_count() { - let status_chain = ChainId::from(&status); - - if chain != status_chain - && status_chain.finalized_epoch == chain.finalized_epoch + 1 - && self.chain_peers(&status_chain).len() >= PEERS_BEFORE_STATUS_UPDATE - && self - .status_updates_cache - .cache_get(&status_chain.finalized_epoch) - .is_none() - { - self.status_updates_cache - .cache_set(status_chain.finalized_epoch, ()); - - return self - .peers - .iter() - .filter(move |(_, status)| ChainId::from(*status) == chain) - .map(|(peer_id, _)| *peer_id) - .collect(); - } - } - - vec![] - } - pub fn cache_clear(&mut self) { self.blob_requests.cache_clear(); self.block_requests.cache_clear();