From d299f7e7d288309dc696962edd9ce257d2c1a926 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 11 Jul 2020 17:01:47 +0200 Subject: proper handling of h_denom_pub missmatch --- src/lib/merchant_api_post_order_pay.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'src/lib') 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; } -- cgit v1.2.3