Skip to content

Commit

Permalink
Ban and unban peers at the swarm level (sigp#3653)
Browse files Browse the repository at this point in the history
## Issue Addressed

I missed this from sigp#3491. peers were being banned at the behaviour level only. The identify errors are explained by this as well

## Proposed Changes

Add banning and unbanning 

## Additional Info

Befor,e having tests that catch this was hard because the swarm was outside the behaviour. We could now have tests that prevent something like this in the future
  • Loading branch information
divagant-martian authored and Woodpile37 committed Jan 6, 2024
1 parent 01f1839 commit 243b42b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions beacon_node/lighthouse_network/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1353,10 +1353,12 @@ impl<AppReqId: ReqId, TSpec: EthSpec> Network<AppReqId, TSpec> {
Some(NetworkEvent::PeerDisconnected(peer_id))
}
PeerManagerEvent::Banned(peer_id, associated_ips) => {
self.swarm.ban_peer_id(peer_id);
self.discovery_mut().ban_peer(&peer_id, associated_ips);
Some(NetworkEvent::PeerBanned(peer_id))
}
PeerManagerEvent::UnBanned(peer_id, associated_ips) => {
self.swarm.unban_peer_id(peer_id);
self.discovery_mut().unban_peer(&peer_id, associated_ips);
Some(NetworkEvent::PeerUnbanned(peer_id))
}
Expand Down

0 comments on commit 243b42b

Please sign in to comment.