summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-07-26 22:03:15 +0200
committerChristian Grothoff <christian@grothoff.org>2019-07-26 22:03:15 +0200
commit19c4feda562ca09ecef5c79d29fae36169ea9900 (patch)
tree0692f65ce7f01744892b482a2e48e4c6f353a863 /src
parentd1c0c0f197f97d7904840757ca81e7bb7a6834f0 (diff)
downloadexchange-19c4feda562ca09ecef5c79d29fae36169ea9900.tar.gz
exchange-19c4feda562ca09ecef5c79d29fae36169ea9900.tar.bz2
exchange-19c4feda562ca09ecef5c79d29fae36169ea9900.zip
handle payback cases when processing coin history in auditor
Diffstat (limited to 'src')
-rw-r--r--src/auditor/taler-auditor.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c
index 6b46faea..a63ac8bd 100644
--- a/src/auditor/taler-auditor.c
+++ b/src/auditor/taler-auditor.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2016, 2017, 2018 Taler Systems SA
+ Copyright (C) 2016, 2017, 2018, 2019 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero Public License as published by the Free Software
@@ -26,8 +26,6 @@
*
*
* KNOWN BUGS:
- * - TT_PAYBACK cases should be checked in check_transaction_history (and
- * maybe other places?)
* - we also seem to nowhere check the denomination signatures over the coins
* (While as the exchange could easily falsify those, we should
* probably check as otherwise insider *without* RSA private key
@@ -2127,6 +2125,17 @@ check_transaction_history (const struct TALER_CoinSpendPublicKeyP *coin_pub,
return GNUNET_SYSERR;
}
break;
+ case TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK:
+ amount_with_fee = &tl->details.old_coin_payback->value;
+ if (GNUNET_OK !=
+ TALER_amount_add (&refunds,
+ &refunds,
+ amount_with_fee))
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
+ break;
case TALER_EXCHANGEDB_TT_PAYBACK:
amount_with_fee = &tl->details.payback->value;
if (GNUNET_OK !=
@@ -2138,6 +2147,17 @@ check_transaction_history (const struct TALER_CoinSpendPublicKeyP *coin_pub,
return GNUNET_SYSERR;
}
break;
+ case TALER_EXCHANGEDB_TT_PAYBACK_REFRESH:
+ amount_with_fee = &tl->details.payback_refresh->value;
+ if (GNUNET_OK !=
+ TALER_amount_add (&expenditures,
+ &expenditures,
+ amount_with_fee))
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
+ break;
}
} /* for 'tl' */
@@ -2152,7 +2172,8 @@ check_transaction_history (const struct TALER_CoinSpendPublicKeyP *coin_pub,
deposit_fee));
}
- /* Calculate total balance change, i.e. expenditures minus refunds */
+ /* Calculate total balance change, i.e. expenditures (payback, deposit, refresh)
+ minus refunds (refunds, payback-to-old) */
if (GNUNET_SYSERR ==
TALER_amount_subtract (&spent,
&expenditures,
@@ -2294,9 +2315,15 @@ wire_transfer_information_cb (void *cls,
case TALER_EXCHANGEDB_TT_REFUND:
coin = &tl->details.refund->coin;
break;
+ case TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK:
+ coin = &tl->details.payback_refresh->coin;
+ break;
case TALER_EXCHANGEDB_TT_PAYBACK:
coin = &tl->details.payback->coin;
break;
+ case TALER_EXCHANGEDB_TT_PAYBACK_REFRESH:
+ coin = &tl->details.payback_refresh->coin;
+ break;
}
GNUNET_assert (NULL != coin); /* hard check that switch worked */
qs = get_denomination_info_by_hash (&coin->denom_pub_hash,