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/lib/exchange_api_common.c | 16 ++++++++-------- src/lib/exchange_api_deposit.c | 4 ++-- src/lib/exchange_api_melt.c | 2 +- src/lib/exchange_api_refresh_common.c | 4 ++-- src/lib/exchange_api_transfers_get.c | 6 +++--- src/lib/exchange_api_withdraw.c | 4 ++-- 6 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/lib') diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c index d441807aa..07f5e1873 100644 --- a/src/lib/exchange_api_common.c +++ b/src/lib/exchange_api_common.c @@ -117,7 +117,7 @@ TALER_EXCHANGE_parse_reserve_history ( }; rh->type = TALER_EXCHANGE_RTT_CREDIT; - if (GNUNET_OK != + if (0 > TALER_amount_add (&total_in, &total_in, &amount)) @@ -233,7 +233,7 @@ TALER_EXCHANGE_parse_reserve_history ( } uuid_off++; - if (GNUNET_OK != + if (0 > TALER_amount_add (&total_out, &total_out, &amount)) @@ -301,7 +301,7 @@ TALER_EXCHANGE_parse_reserve_history ( GNUNET_break_op (0); return GNUNET_SYSERR; } - if (GNUNET_OK != + if (0 > TALER_amount_add (&total_in, &total_in, &rh->amount)) @@ -378,7 +378,7 @@ TALER_EXCHANGE_parse_reserve_history ( GNUNET_break_op (0); return GNUNET_SYSERR; } - if (GNUNET_OK != + if (0 > TALER_amount_add (&total_out, &total_out, &rh->amount)) @@ -398,7 +398,7 @@ TALER_EXCHANGE_parse_reserve_history ( } /* check balance = total_in - total_out < withdraw-amount */ - if (GNUNET_SYSERR == + if (0 > TALER_amount_subtract (balance, &total_in, &total_out)) @@ -750,7 +750,7 @@ TALER_EXCHANGE_verify_coin_history ( if (GNUNET_YES == add) { /* This amount should be added to the total */ - if (GNUNET_OK != + if (0 > TALER_amount_add (total, total, &amount)) @@ -768,7 +768,7 @@ TALER_EXCHANGE_verify_coin_history ( these negative amounts, as we might get refunds before deposits from a semi-evil exchange. Then, at the end, we do the subtraction by calculating "total = total - rtotal" */GNUNET_assert (GNUNET_NO == add); - if (GNUNET_OK != + if (0 > TALER_amount_add (&rtotal, &rtotal, &amount)) @@ -781,7 +781,7 @@ TALER_EXCHANGE_verify_coin_history ( } /* Finally, subtract 'rtotal' from total to handle the subtractions */ - if (GNUNET_OK != + if (0 > TALER_amount_subtract (total, total, &rtotal)) diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c index 38f15246c..3c06bbe39 100644 --- a/src/lib/exchange_api_deposit.c +++ b/src/lib/exchange_api_deposit.c @@ -263,7 +263,7 @@ verify_deposit_signature_forbidden ( GNUNET_break_op (0); return GNUNET_SYSERR; } - if (GNUNET_OK != + if (0 > TALER_amount_add (&total, &total, &dh->amount_with_fee)) @@ -586,7 +586,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, GNUNET_break (0); return NULL; } - if (GNUNET_SYSERR == + if (0 > TALER_amount_subtract (&amount_without_fee, amount, &dki->fee_deposit)) diff --git a/src/lib/exchange_api_melt.c b/src/lib/exchange_api_melt.c index 0217757b0..f89036e40 100644 --- a/src/lib/exchange_api_melt.c +++ b/src/lib/exchange_api_melt.c @@ -227,7 +227,7 @@ verify_melt_signature_conflict (struct TALER_EXCHANGE_MeltHandle *mh, json_decref (history); /* check if melt operation was really too expensive given history */ - if (GNUNET_OK != + if (0 > TALER_amount_add (&total, &total, &melt_value_with_fee)) diff --git a/src/lib/exchange_api_refresh_common.c b/src/lib/exchange_api_refresh_common.c index f0468dc8c..92217c5e8 100644 --- a/src/lib/exchange_api_refresh_common.c +++ b/src/lib/exchange_api_refresh_common.c @@ -536,11 +536,11 @@ TALER_EXCHANGE_refresh_prepare ( { md.fresh_pks[i].rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup (fresh_pks[i].key.rsa_public_key); - if ( (GNUNET_OK != + if ( (0 > TALER_amount_add (&total, &total, &fresh_pks[i].value)) || - (GNUNET_OK != + (0 > TALER_amount_add (&total, &total, &fresh_pks[i].fee_withdraw)) ) diff --git a/src/lib/exchange_api_transfers_get.c b/src/lib/exchange_api_transfers_get.c index aa4abfa5d..552536958 100644 --- a/src/lib/exchange_api_transfers_get.c +++ b/src/lib/exchange_api_transfers_get.c @@ -165,11 +165,11 @@ check_transfers_get_response_ok ( &detail->coin_value); TALER_amount_hton (&dd.deposit_fee, &detail->coin_fee); - if ( (GNUNET_OK != + if ( (0 > TALER_amount_add (&total_expected, &total_expected, &detail->coin_value)) || - (GNUNET_OK != + (0 > TALER_amount_subtract (&total_expected, &total_expected, &detail->coin_fee)) ) @@ -216,7 +216,7 @@ check_transfers_get_response_ok ( return GNUNET_SYSERR; } - if (GNUNET_OK != + if (0 > TALER_amount_subtract (&total_expected, &total_expected, &wire_fee)) diff --git a/src/lib/exchange_api_withdraw.c b/src/lib/exchange_api_withdraw.c index c72454e2c..6258053bb 100644 --- a/src/lib/exchange_api_withdraw.c +++ b/src/lib/exchange_api_withdraw.c @@ -242,7 +242,7 @@ reserve_withdraw_payment_required ( return GNUNET_SYSERR; } /* Compute how much we expected to charge to the reserve */ - if (GNUNET_OK != + if (0 > TALER_amount_add (&requested_amount, &wh->pk.value, &wh->pk.fee_withdraw)) @@ -515,7 +515,7 @@ TALER_EXCHANGE_withdraw ( &req.reserve_pub.eddsa_pub); req.purpose.size = htonl (sizeof (struct TALER_WithdrawRequestPS)); req.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW); - if (GNUNET_OK != + if (0 > TALER_amount_add (&amount_with_fee, &pk->fee_withdraw, &pk->value)) -- cgit v1.2.3