From 41780a7f4ad1e4d68c57ca10f6521b89156772d6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 9 Nov 2023 22:27:20 +0100 Subject: add support for purse deposits in coin history checking --- src/lib/exchange_api_coins_history.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/lib/exchange_api_coins_history.c') diff --git a/src/lib/exchange_api_coins_history.c b/src/lib/exchange_api_coins_history.c index b74e1a9b0..875a5b57b 100644 --- a/src/lib/exchange_api_coins_history.c +++ b/src/lib/exchange_api_coins_history.c @@ -802,11 +802,10 @@ TALER_EXCHANGE_parse_coin_history ( json_t *transaction = json_array_get (history, off); enum GNUNET_GenericReturnValue add; - struct TALER_Amount amount; const char *type; struct GNUNET_JSON_Specification spec_glob[] = { TALER_JSON_spec_amount_any ("amount", - &amount), + &rh->amount), GNUNET_JSON_spec_string ("type", &type), GNUNET_JSON_spec_end () @@ -821,7 +820,7 @@ TALER_EXCHANGE_parse_coin_history ( return GNUNET_SYSERR; } if (GNUNET_YES != - TALER_amount_cmp_currency (&amount, + TALER_amount_cmp_currency (&rh->amount, total_in)) { GNUNET_break_op (0); @@ -830,7 +829,7 @@ TALER_EXCHANGE_parse_coin_history ( GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Operation of type %s with amount %s\n", type, - TALER_amount2s (&amount)); + TALER_amount2s (&rh->amount)); add = GNUNET_SYSERR; for (unsigned int i = 0; NULL != map[i].type; i++) { @@ -840,7 +839,7 @@ TALER_EXCHANGE_parse_coin_history ( rh->type = map[i].ctt; add = map[i].helper (&pc, rh, - &amount, + &rh->amount, transaction); break; } @@ -860,7 +859,7 @@ TALER_EXCHANGE_parse_coin_history ( if (0 > TALER_amount_add (total_out, total_out, - &amount)) + &rh->amount)) { /* overflow in history already!? inconceivable! Bad exchange! */ GNUNET_break_op (0); @@ -872,7 +871,7 @@ TALER_EXCHANGE_parse_coin_history ( if (0 > TALER_amount_add (total_in, total_in, - &amount)) + &rh->amount)) { /* overflow in refund history? inconceivable! Bad exchange! */ GNUNET_break_op (0); -- cgit v1.2.3