From 4070f482e4c469f7cbd6db60e997f514bc534501 Mon Sep 17 00:00:00 2001 From: draoi Date: Wed, 17 Jul 2024 15:31:30 +0200 Subject: [PATCH] settings: implement Default for BanPolicy --- src/net/settings.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/net/settings.rs b/src/net/settings.rs index 72ea095dc..244673f5a 100644 --- a/src/net/settings.rs +++ b/src/net/settings.rs @@ -47,6 +47,12 @@ impl std::str::FromStr for BanPolicy { } } +impl Default for BanPolicy { + fn default() -> Self { + BanPolicy::Strict + } +} + /// P2P network settings. The scope of this is a P2P network instance /// configured by the library user. #[derive(Debug, Clone)] @@ -270,6 +276,8 @@ pub struct SettingsOpt { /// Do not ban nodes that send messages without dispatchers if set /// to `Relaxed`. For most uses, should be set to `Strict`. + #[serde(default)] + #[structopt(skip)] pub ban_policy: BanPolicy, }