diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-09-04 11:06:37 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-09-04 11:06:37 +0200 |
commit | c97292593371e591dc7ba4c38947ebf228b13eb2 (patch) | |
tree | c95f271116cd47af810c0fb6e980108283724b6c /src/benchmark | |
parent | 1c1d28d3f5746fac496b517d0b3b78ca1726f01f (diff) | |
download | exchange-c97292593371e591dc7ba4c38947ebf228b13eb2.tar.xz |
fix aggregator benchmark generation logic
Diffstat (limited to 'src/benchmark')
-rw-r--r-- | src/benchmark/Makefile.am | 1 | ||||
-rw-r--r-- | src/benchmark/taler-aggregator-benchmark.c | 43 |
2 files changed, 35 insertions, 9 deletions
diff --git a/src/benchmark/Makefile.am b/src/benchmark/Makefile.am index 2965d62dc..7c5ceefd6 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 67bef7052..03375d4e3 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); } |