WIP: added duplicate planchet check for age-withdraw_reveal

This commit is contained in:
Özgür Kesim 2023-04-17 17:26:06 +02:00
parent 3c54813e08
commit 6da7dd379e
Signed by: oec
GPG Key ID: 3D76A56D79EDD9D7

View File

@ -253,6 +253,22 @@ parse_age_withdraw_reveal_json (
msg); msg);
goto EXIT; 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 */ /* Parse diclosed keys */
@ -331,17 +347,8 @@ find_original_commitment (
NULL); NULL);
break; 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: default:
GNUNET_break (0); /* should be impossible */ GNUNET_break (0);
*result = TALER_MHD_reply_with_error (connection, *result = TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR, MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE,
@ -806,12 +813,10 @@ finalize_withdraw_and_sign (
/* First, sign the keys */ /* First, sign the keys */
{ {
enum TALER_ErrorCode ec; enum TALER_ErrorCode ec;
ec = TEH_keys_denomination_batch_sign ( ec = TEH_keys_denomination_batch_sign (csds,
csds,
num_coins, num_coins,
false, false,
bss); bss);
if (TALER_EC_NONE != ec) if (TALER_EC_NONE != ec)
{ {
GNUNET_break (0); GNUNET_break (0);