summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-06-05 23:38:43 +0200
committerChristian Grothoff <christian@grothoff.org>2022-06-05 23:38:43 +0200
commit41eb57c7252bd14794502a7164acb5794df1a3ae (patch)
treec2cbf6e1e371140baea3b53cef4ae6f7327e24d6 /src
parentf6c0d6bd370e97c228ce0f9744341181c009da9c (diff)
downloadmerchant-41eb57c7252bd14794502a7164acb5794df1a3ae.tar.gz
merchant-41eb57c7252bd14794502a7164acb5794df1a3ae.tar.bz2
merchant-41eb57c7252bd14794502a7164acb5794df1a3ae.zip
-work around FTBFS
Diffstat (limited to 'src')
-rw-r--r--src/lib/merchant_api_post_order_pay.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/src/lib/merchant_api_post_order_pay.c b/src/lib/merchant_api_post_order_pay.c
index c246a1d4..bd6fca6f 100644
--- a/src/lib/merchant_api_post_order_pay.c
+++ b/src/lib/merchant_api_post_order_pay.c
@@ -106,29 +106,41 @@ struct TALER_MERCHANT_OrderPayHandle
/**
* We got a 409 response back from the exchange (or the merchant).
- * Now we need to check the provided cryptograophic proof that the
+ * Now we need to check the provided cryptographic proof that the
* coin was actually already spent!
*
* @param pc handle of the original coin we paid with
- * @param json cryptograophic proof of coin's transaction
+ * @param json cryptographic proof of coin's transaction
* history as was returned by the exchange/merchant
* @return #GNUNET_OK if proof checks out
*/
-static int
+static enum GNUNET_GenericReturnValue
check_coin_history (const struct TALER_MERCHANT_PaidCoin *pc,
json_t *json)
{
+#if FIXME
struct TALER_Amount spent;
struct TALER_Amount spent_plus_contrib;
- struct TALER_DenominationHashP h_denom_pub;
struct TALER_DenominationHashP h_denom_pub_pc;
-
+ const struct TALER_EXCHANGE_DenomPublicKey *dpk;
+ const struct TALER_EXCHANGE_Keys *keys;
+ struct TALER_EXCHANGE_Handle *exchange;
+
+ exchange = TALER_EXCHANGE_connect (ctx,
+ pc->exchange_url,
+ &cert_cb,
+ ctx,
+ TALER_EXCHANGE_OPTION_END);
+ keys = TALER_EXCHANGE_get_keys (exchange);
+ TALER_denom_pub_hash (&pc->denom_pub,
+ &h_denom_pub_pc);
+ dpk = TALER_EXCHANGE_get_denomination_key_by_hash (
+ keys,
+ &h_denom_pub_pc);
if (GNUNET_OK !=
- TALER_EXCHANGE_verify_coin_history (NULL, /* do not verify fees */
- pc->amount_with_fee.currency,
+ TALER_EXCHANGE_verify_coin_history (dpk,
&pc->coin_pub,
json,
- &h_denom_pub,
&spent))
{
/* Exchange's history fails to verify */
@@ -144,12 +156,8 @@ check_coin_history (const struct TALER_MERCHANT_PaidCoin *pc,
GNUNET_break (0);
return GNUNET_SYSERR;
}
- TALER_denom_pub_hash (&pc->denom_pub,
- &h_denom_pub_pc);
- if ( (-1 != TALER_amount_cmp (&pc->denom_value,
- &spent_plus_contrib)) &&
- (0 != GNUNET_memcmp (&h_denom_pub,
- &h_denom_pub_pc)) )
+ if (-1 != TALER_amount_cmp (&pc->denom_value,
+ &spent_plus_contrib))
{
/* according to our calculations, the transaction should
have still worked, AND we did not get any proof of
@@ -157,6 +165,7 @@ check_coin_history (const struct TALER_MERCHANT_PaidCoin *pc,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
+#endif
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Accepting proof of double-spending (or coin public key re-use)\n");
return GNUNET_OK;
@@ -211,11 +220,11 @@ check_conflict (struct TALER_MERCHANT_OrderPayHandle *oph,
for (unsigned int i = 0; i<oph->num_coins; i++)
{
- if (0 == memcmp (&oph->coins[i].coin_pub,
- &coin_pub,
- sizeof (struct TALER_CoinSpendPublicKeyP)))
+ if (0 ==
+ GNUNET_memcmp (&oph->coins[i].coin_pub,
+ &coin_pub))
{
- int ret;
+ enum GNUNET_GenericReturnValue ret;
ret = check_coin_history (&oph->coins[i],
history);
@@ -432,6 +441,7 @@ TALER_MERCHANT_order_pay_frontend (
return NULL;
}
j_coins = json_array ();
+ GNUNET_assert (NULL != j_coins);
for (unsigned int i = 0; i<num_coins; i++)
{
json_t *j_coin;