handle payback cases when processing coin history in auditor
This commit is contained in:
parent
d1c0c0f197
commit
19c4feda56
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of TALER
|
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
|
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
|
terms of the GNU Affero Public License as published by the Free Software
|
||||||
@ -26,8 +26,6 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* KNOWN BUGS:
|
* 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
|
* - we also seem to nowhere check the denomination signatures over the coins
|
||||||
* (While as the exchange could easily falsify those, we should
|
* (While as the exchange could easily falsify those, we should
|
||||||
* probably check as otherwise insider *without* RSA private key
|
* 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;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case TALER_EXCHANGEDB_TT_PAYBACK:
|
||||||
amount_with_fee = &tl->details.payback->value;
|
amount_with_fee = &tl->details.payback->value;
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
@ -2138,6 +2147,17 @@ check_transaction_history (const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
|||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
break;
|
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' */
|
} /* for 'tl' */
|
||||||
|
|
||||||
@ -2152,7 +2172,8 @@ check_transaction_history (const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
|||||||
deposit_fee));
|
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 ==
|
if (GNUNET_SYSERR ==
|
||||||
TALER_amount_subtract (&spent,
|
TALER_amount_subtract (&spent,
|
||||||
&expenditures,
|
&expenditures,
|
||||||
@ -2294,9 +2315,15 @@ wire_transfer_information_cb (void *cls,
|
|||||||
case TALER_EXCHANGEDB_TT_REFUND:
|
case TALER_EXCHANGEDB_TT_REFUND:
|
||||||
coin = &tl->details.refund->coin;
|
coin = &tl->details.refund->coin;
|
||||||
break;
|
break;
|
||||||
|
case TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK:
|
||||||
|
coin = &tl->details.payback_refresh->coin;
|
||||||
|
break;
|
||||||
case TALER_EXCHANGEDB_TT_PAYBACK:
|
case TALER_EXCHANGEDB_TT_PAYBACK:
|
||||||
coin = &tl->details.payback->coin;
|
coin = &tl->details.payback->coin;
|
||||||
break;
|
break;
|
||||||
|
case TALER_EXCHANGEDB_TT_PAYBACK_REFRESH:
|
||||||
|
coin = &tl->details.payback_refresh->coin;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
GNUNET_assert (NULL != coin); /* hard check that switch worked */
|
GNUNET_assert (NULL != coin); /* hard check that switch worked */
|
||||||
qs = get_denomination_info_by_hash (&coin->denom_pub_hash,
|
qs = get_denomination_info_by_hash (&coin->denom_pub_hash,
|
||||||
|
Loading…
Reference in New Issue
Block a user