Skip to content

Commit

Permalink
fix(dht): use limited ban period for invalid peer (#4933)
Browse files Browse the repository at this point in the history
Description
---
- changes ban period for a remote node sending an invalid peer from permanent to limited (6 hours).
- adds more detail on the reason for the ban

Motivation and Context
---
Seeing permanent bans for this case. This should make diagnosis easier.

How Has This Been Tested?
---
Simple change
  • Loading branch information
sdbondi committed Nov 18, 2022
1 parent e2b7ad1 commit 04a3a8f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions comms/dht/src/network_discovery/discovering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,13 @@ impl Discovering {
);
self.context
.connectivity
.ban_peer(
.ban_peer_until(
sync_peer.clone(),
format!("Network discovery peer sent invalid peer '{}'", new_peer_node_id),
self.context.config.ban_duration,
format!(
"Network discovery peer sent invalid peer '{}'. {}",
new_peer_node_id, err
),
)
.await?;
Err(err.into())
Expand Down

0 comments on commit 04a3a8f

Please sign in to comment.