commit 7f6c57db4830c5b1d69a3d35cf5578a0ea66a4ed parent a816bfded7ee6655d268c9090491f5ccec201228 Author: Christian Grothoff <christian@grothoff.org> Date: Sat, 31 Oct 2026 11:16:30 +0100 check enabled first Diffstat:
| M | libeufin-bank/src/config.rs | | | 15 | +++++++++++---- |
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/libeufin-bank/src/config.rs b/libeufin-bank/src/config.rs @@ -97,10 +97,17 @@ impl BankCfg { currency: &Currency, ) -> Result<CurrencySpecification, CfgErr> { for s in cfg.sections() { - if s.name.starts_with("currency-") - && s.currency("code").require()? == *currency - && s.boolean("enabled").require()? - { + if !s.name.starts_with("currency-") { + continue; + } + // ENABLED has to be checked before anything else in the section as + // currencies.conf may carry disabled sections whose CODE + // is not a valid currency and parsing those would abort the whole + // configuration. + if !s.boolean("enabled").require()? { + continue; + } + if s.currency("code").require()? == *currency { return Ok(CurrencySpecification { name: s.cstr("name").require()?, num_fractional_input_digits: s.number("fractional_input_digits").require()?,