diff options
Diffstat (limited to 'src/benchmark/taler-aggregator-benchmark.c')
-rw-r--r-- | src/benchmark/taler-aggregator-benchmark.c | 93 |
1 files changed, 57 insertions, 36 deletions
diff --git a/src/benchmark/taler-aggregator-benchmark.c b/src/benchmark/taler-aggregator-benchmark.c index bb7e47b0a..228d050e4 100644 --- a/src/benchmark/taler-aggregator-benchmark.c +++ b/src/benchmark/taler-aggregator-benchmark.c @@ -251,7 +251,7 @@ add_refund (const struct Merchant *m, r.details.rtransaction_id = 42; make_amount (0, 5000000, &r.details.refund_amount); make_amount (0, 5, &r.details.refund_fee); - if (0 <= + if (0 >= plugin->insert_refund (plugin->cls, &r)) { @@ -274,7 +274,11 @@ static bool add_deposit (const struct Merchant *m) { struct Deposit d; - struct TALER_EXCHANGEDB_Deposit deposit; + struct TALER_EXCHANGEDB_CoinDepositInformation deposit; + struct TALER_EXCHANGEDB_BatchDeposit bd = { + .cdis = &deposit, + .num_cdis = 1 + }; uint64_t known_coin_id; struct TALER_DenominationHashP dph; struct TALER_AgeCommitmentHash agh; @@ -283,6 +287,7 @@ add_deposit (const struct Merchant *m) d.coin.denom_pub_hash = h_denom_pub; d.coin.denom_sig = denom_sig; RANDOMIZE (&d.h_contract_terms); + d.coin.no_age_commitment = true; memset (&d.coin.h_age_commitment, 0, sizeof (d.coin.h_age_commitment)); @@ -301,24 +306,40 @@ add_deposit (const struct Merchant *m) } deposit.coin = d.coin; RANDOMIZE (&deposit.csig); - deposit.merchant_pub = m->merchant_pub; - deposit.h_contract_terms = d.h_contract_terms; - deposit.wire_salt = m->wire_salt; - deposit.receiver_wire_account = m->payto_uri; - deposit.timestamp = random_time (); - deposit.refund_deadline = random_time (); - deposit.wire_deadline = random_time (); + bd.merchant_pub = m->merchant_pub; + bd.h_contract_terms = d.h_contract_terms; + bd.wire_salt = m->wire_salt; + bd.receiver_wire_account = m->payto_uri; + bd.wallet_timestamp = random_time (); + do { + bd.refund_deadline = random_time (); + bd.wire_deadline = random_time (); + } while (GNUNET_TIME_timestamp_cmp (bd.wire_deadline, + <, + bd.refund_deadline)); + make_amount (1, 0, &deposit.amount_with_fee); - make_amount (0, 5, &deposit.deposit_fee); - if (0 >= - plugin->insert_deposit (plugin->cls, - random_time (), - &deposit)) + { - GNUNET_break (0); - global_ret = EXIT_FAILURE; - GNUNET_SCHEDULER_shutdown (); - return false; + struct GNUNET_TIME_Timestamp now; + bool balance_ok; + uint32_t bad_idx; + bool conflict; + + now = random_time (); + if (0 >= + plugin->do_deposit (plugin->cls, + &bd, + &now, + &balance_ok, + &bad_idx, + &conflict)) + { + GNUNET_break (0); + global_ret = EXIT_FAILURE; + GNUNET_SCHEDULER_shutdown (); + return false; + } } if (GNUNET_YES == eval_probability (((float) refund_rate) / 100.0)) @@ -445,6 +466,9 @@ run (void *cls, } GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); + memset (&issue, + 0, + sizeof (issue)); RANDOMIZE (&issue.signature); issue.start = start; @@ -465,18 +489,19 @@ run (void *cls, struct TALER_PlanchetDetail pd; struct TALER_BlindedDenominationSignature bds; struct TALER_PlanchetMasterSecretP ps; - struct TALER_ExchangeWithdrawValues alg_values; struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_AgeCommitmentHash hac; - union TALER_DenominationBlindingKeyP bks; + union GNUNET_CRYPTO_BlindingSecretP bks; + const struct TALER_ExchangeWithdrawValues *alg_values; RANDOMIZE (&coin_pub); GNUNET_assert (GNUNET_OK == TALER_denom_priv_create (&pk, &denom_pub, - TALER_DENOMINATION_RSA, + GNUNET_CRYPTO_BSA_RSA, 1024)); - alg_values.cipher = TALER_DENOMINATION_RSA; + alg_values = TALER_denom_ewv_rsa_singleton (); + denom_pub.age_mask = issue.age_mask; TALER_denom_pub_hash (&denom_pub, &h_denom_pub); make_amount (2, 0, &issue.value); @@ -496,9 +521,8 @@ run (void *cls, return; } - TALER_planchet_blinding_secret_create (&ps, - &alg_values, + TALER_denom_ewv_rsa_singleton (), &bks); { @@ -511,23 +535,21 @@ run (void *cls, GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, &seed, sizeof(seed)); - - GNUNET_assert (GNUNET_OK == - TALER_age_restriction_commit ( - &mask, - 13, - &seed, - &acp)); - - TALER_age_commitment_hash (&acp.commitment, &hac); + TALER_age_restriction_commit (&mask, + 13, + &seed, + &acp); + TALER_age_commitment_hash (&acp.commitment, + &hac); } GNUNET_assert (GNUNET_OK == TALER_denom_blind (&denom_pub, &bks, + NULL, &hac, &coin_pub, - &alg_values, + alg_values, &c_hash, &pd.blinded_planchet)); GNUNET_assert (GNUNET_OK == @@ -541,7 +563,7 @@ run (void *cls, &bds, &bks, &c_hash, - &alg_values, + alg_values, &denom_pub)); TALER_blinded_denom_sig_free (&bds); TALER_denom_pub_free (&denom_pub); @@ -561,7 +583,6 @@ run (void *cls, ws = GNUNET_TIME_absolute_to_timestamp (GNUNET_TIME_year_to_time (y - 1)); we = GNUNET_TIME_absolute_to_timestamp (GNUNET_TIME_year_to_time (y)); make_amount (0, 5, &fees.wire); - make_amount (0, 5, &fees.wad); make_amount (0, 5, &fees.closing); memset (&master_sig, 0, |