From 6da7dd379e376a671f1dc6fb35f876d4e7166624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Kesim?= Date: Mon, 17 Apr 2023 17:26:06 +0200 Subject: [PATCH] WIP: added duplicate planchet check for age-withdraw_reveal --- ...taler-exchange-httpd_age-withdraw_reveal.c | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c b/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c index be1fe7c03..1bf87342f 100644 --- a/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c +++ b/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c @@ -253,6 +253,22 @@ parse_age_withdraw_reveal_json ( msg); goto EXIT; } + + /* Check for duplicate planchets */ + for (unsigned int i = 0; i < idx; i++) + { + if (0 == TALER_blinded_planchet_cmp (&actx->coin_evs[idx], + &actx->coin_evs[i])) + { + GNUNET_break_op (0); + *mhd_ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_GENERIC_PARAMETER_MALFORMED, + "duplicate planchet"); + goto EXIT; + } + + } }; /* Parse diclosed keys */ @@ -331,17 +347,8 @@ find_original_commitment ( NULL); break; - case GNUNET_DB_STATUS_HARD_ERROR: - *result = TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_FETCH_FAILED, - "get_age_withdraw_info"); - break; - - case GNUNET_DB_STATUS_SOFT_ERROR: - /* FIXME:oec: Do we queue a result in this case or retry? */ default: - GNUNET_break (0); /* should be impossible */ + GNUNET_break (0); *result = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, @@ -806,12 +813,10 @@ finalize_withdraw_and_sign ( /* First, sign the keys */ { enum TALER_ErrorCode ec; - ec = TEH_keys_denomination_batch_sign ( - csds, - num_coins, - false, - bss); - + ec = TEH_keys_denomination_batch_sign (csds, + num_coins, + false, + bss); if (TALER_EC_NONE != ec) { GNUNET_break (0);