From 075049ff373ae080958f60af02c08d42bd018f36 Mon Sep 17 00:00:00 2001 From: zkxuerb Date: Wed, 13 Nov 2024 17:25:21 +0100 Subject: [PATCH] remove test feature from cfg --- node/bft/src/gateway.rs | 10 +++++----- node/router/src/handshake.rs | 2 +- node/router/src/lib.rs | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/node/bft/src/gateway.rs b/node/bft/src/gateway.rs index cf6a909d6b..9f3e55c1fb 100644 --- a/node/bft/src/gateway.rs +++ b/node/bft/src/gateway.rs @@ -65,7 +65,7 @@ use futures::SinkExt; use indexmap::{IndexMap, IndexSet}; use parking_lot::{Mutex, RwLock}; use rand::seq::{IteratorRandom, SliceRandom}; -#[cfg(not(any(test, feature = "test")))] +#[cfg(not(any(test)))] use std::net::IpAddr; use std::{collections::HashSet, future::Future, io, net::SocketAddr, sync::Arc, time::Duration}; use tokio::{ @@ -92,7 +92,7 @@ const MIN_CONNECTED_VALIDATORS: usize = 175; const MAX_VALIDATORS_TO_SEND: usize = 200; /// The minimum permitted interval between connection attempts for an IP; anything shorter is considered malicious. -#[cfg(not(any(test, feature = "test")))] +#[cfg(not(any(test)))] const CONNECTION_ATTEMPTS_SINCE_SECS: i64 = 10; /// The amount of time an IP address is prohibited from connecting. const IP_BAN_TIME_IN_SECS: u64 = 300; @@ -469,13 +469,13 @@ impl Gateway { } /// Check whether the given IP address is currently banned. - #[cfg(not(any(test, feature = "test")))] + #[cfg(not(any(test)))] fn is_ip_banned(&self, ip: IpAddr) -> bool { self.tcp.banned_peers().is_ip_banned(&ip) } /// Insert or update a banned IP. - #[cfg(not(any(test, feature = "test")))] + #[cfg(not(any(test)))] fn update_ip_ban(&self, ip: IpAddr) { self.tcp.banned_peers().update_ip_ban(ip); } @@ -1154,7 +1154,7 @@ impl Handshake for Gateway { let peer_side = connection.side(); // Check (or impose) IP-level bans. - #[cfg(not(any(test, feature = "test")))] + #[cfg(not(any(test)))] if self.dev().is_none() && peer_side == ConnectionSide::Initiator { // If the IP is already banned reject the connection. if self.is_ip_banned(peer_addr.ip()) { diff --git a/node/router/src/handshake.rs b/node/router/src/handshake.rs index dd8173649f..b8487caa40 100644 --- a/node/router/src/handshake.rs +++ b/node/router/src/handshake.rs @@ -102,7 +102,7 @@ impl Router { }; // Check (or impose) IP-level bans. - #[cfg(not(any(test, feature = "test")))] + #[cfg(not(any(test)))] if !self.is_dev() && peer_side == ConnectionSide::Initiator { // If the IP is already banned reject the connection. if self.is_ip_banned(peer_addr.ip()) { diff --git a/node/router/src/lib.rs b/node/router/src/lib.rs index f99b76ea29..5bb04d2682 100644 --- a/node/router/src/lib.rs +++ b/node/router/src/lib.rs @@ -47,7 +47,7 @@ use snarkvm::prelude::{Address, Network, PrivateKey, ViewKey}; use anyhow::{Result, bail}; use parking_lot::{Mutex, RwLock}; -#[cfg(not(any(test, feature = "test")))] +#[cfg(not(any(test)))] use std::net::IpAddr; use std::{ collections::{HashMap, HashSet, hash_map::Entry}, @@ -107,14 +107,14 @@ pub struct InnerRouter { impl Router { /// The minimum permitted interval between connection attempts for an IP; anything shorter is considered malicious. - #[cfg(not(any(test, feature = "test")))] + #[cfg(not(any(test)))] const CONNECTION_ATTEMPTS_SINCE_SECS: i64 = 10; /// The maximum number of candidate peers permitted to be stored in the node. const MAXIMUM_CANDIDATE_PEERS: usize = 10_000; /// The maximum number of connection failures permitted by an inbound connecting peer. const MAXIMUM_CONNECTION_FAILURES: usize = 5; /// The maximum amount of connection attempts withing a 10 second threshold - #[cfg(not(any(test, feature = "test")))] + #[cfg(not(any(test)))] const MAX_CONNECTION_ATTEMPTS: usize = 10; /// The duration in seconds after which a connected peer is considered inactive or /// disconnected if no message has been received in the meantime. @@ -450,13 +450,13 @@ impl Router { } /// Check whether the given IP address is currently banned. - #[cfg(not(any(test, feature = "test")))] + #[cfg(not(any(test)))] fn is_ip_banned(&self, ip: IpAddr) -> bool { self.tcp.banned_peers().is_ip_banned(&ip) } /// Insert or update a banned IP. - #[cfg(not(any(test, feature = "test")))] + #[cfg(not(any(test)))] fn update_ip_ban(&self, ip: IpAddr) { self.tcp.banned_peers().update_ip_ban(ip); }