From 4fac247bc7187cd611daad87563396c06a8295e4 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 19 Jan 2020 20:57:32 +0100 Subject: use TALER_config_get_amount() consistently, require currency rounding option to exist instead of defaulting --- src/exchange/taler-exchange-aggregator.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'src/exchange/taler-exchange-aggregator.c') diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c index e9474d89f..0718fdda5 100644 --- a/src/exchange/taler-exchange-aggregator.c +++ b/src/exchange/taler-exchange-aggregator.c @@ -603,28 +603,16 @@ exchange_serve_process_config () } { - char *rounding_str; - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (cfg, - "taler", - "CURRENCY_ROUND_UNIT", - &rounding_str)) - { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "No [taler]/CURRENCY_ROUND_UNIT specified, defaulting to '0.01'.\n"); - GNUNET_assert (GNUNET_OK == - TALER_amount_get_zero (exchange_currency_string, - ¤cy_round_unit)); - currency_round_unit.fraction = TALER_AMOUNT_FRAC_BASE / 100; - } - else if (GNUNET_OK != - TALER_string_to_amount (rounding_str, - ¤cy_round_unit)) + if ( (GNUNET_OK != + TALER_config_get_amount (cfg, + "taler", + "CURRENCY_ROUND_UNIT", + ¤cy_round_unit)) || + ( (0 != currency_round_unit.fraction) && + (0 != currency_round_unit.value) ) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Invalid amount `%s' specified in `TALER' under `CURRENCY_ROUND_UNIT'\n", - rounding_str); - GNUNET_free (rounding_str); + "Invalid value specified in `TALER' under `CURRENCY_ROUND_UNIT'\n"); return GNUNET_SYSERR; } } -- cgit v1.2.3