Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Remove unused light-client leftover #13687

Merged
merged 2 commits into from
Mar 23, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove unused light-client leftover
  • Loading branch information
skunert committed Mar 23, 2023
commit 91e0d66258a5143e2f4fa9bbf591d0ded4cd44b0
30 changes: 0 additions & 30 deletions client/network/sync/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ use std::{
/// Interval at which we perform time based maintenance
const TICK_TIMEOUT: std::time::Duration = std::time::Duration::from_millis(1100);

/// When light node connects to the full node and the full node is behind light node
/// for at least `LIGHT_MAXIMAL_BLOCKS_DIFFERENCE` blocks, we consider it not useful
/// and disconnect to free connection slot.
const LIGHT_MAXIMAL_BLOCKS_DIFFERENCE: u64 = 8192;

/// Maximum number of known block hashes to keep for a peer.
const MAX_KNOWN_BLOCKS: usize = 1024; // ~32kb per peer + LruHashSet overhead

Expand Down Expand Up @@ -834,31 +829,6 @@ where
return Err(())
}

if self.roles.is_light() {
// we're not interested in light peers
if status.roles.is_light() {
log::debug!(target: "sync", "Peer {} is unable to serve light requests", who);
self.network_service.report_peer(who, rep::BAD_ROLE);
self.network_service
.disconnect_peer(who, self.block_announce_protocol_name.clone());
return Err(())
}

// we don't interested in peers that are far behind us
let self_best_block = self.client.info().best_number;
let blocks_difference = self_best_block
.checked_sub(&status.best_number)
.unwrap_or_else(Zero::zero)
.saturated_into::<u64>();
if blocks_difference > LIGHT_MAXIMAL_BLOCKS_DIFFERENCE {
log::debug!(target: "sync", "Peer {} is far behind us and will unable to serve light requests", who);
self.network_service.report_peer(who, rep::PEER_BEHIND_US_LIGHT);
self.network_service
.disconnect_peer(who, self.block_announce_protocol_name.clone());
return Err(())
}
}

let no_slot_peer = self.default_peers_set_no_slot_peers.contains(&who);
let this_peer_reserved_slot: usize = if no_slot_peer { 1 } else { 0 };

Expand Down