mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-30 09:38:24 -05:00
fix: ban trusted peer for a short period (#7071)
This commit is contained in:
@@ -298,7 +298,15 @@ impl PeersManager {
|
||||
|
||||
/// Bans the peer temporarily with the configured ban timeout
|
||||
fn ban_peer(&mut self, peer_id: PeerId) {
|
||||
self.ban_list.ban_peer_until(peer_id, std::time::Instant::now() + self.ban_duration);
|
||||
let mut ban_duration = self.ban_duration;
|
||||
if let Some(peer) = self.peers.get(&peer_id) {
|
||||
if peer.is_trusted() {
|
||||
// For misbehaving trusted peers, we provide a bit more leeway when penalizing them.
|
||||
ban_duration = self.backoff_durations.medium;
|
||||
}
|
||||
}
|
||||
|
||||
self.ban_list.ban_peer_until(peer_id, std::time::Instant::now() + ban_duration);
|
||||
self.queued_actions.push_back(PeerAction::BanPeer { peer_id });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user