gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: do not repeatedly append the sam


From: gnunet
Subject: [taler-exchange] branch master updated: do not repeatedly append the same auditor signature
Date: Wed, 14 Apr 2021 17:39:15 +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 453d122c do not repeatedly append the same auditor signature
453d122c is described below

commit 453d122c30b33c4481bb1624db722596ecf1453e
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Apr 14 17:39:13 2021 +0200

    do not repeatedly append the same auditor signature
---
 src/lib/exchange_api_handle.c | 35 ++++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index fbb33eb2..3adef7b4 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -803,7 +803,7 @@ decode_keys_json (const json_t *resp_obj,
 
     json_array_foreach (denom_keys_array, index, denom_key_obj) {
       struct TALER_EXCHANGE_DenomPublicKey dk;
-      int found = GNUNET_NO;
+      bool found = false;
 
       memset (&dk,
               0,
@@ -822,11 +822,11 @@ decode_keys_json (const json_t *resp_obj,
         if (0 == denoms_cmp (&dk,
                              &key_data->denom_keys[j]))
         {
-          found = GNUNET_YES;
+          found = true;
           break;
         }
       }
-      if (GNUNET_YES == found)
+      if (found)
       {
         /* 0:0:0 did not support /keys cherry picking */
         TALER_LOG_DEBUG ("Skipping denomination key: already know it\n");
@@ -862,7 +862,7 @@ decode_keys_json (const json_t *resp_obj,
     /* Merge with the existing auditor information we have (/keys cherry 
picking) */
     json_array_foreach (auditors_array, index, auditor_info) {
       struct TALER_EXCHANGE_AuditorInformation ai;
-      int found = GNUNET_NO;
+      bool found = false;
 
       memset (&ai,
               0,
@@ -879,22 +879,35 @@ decode_keys_json (const json_t *resp_obj,
         if (0 == GNUNET_memcmp (&ai.auditor_pub,
                                 &aix->auditor_pub))
         {
-          found = GNUNET_YES;
+          found = true;
           /* Merge denomination key signatures of downloaded /keys into 
existing
              auditor information 'aix'. */
           TALER_LOG_DEBUG (
             "Merging %u new audited keys with %u known audited keys\n",
             aix->num_denom_keys,
             ai.num_denom_keys);
-
-          GNUNET_array_concatenate (aix->denom_keys,
-                                    aix->num_denom_keys,
-                                    ai.denom_keys,
-                                    ai.num_denom_keys);
+          for (unsigned int i = 0; i<ai.num_denom_keys; i++)
+          {
+            bool kfound = false;
+
+            for (unsigned int k = 0; k<aix->num_denom_keys; k++)
+            {
+              if (aix->denom_keys[k].denom_key_offset ==
+                  ai.denom_keys[i].denom_key_offset)
+              {
+                kfound = true;
+                break;
+              }
+            }
+            if (! kfound)
+              GNUNET_array_append (aix->denom_keys,
+                                   aix->num_denom_keys,
+                                   ai.denom_keys[i]);
+          }
           break;
         }
       }
-      if (GNUNET_YES == found)
+      if (found)
       {
         GNUNET_array_grow (ai.denom_keys,
                            ai.num_denom_keys,

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