export transaction history check function

This commit is contained in:
Christian Grothoff 2016-05-05 14:43:13 +02:00
parent 48863ce935
commit 6b1f4904ef
5 changed files with 21 additions and 4 deletions

View File

@ -37,7 +37,7 @@
* @return #GNUNET_OK if @a history is valid, #GNUNET_SYSERR if not
*/
int
TALER_EXCHANGE_verify_coin_history_ (const char *currency,
TALER_EXCHANGE_verify_coin_history (const char *currency,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
json_t *history,
struct TALER_Amount *total)

View File

@ -33,7 +33,7 @@
* @return #GNUNET_OK if @a history is valid, #GNUNET_SYSERR if not
*/
int
TALER_EXCHANGE_verify_coin_history_ (const char *currency,
TALER_EXCHANGE_verify_coin_history (const char *currency,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
json_t *history,
struct TALER_Amount *total);

View File

@ -156,7 +156,7 @@ verify_deposit_signature_forbidden (const struct TALER_EXCHANGE_DepositHandle *d
history = json_object_get (json,
"history");
if (GNUNET_OK !=
TALER_EXCHANGE_verify_coin_history_ (dh->coin_value.currency,
TALER_EXCHANGE_verify_coin_history (dh->coin_value.currency,
&dh->depconf.coin_pub,
history,
&total))

View File

@ -1220,7 +1220,7 @@ verify_refresh_melt_signature_forbidden (struct TALER_EXCHANGE_RefreshMeltHandle
history = json_object_get (json,
"history");
if (GNUNET_OK !=
TALER_EXCHANGE_verify_coin_history_ (original_value.currency,
TALER_EXCHANGE_verify_coin_history (original_value.currency,
&coin_pub,
history,
&total))

View File

@ -1212,4 +1212,21 @@ void
TALER_EXCHANGE_deposit_wtid_cancel (struct TALER_EXCHANGE_DepositWtidHandle *dwh);
/**
* Convenience function. Verifies a coin's transaction history as
* returned by the exchange.
*
* @param currency expected currency for the coin
* @param coin_pub public key of the coin
* @param history history of the coin in json encoding
* @param[out] total how much of the coin has been spent according to @a history
* @return #GNUNET_OK if @a history is valid, #GNUNET_SYSERR if not
*/
int
TALER_EXCHANGE_verify_coin_history (const char *currency,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
json_t *history,
struct TALER_Amount *total);
#endif /* _TALER_EXCHANGE_SERVICE_H */