tolerate recoup information not being present

This commit is contained in:
Christian Grothoff 2020-03-10 15:34:04 +01:00
parent fc79dd233a
commit 883c063f43
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -1045,35 +1045,37 @@ decode_keys_json (const json_t *resp_obj,
json_t *recoup_info; json_t *recoup_info;
unsigned int index; unsigned int index;
EXITIF (NULL == (recoup_array = if (NULL != (recoup_array =
json_object_get (resp_obj, json_object_get (resp_obj,
"recoup"))); "recoup")))
EXITIF (JSON_ARRAY != json_typeof (recoup_array)); {
EXITIF (JSON_ARRAY != json_typeof (recoup_array));
json_array_foreach (recoup_array, index, recoup_info) { json_array_foreach (recoup_array, index, recoup_info) {
struct GNUNET_HashCode h_denom_pub; struct GNUNET_HashCode h_denom_pub;
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("h_denom_pub", GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
&h_denom_pub), &h_denom_pub),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
EXITIF (GNUNET_OK != EXITIF (GNUNET_OK !=
GNUNET_JSON_parse (recoup_info, GNUNET_JSON_parse (recoup_info,
spec, spec,
NULL, NULL)); NULL, NULL));
for (unsigned int j = 0; for (unsigned int j = 0;
j<key_data->num_denom_keys; j<key_data->num_denom_keys;
j++) j++)
{
if (0 == GNUNET_memcmp (&h_denom_pub,
&key_data->denom_keys[j].h_key))
{ {
key_data->denom_keys[j].revoked = GNUNET_YES; if (0 == GNUNET_memcmp (&h_denom_pub,
break; &key_data->denom_keys[j].h_key))
{
key_data->denom_keys[j].revoked = GNUNET_YES;
break;
}
} }
} };
}; }
} }
if (check_sig) if (check_sig)