diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-05-11 19:17:09 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-05-11 19:17:09 +0200 |
commit | 5f268913ddfac25f8d16c3216bba23535e2bd798 (patch) | |
tree | a40f39e33122bc24b5412460880884a626a930b1 /src/json | |
parent | 684a2342645f3b44b823a907f0309eb4fcfba50b (diff) | |
download | exchange-5f268913ddfac25f8d16c3216bba23535e2bd798.tar.xz |
return NO if forgetting did not work because it was already forgotten earlier
Diffstat (limited to 'src/json')
-rw-r--r-- | src/json/json.c | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/src/json/json.c b/src/json/json.c index 4b91c0c52..2c3d4a2c0 100644 --- a/src/json/json.c +++ b/src/json/json.c @@ -445,6 +445,37 @@ TALER_JSON_contract_part_forget (json_t *json, field); return GNUNET_SYSERR; } + rx = json_object_get (json, + "_forgotten"); + if (NULL == rx) + { + rx = json_object (); + if (0 != + json_object_set_new (json, + "_forgotten", + rx)) + { + GNUNET_break (0); + return GNUNET_SYSERR; + } + } + if (NULL != + json_object_get (rx, + field)) + { + if (! json_is_null (json_object_get (json, + field))) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Field `%s' market as forgotten, but still exists!\n", + field); + return GNUNET_SYSERR; + } + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Already forgot field `%s'\n", + field); + return GNUNET_NO; + } salt = json_string_value (json_object_get (fg, field)); if (NULL == salt) @@ -482,20 +513,6 @@ TALER_JSON_contract_part_forget (json_t *json, return GNUNET_SYSERR; } - rx = json_object_get (json, - "_forgotten"); - if (NULL == rx) - { - rx = json_object (); - if (0 != - json_object_set_new (json, - "_forgotten", - rx)) - { - GNUNET_break (0); - return GNUNET_SYSERR; - } - } /* remember field as 'forgotten' */ if (0 != json_object_set_new (rx, |