adapt code to match (updated) spec

This commit is contained in:
Christian Grothoff 2015-08-14 22:42:19 +02:00
parent 3d1627daa7
commit a8f65175f4
3 changed files with 30 additions and 11 deletions

View File

@ -1718,19 +1718,31 @@ struct TALER_MINT_RefreshRevealHandle
* to the application via the callback.
*
* @param rrh operation handle
* @param jsona reply from the mint
* @param json reply from the mint
* @param[out] coin_privs array of length `num_fresh_coins`, initialized to contain private keys
* @param[out] sigs array of length `num_fresh_coins`, initialized to cointain RSA signatures
* @return #GNUNET_OK on success, #GNUNET_SYSERR on errors
*/
static int
refresh_reveal_ok (struct TALER_MINT_RefreshRevealHandle *rrh,
json_t *jsona,
json_t *json,
struct TALER_CoinSpendPrivateKeyP *coin_privs,
struct TALER_DenominationSignature *sigs)
{
unsigned int i;
json_t *jsona;
struct MAJ_Specification spec[] = {
MAJ_spec_json ("ev_sigs", &jsona),
MAJ_spec_end
};
if (GNUNET_OK !=
MAJ_parse_json (json,
spec))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
if (! json_is_array (jsona))
{
/* We expected an array of coins */
@ -1747,7 +1759,7 @@ refresh_reveal_ok (struct TALER_MINT_RefreshRevealHandle *rrh,
{
const struct FreshCoin *fc;
struct TALER_DenominationPublicKey *pk;
json_t *json;
json_t *jsonai;
struct GNUNET_CRYPTO_rsa_Signature *blind_sig;
struct GNUNET_CRYPTO_rsa_Signature *sig;
struct TALER_CoinSpendPublicKeyP coin_pub;
@ -1760,11 +1772,11 @@ refresh_reveal_ok (struct TALER_MINT_RefreshRevealHandle *rrh,
fc = &rrh->md->fresh_coins[rrh->noreveal_index][i];
pk = &rrh->md->fresh_pks[i];
json = json_array_get (jsona, i);
GNUNET_assert (NULL != json);
jsonai = json_array_get (jsona, i);
GNUNET_assert (NULL != jsonai);
if (GNUNET_OK !=
MAJ_parse_json (json,
MAJ_parse_json (jsonai,
spec))
{
GNUNET_break_op (0);

View File

@ -2019,7 +2019,7 @@ run (void *cls,
GNUNET_assert (NULL != mint);
shutdown_task
= GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 5),
(GNUNET_TIME_UNIT_SECONDS, 30),
&do_shutdown, is);
}

View File

@ -783,17 +783,24 @@ TMH_RESPONSE_reply_refresh_reveal_success (struct MHD_Connection *connection,
{
int newcoin_index;
json_t *root;
json_t *obj;
json_t *list;
int ret;
root = json_object ();
list = json_array ();
for (newcoin_index = 0; newcoin_index < num_newcoins; newcoin_index++)
{
obj = json_object ();
json_object_set_new (obj,
"ev_sig",
TALER_json_from_rsa_signature (sigs[newcoin_index].rsa_signature));
json_array_append_new (list,
obj);
}
root = json_object ();
json_object_set_new (root,
"ev_sigs",
list);
for (newcoin_index = 0; newcoin_index < num_newcoins; newcoin_index++)
json_array_append_new (list,
TALER_json_from_rsa_signature (sigs[newcoin_index].rsa_signature));
ret = TMH_RESPONSE_reply_json (connection,
root,
MHD_HTTP_OK);