mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Prevent connections from peers with a banned ip history (#6008)
* Block peers based on past ips * Remove unused type
This commit is contained in:
@@ -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};
|
||||
@@ -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",
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user