gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: return NO if forgetting did not


From: gnunet
Subject: [taler-exchange] branch master updated: return NO if forgetting did not work because it was already forgotten earlier
Date: Tue, 11 May 2021 19:17:11 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 5f268913 return NO if forgetting did not work because it was already 
forgotten earlier
5f268913 is described below

commit 5f268913ddfac25f8d16c3216bba23535e2bd798
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue May 11 19:17:09 2021 +0200

    return NO if forgetting did not work because it was already forgotten 
earlier
---
 src/include/taler_json_lib.h |  4 +++-
 src/json/json.c              | 45 ++++++++++++++++++++++++++++++--------------
 2 files changed, 34 insertions(+), 15 deletions(-)

diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h
index f61e2c0f..bf8c2217 100644
--- a/src/include/taler_json_lib.h
+++ b/src/include/taler_json_lib.h
@@ -215,7 +215,9 @@ TALER_JSON_contract_mark_forgettable (json_t *json,
  *
  * @param[in,out] json some JSON object to modify
  * @param field name of the field to forget
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success,
+ *         #GNUNET_NO if the field was already forgotten before
+ *         #GNUNET_SYSERR on error
  */
 int
 TALER_JSON_contract_part_forget (json_t *json,
diff --git a/src/json/json.c b/src/json/json.c
index 4b91c0c5..2c3d4a2c 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,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]