summaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_refund.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-06-07 16:57:12 +0200
committerChristian Grothoff <christian@grothoff.org>2022-06-07 16:57:12 +0200
commit446761b6029298410000181697abef5dbdbd4b57 (patch)
tree0b750b4c34ce8f66e24f6b319fb3dcf5cb5ea221 /src/lib/exchange_api_refund.c
parentf0bcbf65862c8e44e245bda21ea078803dcd5ad0 (diff)
downloadexchange-446761b6029298410000181697abef5dbdbd4b57.tar.gz
exchange-446761b6029298410000181697abef5dbdbd4b57.tar.bz2
exchange-446761b6029298410000181697abef5dbdbd4b57.zip
-more minor bugfixes
Diffstat (limited to 'src/lib/exchange_api_refund.c')
-rw-r--r--src/lib/exchange_api_refund.c27
1 files changed, 20 insertions, 7 deletions
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;
}