From c254139de631cae92eb94d74779dd63b9f7358f5 Mon Sep 17 00:00:00 2001 From: nambrot Date: Wed, 15 Nov 2023 23:20:35 +0300 Subject: [PATCH] Actually default to none policy --- rust/agents/relayer/src/settings/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rust/agents/relayer/src/settings/mod.rs b/rust/agents/relayer/src/settings/mod.rs index 18ea52dddb..a595f0899b 100644 --- a/rust/agents/relayer/src/settings/mod.rs +++ b/rust/agents/relayer/src/settings/mod.rs @@ -143,7 +143,7 @@ impl FromRawConf for RelayerSettings { raw_gas_payment_enforcement_path, &raw_gas_payment_enforcement, ); - let gas_payment_enforcement = gas_payment_enforcement_parser.into_array_iter().map(|itr| { + let mut gas_payment_enforcement = gas_payment_enforcement_parser.into_array_iter().map(|itr| { itr.filter_map(|policy| { let policy_type = policy.chain(&mut err).get_opt_key("type").parse_string().end(); let minimum_is_defined = matches!(policy.get_opt_key("minimum"), Ok(Some(_))); @@ -187,7 +187,11 @@ impl FromRawConf for RelayerSettings { matching_list, }) }).collect_vec() - }).unwrap_or_else(|_| vec![GasPaymentEnforcementConf::default()]); + }).unwrap_or_default(); + + if gas_payment_enforcement.is_empty() { + gas_payment_enforcement.push(GasPaymentEnforcementConf::default()); + } let whitelist = p .chain(&mut err)