aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-05-05 14:43:13 +0200
committerChristian Grothoff <christian@grothoff.org>2016-05-05 14:43:13 +0200
commit6b1f4904ef011760f2a5c30698ab62652594fa6c (patch)
tree4d1f8d363d98b05b86d0f479d77dc1759811964d
parent48863ce93578ea656fe5342f0f4da1bd2bab8139 (diff)
export transaction history check function
-rw-r--r--src/exchange-lib/exchange_api_common.c2
-rw-r--r--src/exchange-lib/exchange_api_common.h2
-rw-r--r--src/exchange-lib/exchange_api_deposit.c2
-rw-r--r--src/exchange-lib/exchange_api_refresh.c2
-rw-r--r--src/include/taler_exchange_service.h17
5 files changed, 21 insertions, 4 deletions
diff --git a/src/exchange-lib/exchange_api_common.c b/src/exchange-lib/exchange_api_common.c
index c46b69a40..15c73acca 100644
--- a/src/exchange-lib/exchange_api_common.c
+++ b/src/exchange-lib/exchange_api_common.c
@@ -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)
diff --git a/src/exchange-lib/exchange_api_common.h b/src/exchange-lib/exchange_api_common.h
index 2a521ceb2..ef808fba6 100644
--- a/src/exchange-lib/exchange_api_common.h
+++ b/src/exchange-lib/exchange_api_common.h
@@ -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);
diff --git a/src/exchange-lib/exchange_api_deposit.c b/src/exchange-lib/exchange_api_deposit.c
index 0dc036379..871787729 100644
--- a/src/exchange-lib/exchange_api_deposit.c
+++ b/src/exchange-lib/exchange_api_deposit.c
@@ -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))
diff --git a/src/exchange-lib/exchange_api_refresh.c b/src/exchange-lib/exchange_api_refresh.c
index a63f03ac8..91bcca180 100644
--- a/src/exchange-lib/exchange_api_refresh.c
+++ b/src/exchange-lib/exchange_api_refresh.c
@@ -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))
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index 4fbadb79b..09cbd7868 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -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 */