Skip to content

Commit

Permalink
Prevent connections from peers with a banned ip history (#6008)
Browse files Browse the repository at this point in the history
* Block peers based on past ips

* Remove unused type
  • Loading branch information
AgeManning authored Jun 27, 2024
1 parent f106533 commit 9b093c8
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use slog::{debug, error, trace};
use types::EthSpec;

use crate::discovery::enr_ext::EnrExt;
use crate::peer_manager::peerdb::BanResult;
use crate::rpc::GoodbyeReason;
use crate::types::SyncState;
use crate::{metrics, ClearDialError};
Expand Down Expand Up @@ -201,7 +200,7 @@ impl<E: EthSpec> NetworkBehaviour for PeerManager<E> {
) -> Result<libp2p::swarm::THandler<Self>, ConnectionDenied> {
trace!(self.log, "Inbound connection"; "peer_id" => %peer_id, "multiaddr" => %remote_addr);
// We already checked if the peer was banned on `handle_pending_inbound_connection`.
if let Some(BanResult::BadScore) = self.ban_status(&peer_id) {
if self.ban_status(&peer_id).is_some() {
return Err(ConnectionDenied::new(
"Connection to peer rejected: peer has a bad score",
));
Expand Down

0 comments on commit 9b093c8

Please sign in to comment.