From 84a40be0bce66cda800de7891f758a0c69afc7fa Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 8 Apr 2020 23:52:01 +0200 Subject: fix #6170 and rest of #6164 --- src/exchange/taler-exchange-aggregator.c | 10 +++++----- src/exchange/taler-exchange-httpd_deposit.c | 4 ++-- src/exchange/taler-exchange-httpd_deposits_get.c | 2 +- src/exchange/taler-exchange-httpd_melt.c | 2 +- src/exchange/taler-exchange-httpd_recoup.c | 2 +- src/exchange/taler-exchange-httpd_refreshes_reveal.c | 4 ++-- src/exchange/taler-exchange-httpd_responses.c | 12 ++++++------ src/exchange/taler-exchange-httpd_transfers_get.c | 8 ++++---- src/exchange/taler-exchange-httpd_withdraw.c | 2 +- 9 files changed, 23 insertions(+), 23 deletions(-) (limited to 'src/exchange') diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c index da24a125d..0b98a3424 100644 --- a/src/exchange/taler-exchange-aggregator.c +++ b/src/exchange/taler-exchange-aggregator.c @@ -312,7 +312,7 @@ refund_by_coin_cb (void *cls, "Aggregator subtracts applicable refund of amount %s\n", TALER_amount2s (amount_with_fee)); aux->have_refund = GNUNET_YES; - if (GNUNET_SYSERR == + if (0 > TALER_amount_subtract (&aux->total_amount, &aux->total_amount, amount_with_fee)) @@ -385,7 +385,7 @@ deposit_cb (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Non-refunded transaction, subtracting deposit fee %s\n", TALER_amount2s (deposit_fee)); - if (GNUNET_SYSERR == + if (0 > TALER_amount_subtract (&ntotal, amount_with_fee, deposit_fee)) @@ -571,7 +571,7 @@ aggregate_cb (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Subtracting deposit fee %s for non-refunded coin\n", TALER_amount2s (deposit_fee)); - if (GNUNET_SYSERR == + if (0 > TALER_amount_subtract (&tmp, &au->total_amount, deposit_fee)) @@ -595,7 +595,7 @@ aggregate_cb (void *cls, { struct TALER_Amount tmp; - if (GNUNET_OK != + if (0 > TALER_amount_add (&tmp, &au->total_amount, &old)) @@ -782,7 +782,7 @@ run_aggregation (void *cls) /* Subtract wire transfer fee and round to the unit supported by the wire transfer method; Check if after rounding down, we still have an amount to transfer, and if not mark as 'tiny'. */ - if ( (GNUNET_OK != + if ( (0 >= TALER_amount_subtract (&au_active.final_amount, &au_active.total_amount, &au_active.wire_fee)) || diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c index ac854de68..d34391659 100644 --- a/src/exchange/taler-exchange-httpd_deposit.c +++ b/src/exchange/taler-exchange-httpd_deposit.c @@ -162,7 +162,7 @@ deposit_transaction (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "/deposit replay, accepting again!\n"); - GNUNET_assert (GNUNET_OK == + GNUNET_assert (0 <= TALER_amount_subtract (&amount_without_fee, &deposit->amount_with_fee, &deposit->deposit_fee)); @@ -543,7 +543,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, struct TALER_Amount amount_without_fee; int res; - GNUNET_assert (GNUNET_SYSERR != + GNUNET_assert (0 <= TALER_amount_subtract (&amount_without_fee, &deposit.amount_with_fee, &deposit.deposit_fee)); diff --git a/src/exchange/taler-exchange-httpd_deposits_get.c b/src/exchange/taler-exchange-httpd_deposits_get.c index f2b364caa..04d24f496 100644 --- a/src/exchange/taler-exchange-httpd_deposits_get.c +++ b/src/exchange/taler-exchange-httpd_deposits_get.c @@ -176,7 +176,7 @@ handle_wtid_data (void *cls, ctx->execution_time = execution_time; return; } - if (GNUNET_SYSERR == + if (0 > TALER_amount_subtract (&ctx->coin_delta, coin_contribution, coin_fee)) diff --git a/src/exchange/taler-exchange-httpd_melt.c b/src/exchange/taler-exchange-httpd_melt.c index fab0f106b..c08c97732 100644 --- a/src/exchange/taler-exchange-httpd_melt.c +++ b/src/exchange/taler-exchange-httpd_melt.c @@ -249,7 +249,7 @@ refresh_check_melt (struct MHD_Connection *connection, { struct TALER_Amount coin_residual; - GNUNET_assert (GNUNET_SYSERR != + GNUNET_assert (0 <= TALER_amount_subtract (&coin_residual, &spent, &rmc->refresh_session.amount_with_fee)); diff --git a/src/exchange/taler-exchange-httpd_recoup.c b/src/exchange/taler-exchange-httpd_recoup.c index ccb75622e..a3014e786 100644 --- a/src/exchange/taler-exchange-httpd_recoup.c +++ b/src/exchange/taler-exchange-httpd_recoup.c @@ -242,7 +242,7 @@ recoup_transaction (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Recoup: coin value %s\n", TALER_amount2s (&pc->value)); - if (GNUNET_SYSERR == + if (0 > TALER_amount_subtract (&pc->amount, &pc->value, &spent)) diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c index 5b6ca2d32..da1b3eb94 100644 --- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c +++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c @@ -436,11 +436,11 @@ refreshes_reveal_transaction (void *cls, &rctx->dkis[i]->issue.properties.fee_withdraw); TALER_amount_ntoh (&value, &rctx->dkis[i]->issue.properties.value); - if ( (GNUNET_OK != + if ( (0 > TALER_amount_add (&total, &fee_withdraw, &value)) || - (GNUNET_OK != + (0 > TALER_amount_add (&refresh_cost, &refresh_cost, &total)) ) diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c index 4ddd9cd89..3870db14c 100644 --- a/src/exchange/taler-exchange-httpd_responses.c +++ b/src/exchange/taler-exchange-httpd_responses.c @@ -200,7 +200,7 @@ TEH_RESPONSE_compile_transaction_history ( return NULL; } #endif - if (GNUNET_OK != + if (0 > TALER_amount_subtract (&value, &refund->refund_amount, &refund->refund_fee)) @@ -481,7 +481,7 @@ TEH_RESPONSE_compile_reserve_history ( credit_total = bank->amount; init |= IA_CREDIT; } - else if (GNUNET_OK != + else if (0 > TALER_amount_add (&credit_total, &credit_total, &bank->amount)) @@ -526,7 +526,7 @@ TEH_RESPONSE_compile_reserve_history ( } else { - if (GNUNET_OK != + if (0 > TALER_amount_add (&withdraw_total, &withdraw_total, &value)) @@ -572,7 +572,7 @@ TEH_RESPONSE_compile_reserve_history ( credit_total = recoup->value; init |= IA_CREDIT; } - else if (GNUNET_OK != + else if (0 > TALER_amount_add (&credit_total, &credit_total, &recoup->value)) @@ -642,7 +642,7 @@ TEH_RESPONSE_compile_reserve_history ( } else { - if (GNUNET_OK != + if (0 > TALER_amount_add (&withdraw_total, &withdraw_total, &value)) @@ -724,7 +724,7 @@ TEH_RESPONSE_compile_reserve_history ( TALER_amount_get_zero (credit_total.currency, &withdraw_total)); } - if (GNUNET_SYSERR == + if (0 > TALER_amount_subtract (balance, &credit_total, &withdraw_total)) diff --git a/src/exchange/taler-exchange-httpd_transfers_get.c b/src/exchange/taler-exchange-httpd_transfers_get.c index 4cc855d7e..2aa9a5c9c 100644 --- a/src/exchange/taler-exchange-httpd_transfers_get.c +++ b/src/exchange/taler-exchange-httpd_transfers_get.c @@ -314,7 +314,7 @@ handle_deposit_data (void *cls, ctx->exec_time = exec_time; ctx->wire_method = wire_method; /* captures the reference */ ctx->is_valid = GNUNET_YES; - if (GNUNET_OK != + if (0 > TALER_amount_subtract (&ctx->total, deposit_value, deposit_fee)) @@ -343,7 +343,7 @@ handle_deposit_data (void *cls, return; } GNUNET_free (wire_method); - if (GNUNET_OK != + if (0 > TALER_amount_subtract (&delta, deposit_value, deposit_fee)) @@ -352,7 +352,7 @@ handle_deposit_data (void *cls, ctx->is_valid = GNUNET_SYSERR; return; } - if (GNUNET_OK != + if (0 > TALER_amount_add (&ctx->total, &ctx->total, &delta)) @@ -489,7 +489,7 @@ get_transfer_deposits (void *cls, } return qs; } - if (GNUNET_OK != + if (0 > TALER_amount_subtract (&ctx->total, &ctx->total, &ctx->wire_fee)) diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c index 58ef97bae..152ebfbb0 100644 --- a/src/exchange/taler-exchange-httpd_withdraw.c +++ b/src/exchange/taler-exchange-httpd_withdraw.c @@ -422,7 +422,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh, &wc.dki->issue.properties.value); TALER_amount_ntoh (&fee_withdraw, &wc.dki->issue.properties.fee_withdraw); - if (GNUNET_OK != + if (0 > TALER_amount_add (&wc.amount_required, &amount, &fee_withdraw)) -- cgit v1.2.3