summaryrefslogtreecommitdiff
path: root/src/exchangedb/perf_select_refunds_by_coin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchangedb/perf_select_refunds_by_coin.c')
-rw-r--r--src/exchangedb/perf_select_refunds_by_coin.c75
1 files changed, 43 insertions, 32 deletions
diff --git a/src/exchangedb/perf_select_refunds_by_coin.c b/src/exchangedb/perf_select_refunds_by_coin.c
index 85c92f4b9..fdb44d2c9 100644
--- a/src/exchangedb/perf_select_refunds_by_coin.c
+++ b/src/exchangedb/perf_select_refunds_by_coin.c
@@ -211,11 +211,10 @@ run (void *cls)
struct GNUNET_CONFIGURATION_Handle *cfg = cls;
const uint32_t num_partitions = 10;
struct GNUNET_TIME_Timestamp ts;
- struct TALER_EXCHANGEDB_Deposit *depos = NULL;
+ struct TALER_EXCHANGEDB_CoinDepositInformation *depos = NULL;
struct GNUNET_TIME_Timestamp deadline;
struct TALER_Amount value;
union TALER_DenominationBlindingKeyP bks;
- struct TALER_CoinPubHashP c_hash;
struct TALER_EXCHANGEDB_CollectableBlindcoin cbc;
struct TALER_ExchangeWithdrawValues alg_values = {
.cipher = TALER_DENOMINATION_RSA
@@ -225,7 +224,6 @@ run (void *cls)
struct TALER_EXCHANGEDB_Refund *ref = NULL;
unsigned int *perm;
unsigned long long duration_sq;
- struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_EXCHANGEDB_RefreshRevealedCoin *ccoin;
struct TALER_DenominationPublicKey *new_denom_pubs = NULL;
unsigned int count = 0;
@@ -233,7 +231,7 @@ run (void *cls)
ref = GNUNET_new_array (ROUNDS + 1,
struct TALER_EXCHANGEDB_Refund);
depos = GNUNET_new_array (ROUNDS + 1,
- struct TALER_EXCHANGEDB_Deposit);
+ struct TALER_EXCHANGEDB_CoinDepositInformation);
ZR_BLK (&cbc);
if (NULL ==
@@ -344,55 +342,68 @@ run (void *cls)
{
unsigned int i = perm[j];
unsigned int k = (unsigned int) rand () % 5;
+ struct TALER_CoinPubHashP c_hash;
+ uint64_t known_coin_id;
+ struct TALER_EXCHANGEDB_CoinDepositInformation *cdi
+ = &depos[i];
+ struct TALER_EXCHANGEDB_BatchDeposit bd = {
+ .cdis = cdi,
+ .num_cdis = 1,
+ .wallet_timestamp = ts,
+ .refund_deadline = deadline,
+ .wire_deadline = deadline,
+ .receiver_wire_account
+ = "payto://iban/DE67830654080004822650?receiver-name=Test"
+ };
+
if (i >= ROUNDS)
i = ROUNDS; /* throw-away slot, do not keep around */
- RND_BLK (&coin_pub);
+ RND_BLK (&bd.merchant_pub);
+ RND_BLK (&bd.h_contract_terms);
+ RND_BLK (&bd.wire_salt);
+ TALER_merchant_wire_signature_hash (
+ bd.receiver_wire_account,
+ &bd.wire_salt,
+ &h_wire_wt);
+ RND_BLK (&cdi->coin.coin_pub);
+ RND_BLK (&cdi->csig);
RND_BLK (&c_hash);
- depos[i].deposit_fee = fees.deposit;
- RND_BLK (&depos[i].coin.coin_pub);
TALER_denom_pub_hash (&new_dkp[k]->pub,
- &depos[i].coin.denom_pub_hash);
+ &cdi->coin.denom_pub_hash);
GNUNET_assert (GNUNET_OK ==
- TALER_denom_sig_unblind (&depos[i].coin.denom_sig,
+ TALER_denom_sig_unblind (&cdi->coin.denom_sig,
&cbc.sig,
&bks,
&c_hash,
&alg_values,
&new_dkp[k]->pub));
- RND_BLK (&depos[i].merchant_pub);
- RND_BLK (&depos[i].csig);
- RND_BLK (&depos[i].h_contract_terms);
- RND_BLK (&depos[i].wire_salt);
- depos[i].amount_with_fee = value;
- depos[i].refund_deadline = deadline;
- depos[i].wire_deadline = deadline;
- depos[i].receiver_wire_account =
- "payto://iban/DE67830654080004822650?receiver-name=Test";
- TALER_merchant_wire_signature_hash (
- "payto://iban/DE67830654080004822650?receiver-name=Test",
- &depos[i].wire_salt,
- &h_wire_wt);
- depos[i].timestamp = ts;
- uint64_t known_coin_id;
+ cdi->amount_with_fee = value;
+
{
struct TALER_DenominationHashP dph;
struct TALER_AgeCommitmentHash agh;
FAILIF (TALER_EXCHANGEDB_CKS_ADDED !=
plugin->ensure_coin_known (plugin->cls,
- &depos[i].coin,
+ &cdi->coin,
&known_coin_id,
&dph,
&agh));
}
{
struct GNUNET_TIME_Timestamp now;
+ bool balance_ok;
+ uint32_t bad_idx;
+ bool in_conflict;
now = GNUNET_TIME_timestamp_get ();
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
- plugin->insert_deposit (plugin->cls,
- now,
- &depos[i]));
+ plugin->do_deposit (plugin->cls,
+ &bd,
+ &now,
+ &balance_ok,
+ &bad_idx,
+ &in_conflict));
}
{
bool not_found;
@@ -404,9 +415,9 @@ run (void *cls)
{
case 2: // 100% refund
ref[i].coin = depos[i].coin;
- ref[i].details.merchant_pub = depos[i].merchant_pub;
+ ref[i].details.merchant_pub = bd.merchant_pub;
RND_BLK (&ref[i].details.merchant_sig);
- ref[i].details.h_contract_terms = depos[i].h_contract_terms;
+ ref[i].details.h_contract_terms = bd.h_contract_terms;
ref[i].coin.coin_pub = depos[i].coin.coin_pub;
ref[i].details.rtransaction_id = i;
ref[i].details.refund_amount = value;
@@ -425,9 +436,9 @@ run (void *cls)
if (count < (NUM_ROWS / 10))
{
ref[i].coin = depos[i].coin;
- ref[i].details.merchant_pub = depos[i].merchant_pub;
+ ref[i].details.merchant_pub = bd.merchant_pub;
RND_BLK (&ref[i].details.merchant_sig);
- ref[i].details.h_contract_terms = depos[i].h_contract_terms;
+ ref[i].details.h_contract_terms = bd.h_contract_terms;
ref[i].coin.coin_pub = depos[i].coin.coin_pub;
ref[i].details.rtransaction_id = i;
ref[i].details.refund_amount = value;