From 446761b6029298410000181697abef5dbdbd4b57 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 7 Jun 2022 16:57:12 +0200 Subject: -more minor bugfixes --- src/lib/exchange_api_refund.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'src/lib/exchange_api_refund.c') diff --git a/src/lib/exchange_api_refund.c b/src/lib/exchange_api_refund.c index 09a21883d..b1cd7c843 100644 --- a/src/lib/exchange_api_refund.c +++ b/src/lib/exchange_api_refund.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014-2021 Taler Systems SA + Copyright (C) 2014-2022 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -445,17 +445,30 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh, { rtotal = rh->refund_amount; } - if (-1 == TALER_amount_cmp (&dtotal, + if ( (have_refund) && (! have_deposit) ) + { + GNUNET_break (0); + GNUNET_JSON_parse_free (spec); + return GNUNET_SYSERR; + } + if (! (have_refund && have_deposit)) + { + /* need both for a refund-deposit conflict proof */ + GNUNET_break (0); + GNUNET_JSON_parse_free (spec); + return GNUNET_SYSERR; + } + if (-1 != TALER_amount_cmp (&dtotal, &rtotal)) { - /* dtotal < rtotal: good! */ + /* rtotal <= dtotal is fine, no conflict! */ + GNUNET_break_op (0); GNUNET_JSON_parse_free (spec); - return GNUNET_OK; + return GNUNET_SYSERR; } - /* this fails to prove a conflict */ - GNUNET_break_op (0); + /* dtotal < rtotal: that's a conflict! */ GNUNET_JSON_parse_free (spec); - return GNUNET_SYSERR; + return GNUNET_OK; } -- cgit v1.2.3