Skip to content

Commit 94467e0

Browse files
authored
refactor(net): remove unused enable_packet_filter and ban_duration from config
1 parent a80c290 commit 94467e0

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

crates/net/discv4/src/config.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ use std::{
1717
#[derive(Clone, Debug)]
1818
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1919
pub struct Discv4Config {
20-
/// Whether to enable the incoming packet filter. Default: false.
21-
pub enable_packet_filter: bool,
2220
/// Size of the channel buffer for outgoing messages.
2321
pub udp_egress_message_buffer: usize,
2422
/// Size of the channel buffer for incoming messages.
@@ -41,10 +39,6 @@ pub struct Discv4Config {
4139
/// Provides a way to ban peers and ips.
4240
#[cfg_attr(feature = "serde", serde(skip))]
4341
pub ban_list: BanList,
44-
/// Set the default duration for which nodes are banned for. This timeouts are checked every 5
45-
/// minutes, so the precision will be to the nearest 5 minutes. If set to `None`, bans from
46-
/// the filter will last indefinitely. Default is 1 hour.
47-
pub ban_duration: Option<Duration>,
4842
/// Nodes to boot from.
4943
pub bootstrap_nodes: HashSet<NodeRecord>,
5044
/// Whether to randomly discover new peers.
@@ -108,7 +102,6 @@ impl Discv4Config {
108102
impl Default for Discv4Config {
109103
fn default() -> Self {
110104
Self {
111-
enable_packet_filter: false,
112105
// This should be high enough to cover an entire recursive FindNode lookup which is
113106
// includes sending FindNode to nodes it discovered in the rounds using the concurrency
114107
// factor ALPHA
@@ -126,7 +119,6 @@ impl Default for Discv4Config {
126119

127120
lookup_interval: Duration::from_secs(20),
128121
ban_list: Default::default(),
129-
ban_duration: Some(Duration::from_secs(60 * 60)), // 1 hour
130122
bootstrap_nodes: Default::default(),
131123
enable_dht_random_walk: true,
132124
enable_lookup: true,
@@ -148,12 +140,6 @@ pub struct Discv4ConfigBuilder {
148140
}
149141

150142
impl Discv4ConfigBuilder {
151-
/// Whether to enable the incoming packet filter.
152-
pub const fn enable_packet_filter(&mut self) -> &mut Self {
153-
self.config.enable_packet_filter = true;
154-
self
155-
}
156-
157143
/// Sets the channel size for incoming messages
158144
pub const fn udp_ingress_message_buffer(
159145
&mut self,
@@ -276,14 +262,6 @@ impl Discv4ConfigBuilder {
276262
self
277263
}
278264

279-
/// Set the default duration for which nodes are banned for. This timeouts are checked every 5
280-
/// minutes, so the precision will be to the nearest 5 minutes. If set to `None`, bans from
281-
/// the filter will last indefinitely. Default is 1 hour.
282-
pub const fn ban_duration(&mut self, ban_duration: Option<Duration>) -> &mut Self {
283-
self.config.ban_duration = ban_duration;
284-
self
285-
}
286-
287265
/// Adds a boot node
288266
pub fn add_boot_node(&mut self, node: NodeRecord) -> &mut Self {
289267
self.config.bootstrap_nodes.insert(node);
@@ -331,7 +309,6 @@ mod tests {
331309
.enable_lookup(true)
332310
.enable_dht_random_walk(true)
333311
.add_boot_nodes(HashSet::new())
334-
.ban_duration(None)
335312
.lookup_interval(Duration::from_secs(3))
336313
.enable_lookup(true)
337314
.build();

0 commit comments

Comments
 (0)