swap dimensions as per protocol spec

This commit is contained in:
Christian Grothoff 2015-08-14 15:19:50 +02:00
parent 6173324cd9
commit c21da52b68
3 changed files with 23 additions and 12 deletions

View File

@ -1951,19 +1951,19 @@ TALER_MINT_refresh_reveal (struct TALER_MINT_Handle *mint,
/* build array of transfer private keys */
transfer_privs = json_array ();
for (i=0;i<md->num_melted_coins;i++)
for (j=0;j<TALER_CNC_KAPPA;j++)
{
const struct MeltedCoin *mc = &md->melted_coins[i];
tmp = json_array ();
for (j=0;j<TALER_CNC_KAPPA;j++)
if (j == noreveal_index)
{
if (j == noreveal_index)
{
/* This is crucial: exclude the transfer key for the
noreval index! */
continue;
}
/* This is crucial: exclude the transfer key for the
noreval index! */
continue;
}
tmp = json_array ();
for (i=0;i<md->num_melted_coins;i++)
{
const struct MeltedCoin *mc = &md->melted_coins[i];
json_array_append (tmp,
TALER_json_from_data (&mc->transfer_priv[j],
sizeof (struct TALER_TransferPrivateKeyP)));

View File

@ -684,6 +684,7 @@ withdraw_status_cb (void *cls,
http_status,
cmd->label);
GNUNET_break (0);
json_dumpf (json, stderr, 0);
fail (is);
return;
}
@ -792,6 +793,7 @@ withdraw_sign_cb (void *cls,
"Unexpected response code %u to command %s\n",
http_status,
cmd->label);
json_dumpf (full_response, stderr, 0);
GNUNET_break (0);
fail (is);
return;
@ -846,6 +848,7 @@ deposit_cb (void *cls,
"Unexpected response code %u to command %s\n",
http_status,
cmd->label);
json_dumpf (obj, stderr, 0);
fail (is);
return;
}
@ -881,6 +884,7 @@ melt_cb (void *cls,
"Unexpected response code %u to command %s\n",
http_status,
cmd->label);
json_dumpf (full_response, stderr, 0);
fail (is);
return;
}
@ -922,6 +926,7 @@ reveal_cb (void *cls,
"Unexpected response code %u to command %s\n",
http_status,
cmd->label);
json_dumpf (full_response, stderr, 0);
fail (is);
return;
}
@ -987,6 +992,7 @@ link_cb (void *cls,
"Unexpected response code %u to command %s\n",
http_status,
cmd->label);
json_dumpf (full_response, stderr, 0);
fail (is);
return;
}

View File

@ -794,6 +794,7 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
TMH_PARSE_JNC_RET_DATA,
&transfer_privs[i][j],
sizeof (struct TALER_TransferPrivateKeyP));
GNUNET_break_op (GNUNET_OK == res);
}
}
if (GNUNET_OK != res)
@ -859,13 +860,16 @@ TMH_REFRESH_handler_refresh_reveal (struct TMH_RequestHandler *rh,
spec);
json_decref (root);
if (GNUNET_OK != res)
{
GNUNET_break_op (0);
return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES;
}
/* Determine dimensionality of the request (kappa and #old coins) */
/* Note we do +1 as 1 row (cut-and-choose!) is missing! */
if (TALER_CNC_KAPPA != json_array_size (transfer_privs) + 1)
{
TMH_PARSE_release_data (spec);
GNUNET_break_op (0);
return TMH_RESPONSE_reply_arg_invalid (connection,
"transfer_privs");
}
@ -878,6 +882,7 @@ TMH_REFRESH_handler_refresh_reveal (struct TMH_RequestHandler *rh,
if (GNUNET_OK != res)
{
TMH_PARSE_release_data (spec);
GNUNET_break_op (0);
return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES;
}
num_oldcoins = json_array_size (reveal_detail);