diff --git a/beacon_node/eth2_libp2p/src/behaviour/mod.rs b/beacon_node/eth2_libp2p/src/behaviour/mod.rs index 57b1f3db72..f6885c17a8 100644 --- a/beacon_node/eth2_libp2p/src/behaviour/mod.rs +++ b/beacon_node/eth2_libp2p/src/behaviour/mod.rs @@ -798,6 +798,11 @@ impl NetworkBehaviour for Behaviour { conn_id: ConnectionId, event: ::OutEvent, ) { + // All events from banned peers are rejected + if self.peer_manager.is_banned(&peer_id) { + return; + } + match event { // Events comming from the handler, redirected to each behaviour BehaviourHandlerOut::Delegate(delegate) => match *delegate { diff --git a/beacon_node/eth2_libp2p/src/peer_manager/mod.rs b/beacon_node/eth2_libp2p/src/peer_manager/mod.rs index bc3a5a1fc9..6575508556 100644 --- a/beacon_node/eth2_libp2p/src/peer_manager/mod.rs +++ b/beacon_node/eth2_libp2p/src/peer_manager/mod.rs @@ -178,6 +178,8 @@ impl PeerManager { unban_peer = Some(peer_id.clone()); } } + } else { + debug!(self.log, "Peer score adjusted"; "peer_id" => peer_id.to_string(), "score" => info.score.to_string()); } } @@ -291,7 +293,8 @@ impl PeerManager { /// This adjusts a peer's score based on the error. pub fn handle_rpc_error(&mut self, peer_id: &PeerId, protocol: Protocol, err: &RPCError) { let client = self.network_globals.client(peer_id); - warn!(self.log, "RPC Error"; "protocol" => protocol.to_string(), "err" => err.to_string(), "client" => client.to_string()); + let score = self.network_globals.peers.read().score(peer_id); + warn!(self.log, "RPC Error"; "protocol" => protocol.to_string(), "err" => err.to_string(), "client" => client.to_string(), "peer_id" => peer_id.to_string(), "score" => score.to_string()); // Map this error to a `PeerAction` (if any) let peer_action = match err {