summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-07-11 17:01:47 +0200
committerChristian Grothoff <christian@grothoff.org>2020-07-11 17:01:47 +0200
commitd299f7e7d288309dc696962edd9ce257d2c1a926 (patch)
tree5e9e5bb8b5eab01bf57e2b20d4fd103f42495995 /src/lib
parent136e9accf6933a00cd4e59fbb2ddac8667d2be02 (diff)
downloadmerchant-d299f7e7d288309dc696962edd9ce257d2c1a926.tar.gz
merchant-d299f7e7d288309dc696962edd9ce257d2c1a926.tar.bz2
merchant-d299f7e7d288309dc696962edd9ce257d2c1a926.zip
proper handling of h_denom_pub missmatch
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/merchant_api_post_order_pay.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/lib/merchant_api_post_order_pay.c b/src/lib/merchant_api_post_order_pay.c
index 78fe3080..3675ca6d 100644
--- a/src/lib/merchant_api_post_order_pay.c
+++ b/src/lib/merchant_api_post_order_pay.c
@@ -104,7 +104,7 @@ struct TALER_MERCHANT_OrderPayHandle
/**
- * We got a 403 response back from the exchange (or the merchant).
+ * We got a 409 response back from the exchange (or the merchant).
* Now we need to check the provided cryptograophic proof that the
* coin was actually already spent!
*
@@ -143,25 +143,21 @@ check_coin_history (const struct TALER_MERCHANT_PaidCoin *pc,
GNUNET_break (0);
return GNUNET_SYSERR;
}
- if (-1 != TALER_amount_cmp (&pc->denom_value,
- &spent_plus_contrib))
- {
- /* according to our calculations, the transaction should
- have still worked, exchange error! */
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
GNUNET_CRYPTO_rsa_public_key_hash (pc->denom_pub.rsa_public_key,
&h_denom_pub_pc);
- if (0 != GNUNET_memcmp (&h_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)) )
{
- /* Hash of denom pub doesn't match. */
- GNUNET_break (0);
+ /* according to our calculations, the transaction should
+ have still worked, AND we did not get any proof of
+ coin public key re-use; hence: exchange error! */
+ GNUNET_break_op (0);
return GNUNET_SYSERR;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Accepting proof of double-spending\n");
+ "Accepting proof of double-spending (or coin public key re-use)\n");
return GNUNET_OK;
}