gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: fix aggregator benchmark generat


From: gnunet
Subject: [taler-exchange] branch master updated: fix aggregator benchmark generation logic
Date: Sat, 04 Sep 2021 11:06:47 +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 c9729259 fix aggregator benchmark generation logic
c9729259 is described below

commit c97292593371e591dc7ba4c38947ebf228b13eb2
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Sep 4 11:06:37 2021 +0200

    fix aggregator benchmark generation logic
---
 src/benchmark/Makefile.am                   |  1 +
 src/benchmark/taler-aggregator-benchmark.c  | 43 +++++++++++++++++++++++------
 src/exchange/taler-exchange-aggregator.c    |  3 ++
 src/exchangedb/plugin_exchangedb_postgres.c | 19 +++++++------
 4 files changed, 48 insertions(+), 18 deletions(-)

diff --git a/src/benchmark/Makefile.am b/src/benchmark/Makefile.am
index 2965d62d..7c5ceefd 100644
--- a/src/benchmark/Makefile.am
+++ b/src/benchmark/Makefile.am
@@ -20,6 +20,7 @@ taler_aggregator_benchmark_SOURCES = \
 taler_aggregator_benchmark_LDADD = \
   $(LIBGCRYPT_LIBS) \
   $(top_builddir)/src/exchangedb/libtalerexchangedb.la \
+  $(top_builddir)/src/json/libtalerjson.la \
   $(top_builddir)/src/util/libtalerutil.la \
   -lgnunetjson \
   -ljansson \
diff --git a/src/benchmark/taler-aggregator-benchmark.c 
b/src/benchmark/taler-aggregator-benchmark.c
index 67bef705..03375d4e 100644
--- a/src/benchmark/taler-aggregator-benchmark.c
+++ b/src/benchmark/taler-aggregator-benchmark.c
@@ -28,6 +28,7 @@
 #include "taler_util.h"
 #include "taler_signatures.h"
 #include "taler_exchangedb_lib.h"
+#include "taler_json_lib.h"
 #include "taler_error_codes.h"
 
 
@@ -278,7 +279,7 @@ add_refund (const struct Merchant *m,
   RANDOMIZE (&r.details.merchant_sig);
   r.details.h_contract_terms = d->h_contract_terms;
   r.details.rtransaction_id = 42;
-  make_amount (0, 9999, &r.details.refund_amount);
+  make_amount (0, 5000000, &r.details.refund_amount);
   make_amount (0, 5, &r.details.refund_fee);
   if (0 <=
       plugin->insert_refund (plugin->cls,
@@ -329,7 +330,7 @@ add_deposit (const struct Merchant *m)
   deposit.timestamp = random_time ();
   deposit.refund_deadline = random_time ();
   deposit.wire_deadline = random_time ();
-  make_amount (0, 99999, &deposit.amount_with_fee);
+  make_amount (1, 0, &deposit.amount_with_fee);
   make_amount (0, 5, &deposit.deposit_fee);
   if (0 >=
       plugin->insert_deposit (plugin->cls,
@@ -358,10 +359,37 @@ static void
 work (void *cls)
 {
   struct Merchant m;
+  char *acc;
+  uint64_t rnd1;
+  uint64_t rnd2;
 
   (void) cls;
   task = NULL;
-  RANDOMIZE (&m);
+  rnd1 = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_NONCE,
+                                   UINT64_MAX);
+  rnd2 = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_NONCE,
+                                   UINT64_MAX);
+  GNUNET_asprintf (&acc,
+                   "payto://aggregator-benchmark/account-%llX-%llX",
+                   (unsigned long long) rnd1,
+                   (unsigned long long) rnd2);
+  json_wire = GNUNET_JSON_PACK (
+    GNUNET_JSON_pack_string ("payto_uri",
+                             acc),
+    GNUNET_JSON_pack_string ("salt",
+                             "thesalty"));
+  GNUNET_free (acc);
+  RANDOMIZE (&m.merchant_pub);
+  if (GNUNET_OK !=
+      TALER_JSON_merchant_wire_signature_hash (json_wire,
+                                               &m.h_wire))
+  {
+    GNUNET_break (0);
+    global_ret = EXIT_FAILURE;
+    GNUNET_SCHEDULER_shutdown ();
+    return;
+  }
+
   if (GNUNET_OK !=
       plugin->start (plugin->cls,
                      "aggregator-benchmark-fill"))
@@ -394,6 +422,8 @@ work (void *cls)
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "Failed to commit, will try again\n");
   }
+  json_decref (json_wire);
+  json_wire = NULL;
   task = GNUNET_SCHEDULER_add_now (&work,
                                    NULL);
 }
@@ -476,7 +506,7 @@ run (void *cls,
     denom_pub.rsa_public_key = pub;
     GNUNET_CRYPTO_rsa_public_key_hash (pub,
                                        &h_denom_pub);
-    make_amountN (1, 0, &issue.properties.value);
+    make_amountN (2, 0, &issue.properties.value);
     make_amountN (0, 5, &issue.properties.fee_withdraw);
     make_amountN (0, 5, &issue.properties.fee_deposit);
     make_amountN (0, 5, &issue.properties.fee_refresh);
@@ -533,11 +563,6 @@ run (void *cls,
     }
   }
 
-  json_wire = GNUNET_JSON_PACK (
-    GNUNET_JSON_pack_string ("payto_uri",
-                             "payto://aggregator-benchmark/accountfoo"),
-    GNUNET_JSON_pack_string ("salt",
-                             "thesalty"));
   task = GNUNET_SCHEDULER_add_now (&work,
                                    NULL);
 }
diff --git a/src/exchange/taler-exchange-aggregator.c 
b/src/exchange/taler-exchange-aggregator.c
index eb1b548e..f3d65db2 100644
--- a/src/exchange/taler-exchange-aggregator.c
+++ b/src/exchange/taler-exchange-aggregator.c
@@ -817,6 +817,9 @@ run_aggregation (void *cls)
                                      s);
     return;
   }
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Found %d other deposits to combine into wire transfer.\n",
+              qs);
 
   /* Subtract wire transfer fee and round to the unit supported by the
      wire transfer method; Check if after rounding down, we still have
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c 
b/src/exchangedb/plugin_exchangedb_postgres.c
index 961921ea..d66370a2 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -4636,7 +4636,7 @@ struct MatchingDepositContext
   /**
    * Set to #GNUNET_SYSERR on hard errors.
    */
-  int status;
+  enum GNUNET_GenericReturnValue status;
 };
 
 
@@ -4657,7 +4657,7 @@ match_deposit_cb (void *cls,
   struct MatchingDepositContext *mdc = cls;
   struct PostgresClosure *pg = mdc->pg;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Found %u/%u matching deposits\n",
               num_results,
               mdc->limit);
@@ -4735,15 +4735,16 @@ postgres_iterate_matching_deposits (
     GNUNET_PQ_query_param_auto_from_type (h_wire),
     GNUNET_PQ_query_param_end
   };
-  struct MatchingDepositContext mdc;
+  struct MatchingDepositContext mdc = {
+    .deposit_cb = deposit_cb,
+    .deposit_cb_cls = deposit_cb_cls,
+    .merchant_pub = merchant_pub,
+    .pg = pg,
+    .limit = limit,
+    .status = GNUNET_OK
+  };
   enum GNUNET_DB_QueryStatus qs;
 
-  mdc.deposit_cb = deposit_cb;
-  mdc.deposit_cb_cls = deposit_cb_cls;
-  mdc.merchant_pub = merchant_pub;
-  mdc.pg = pg;
-  mdc.limit = limit;
-  mdc.status = GNUNET_OK;
   qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
                                              "deposits_iterate_matching",
                                              params,

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