gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated (5d50123e -> 3eebc4b1)


From: gnunet
Subject: [taler-exchange] branch master updated (5d50123e -> 3eebc4b1)
Date: Sun, 24 Dec 2023 17:09:33 +0100

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

grothoff pushed a change to branch master
in repository exchange.

    from 5d50123e -fix typo
     new 7a39d112 -fix missing RC bumps in test
     new e690e53e api update to support refactored merchant order creation
     new 3eebc4b1 Merge branch 'master' of git+ssh://git.taler.net/exchange

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/include/taler_json_lib.h                 | 14 ++++----
 src/json/json.c                              | 49 ++++++++++++++++++----------
 src/json/test_json.c                         |  3 +-
 src/testing/testing_api_cmd_batch_withdraw.c |  4 ++-
 4 files changed, 44 insertions(+), 26 deletions(-)

diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h
index 38668fdc..859ec887 100644
--- a/src/include/taler_json_lib.h
+++ b/src/include/taler_json_lib.h
@@ -581,16 +581,18 @@ TALER_JSON_contract_hash (const json_t *json,
 
 
 /**
- * Take a given contract with "forgettable" fields marked
- * but with 'True' instead of a real salt. Replaces all
- * 'True' values with proper random salts.  Fails if any
- * forgettable markers are neither 'True' nor valid salts.
+ * Take a given @a contract with "forgettable" fields marked in the @a spec
+ * with 'True' instead of a real salt. Replaces all 'True' values with proper
+ * random salts in the actual @a contract.  Fails if any forgettable markers
+ * are neither 'True' nor valid salts.
  *
- * @param[in,out] json JSON to transform
+ * @param spec specification with forgettable fields
+ * @param[in,out] contract JSON contract to transform
  * @return #GNUNET_OK on success
  */
 enum GNUNET_GenericReturnValue
-TALER_JSON_contract_seed_forgettable (json_t *json);
+TALER_JSON_contract_seed_forgettable (const json_t *spec,
+                                      json_t *contract);
 
 
 /**
diff --git a/src/json/json.c b/src/json/json.c
index fb00fb53..639bd530 100644
--- a/src/json/json.c
+++ b/src/json/json.c
@@ -533,7 +533,7 @@ TALER_JSON_contract_part_forget (json_t *json,
 
 
 /**
- * Look over all of the values of a '$forgettable' object.  Replace 'True'
+ * Loop over all of the values of a '$forgettable' object.  Replace 'True'
  * values with proper random salts.  Fails if any forgettable values are
  * neither 'True' nor valid salts (strings).
  *
@@ -578,51 +578,64 @@ seed_forgettable (json_t *f)
 }
 
 
-/**
- * Take a given contract with "forgettable" fields marked
- * but with 'True' instead of a real salt. Replaces all
- * 'True' values with proper random salts.  Fails if any
- * forgettable markers are neither 'True' nor valid salts.
- *
- * @param[in,out] json JSON to transform
- * @return #GNUNET_OK on success
- */
 enum GNUNET_GenericReturnValue
-TALER_JSON_contract_seed_forgettable (json_t *json)
+TALER_JSON_contract_seed_forgettable (const json_t *spec,
+                                      json_t *contract)
 {
-  if (json_is_object (json))
+  if (json_is_object (spec))
   {
     const char *key;
     json_t *val;
 
-    json_object_foreach (json,
+    json_object_foreach ((json_t *) spec,
                          key,
                          val)
     {
+      json_t *cval = json_object_get (contract,
+                                      key);
+
       if (0 == strcmp ("$forgettable",
                        key))
       {
+        json_t *xval = json_deep_copy (val);
+
         if (GNUNET_OK !=
-            seed_forgettable (val))
+            seed_forgettable (xval))
+        {
+          json_decref (xval);
           return GNUNET_SYSERR;
+        }
+        GNUNET_assert (0 ==
+                       json_object_set_new (contract,
+                                            "$forgettable",
+                                            xval));
         continue;
       }
+      if (NULL == cval)
+        continue;
       if (GNUNET_OK !=
-          TALER_JSON_contract_seed_forgettable (val))
+          TALER_JSON_contract_seed_forgettable (val,
+                                                cval))
         return GNUNET_SYSERR;
     }
   }
-  if (json_is_array (json))
+  if (json_is_array (spec))
   {
     size_t index;
     json_t *val;
 
-    json_array_foreach (json,
+    json_array_foreach ((json_t *) spec,
                         index,
                         val)
     {
+      json_t *ival = json_array_get (contract,
+                                     index);
+
+      if (NULL == ival)
+        continue;
       if (GNUNET_OK !=
-          TALER_JSON_contract_seed_forgettable (val))
+          TALER_JSON_contract_seed_forgettable (val,
+                                                ival))
         return GNUNET_SYSERR;
     }
   }
diff --git a/src/json/test_json.c b/src/json/test_json.c
index d37f66ea..fba72f84 100644
--- a/src/json/test_json.c
+++ b/src/json/test_json.c
@@ -103,7 +103,8 @@ test_contract (void)
                   "k2", "n1", "n2",
                   /***/ "$forgettable", "n1", true);
   GNUNET_assert (GNUNET_OK ==
-                 TALER_JSON_contract_seed_forgettable (c1));
+                 TALER_JSON_contract_seed_forgettable (c1,
+                                                       c1));
   GNUNET_assert (GNUNET_OK ==
                  TALER_JSON_contract_hash (c1,
                                            &h1));
diff --git a/src/testing/testing_api_cmd_batch_withdraw.c 
b/src/testing/testing_api_cmd_batch_withdraw.c
index 744da56c..98bbb7e2 100644
--- a/src/testing/testing_api_cmd_batch_withdraw.c
+++ b/src/testing/testing_api_cmd_batch_withdraw.c
@@ -222,7 +222,8 @@ reserve_batch_withdraw_cb (void *cls,
                                           &cs->coin_pub.eddsa_pub);
 
       cs->bks = pcd->bks;
-      cs->exchange_vals = pcd->exchange_vals;
+      TALER_denom_ewv_deep_copy (&cs->exchange_vals,
+                                 &pcd->exchange_vals);
     }
     break;
   case MHD_HTTP_FORBIDDEN:
@@ -403,6 +404,7 @@ batch_withdraw_cleanup (void *cls,
   {
     struct CoinState *cs = &ws->coins[i];
 
+    TALER_denom_ewv_free (&cs->exchange_vals);
     TALER_denom_sig_free (&cs->sig);
     if (NULL != cs->pk)
     {

-- 
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]