From a53e2c0666c2a4c7d4a80170d60164b45183aaa2 Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Fri, 1 Dec 2023 17:07:53 -0500 Subject: [PATCH] feat: add Default for NetworkArgs and DiscoveryArgs (#5658) --- bin/reth/src/args/network_args.rs | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/bin/reth/src/args/network_args.rs b/bin/reth/src/args/network_args.rs index 44fd622825..387096aa5b 100644 --- a/bin/reth/src/args/network_args.rs +++ b/bin/reth/src/args/network_args.rs @@ -125,6 +125,26 @@ impl NetworkArgs { } } +impl Default for NetworkArgs { + fn default() -> Self { + Self { + discovery: DiscoveryArgs::default(), + trusted_peers: vec![], + trusted_only: false, + bootnodes: None, + peers_file: None, + identity: P2P_CLIENT_VERSION.to_string(), + p2p_secret_key: None, + no_persist_peers: false, + nat: NatResolver::Any, + addr: DEFAULT_DISCOVERY_ADDR, + port: DEFAULT_DISCOVERY_PORT, + max_outbound_peers: None, + max_inbound_peers: None, + } + } +} + /// Arguments to setup discovery #[derive(Debug, Args)] pub struct DiscoveryArgs { @@ -166,6 +186,18 @@ impl DiscoveryArgs { } } +impl Default for DiscoveryArgs { + fn default() -> Self { + Self { + disable_discovery: false, + disable_dns_discovery: false, + disable_discv4_discovery: false, + addr: DEFAULT_DISCOVERY_ADDR, + port: DEFAULT_DISCOVERY_PORT, + } + } +} + #[cfg(test)] mod tests { use super::*;