summaryrefslogtreecommitdiff
path: root/src/exchangedb/perf_deposits_get_ready.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchangedb/perf_deposits_get_ready.c')
-rw-r--r--src/exchangedb/perf_deposits_get_ready.c118
1 files changed, 75 insertions, 43 deletions
diff --git a/src/exchangedb/perf_deposits_get_ready.c b/src/exchangedb/perf_deposits_get_ready.c
index 4ad08223c..005ea6843 100644
--- a/src/exchangedb/perf_deposits_get_ready.c
+++ b/src/exchangedb/perf_deposits_get_ready.c
@@ -16,7 +16,7 @@
/**
* @file exchangedb/perf_deposits_get_ready.c
* @brief benchmark for deposits_get_ready
- * @author Joseph Xu
+git * @author Joseph Xu
*/
#include "platform.h"
#include "taler_exchangedb_lib.h"
@@ -33,24 +33,25 @@ static int result;
* Report line of error if @a cond is true, and jump to label "drop".
*/
#define FAILIF(cond) \
- do { \
- if (! (cond)) {break;} \
- GNUNET_break (0); \
- goto drop; \
- } while (0)
+ do { \
+ if (! (cond)) {break;} \
+ GNUNET_break (0); \
+ goto drop; \
+ } while (0)
/**
* Initializes @a ptr with random data.
*/
#define RND_BLK(ptr) \
- GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, sizeof (*ptr))
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, \
+ sizeof (*ptr))
/**
* Initializes @a ptr with zeros.
*/
#define ZR_BLK(ptr) \
- memset (ptr, 0, sizeof (*ptr))
+ memset (ptr, 0, sizeof (*ptr))
/**
* Currency we use. Must match test-exchange-db-*.conf.
@@ -121,7 +122,7 @@ create_denom_key_pair (unsigned int size,
GNUNET_assert (GNUNET_OK ==
TALER_denom_priv_create (&dkp->priv,
&dkp->pub,
- TALER_DENOMINATION_RSA,
+ GNUNET_CRYPTO_BSA_RSA,
size));
memset (&dki,
0,
@@ -196,19 +197,24 @@ run (void *cls)
struct TALER_DenominationPublicKey *new_denom_pubs = NULL;
struct GNUNET_TIME_Relative times = GNUNET_TIME_UNIT_ZERO;
unsigned long long sqrs = 0;
- struct TALER_EXCHANGEDB_Deposit *depos = NULL;
- struct TALER_EXCHANGEDB_Refund *ref = NULL;
+ struct TALER_EXCHANGEDB_CoinDepositInformation *depos;
+ struct TALER_EXCHANGEDB_BatchDeposit bd;
+ struct TALER_EXCHANGEDB_Refund *ref;
unsigned int *perm;
unsigned long long duration_sq;
struct TALER_EXCHANGEDB_RefreshRevealedCoin *ccoin;
+ struct GNUNET_CRYPTO_BlindingInputValues bi = {
+ .cipher = GNUNET_CRYPTO_BSA_RSA,
+ .rc = 0
+ };
struct TALER_ExchangeWithdrawValues alg_values = {
- .cipher = TALER_DENOMINATION_RSA
+ .blinding_inputs = &bi
};
ref = GNUNET_new_array (ROUNDS + 1,
struct TALER_EXCHANGEDB_Refund);
depos = GNUNET_new_array (ROUNDS + 1,
- struct TALER_EXCHANGEDB_Deposit);
+ struct TALER_EXCHANGEDB_CoinDepositInformation);
if (NULL ==
(plugin = TALER_EXCHANGEDB_plugin_load (cfg)))
@@ -261,7 +267,7 @@ run (void *cls)
for (unsigned int cnt = 0; cnt < MELT_NEW_COINS; cnt++)
{
struct GNUNET_TIME_Timestamp now;
- struct TALER_BlindedRsaPlanchet *rp;
+ struct GNUNET_CRYPTO_RsaBlindedMessage *rp;
struct TALER_BlindedPlanchet *bp;
now = GNUNET_TIME_timestamp_get ();
@@ -273,8 +279,10 @@ run (void *cls)
new_denom_pubs[cnt] = new_dkp[cnt]->pub;
ccoin = &revealed_coins[cnt];
bp = &ccoin->blinded_planchet;
- bp->cipher = TALER_DENOMINATION_RSA;
- rp = &bp->details.rsa_blinded_planchet;
+ bp->blinded_message = GNUNET_new (struct GNUNET_CRYPTO_BlindedMessage);
+ bp->blinded_message->cipher = GNUNET_CRYPTO_BSA_RSA;
+ bp->blinded_message->rc = 1;
+ rp = &bp->blinded_message->details.rsa_blinded_message;
rp->blinded_msg_size = 1 + (size_t) GNUNET_CRYPTO_random_u64 (
GNUNET_CRYPTO_QUALITY_WEAK,
(RSA_KEY_SIZE / 8) - 1);
@@ -293,10 +301,9 @@ run (void *cls)
&new_dkp[cnt]->priv,
true,
bp));
- GNUNET_assert (GNUNET_OK ==
- TALER_coin_ev_hash (bp,
- &cbc.denom_pub_hash,
- &cbc.h_coin_envelope));
+ TALER_coin_ev_hash (bp,
+ &cbc.denom_pub_hash,
+ &cbc.h_coin_envelope);
GNUNET_assert (
GNUNET_OK ==
TALER_denom_sign_blinded (
@@ -314,16 +321,16 @@ run (void *cls)
for (unsigned int j = 0; j < NUM_ROWS; j++)
{
/*** NEED TO INSERT REFRESH COMMITMENTS + ENSURECOIN ***/
- union TALER_DenominationBlindingKeyP bks;
+ union GNUNET_CRYPTO_BlindingSecretP bks;
struct GNUNET_TIME_Timestamp deadline;
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_ReservePublicKeyP reserve_pub;
struct TALER_CoinPubHashP c_hash;
unsigned int k = (unsigned int) rand () % 5;
unsigned int i = perm[j];
+
if (i >= ROUNDS)
i = ROUNDS; /* throw-away slot, do not keep around */
- depos[i].deposit_fee = fees.deposit;
RND_BLK (&coin_pub);
RND_BLK (&c_hash);
RND_BLK (&reserve_pub);
@@ -331,7 +338,7 @@ run (void *cls)
TALER_denom_pub_hash (&new_dkp[k]->pub,
&cbc.denom_pub_hash);
deadline = GNUNET_TIME_timestamp_get ();
- RND_BLK (&depos[i].coin.coin_pub);
+ depos[i].coin.coin_pub = coin_pub;
TALER_denom_pub_hash (&new_dkp[k]->pub,
&depos[i].coin.denom_pub_hash);
GNUNET_assert (GNUNET_OK ==
@@ -341,19 +348,21 @@ run (void *cls)
&c_hash,
&alg_values,
&new_dkp[k]->pub));
- RND_BLK (&depos[i].merchant_pub);
+ RND_BLK (&bd.merchant_pub);
RND_BLK (&depos[i].csig);
- RND_BLK (&depos[i].h_contract_terms);
- RND_BLK (&depos[i].wire_salt);
+ RND_BLK (&bd.h_contract_terms);
+ RND_BLK (&bd.wire_salt);
depos[i].amount_with_fee = value;
- depos[i].refund_deadline = deadline;
- depos[i].wire_deadline = deadline;
- depos[i].receiver_wire_account =
+ bd.refund_deadline = deadline;
+ bd.wire_deadline = deadline;
+ bd.receiver_wire_account =
"payto://iban/DE67830654080004822650?receiver-name=Test";
TALER_merchant_wire_signature_hash (
- "payto://iban/DE67830654080004822650?receiver-name=Test",
- &depos[i].wire_salt,
+ bd.receiver_wire_account,
+ &bd.wire_salt,
&h_wire_wt);
+ bd.num_cdis = 1;
+ bd.cdis = &depos[i];
cbc.reserve_pub = reserve_pub;
cbc.amount_with_fee = value;
GNUNET_assert (GNUNET_OK ==
@@ -361,21 +370,38 @@ run (void *cls)
&cbc.withdraw_fee));
{
bool found;
- bool nonce_ok;
+ bool nonce_reuse;
bool balance_ok;
+ bool age_ok;
+ bool conflict;
+ bool denom_unknown;
+ struct TALER_Amount reserve_balance;
+ uint16_t allowed_minimum_age;
uint64_t ruuid;
struct GNUNET_TIME_Timestamp now;
now = GNUNET_TIME_timestamp_get ();
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
- plugin->do_withdraw (plugin->cls,
- NULL,
- &cbc,
- now,
- &found,
- &balance_ok,
- &nonce_ok,
- &ruuid));
+ plugin->do_batch_withdraw (plugin->cls,
+ now,
+ &reserve_pub,
+ &value,
+ true,
+ &found,
+ &balance_ok,
+ &reserve_balance,
+ &age_ok,
+ &allowed_minimum_age,
+ &ruuid));
+ FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
+ plugin->do_batch_withdraw_insert (plugin->cls,
+ NULL,
+ &cbc,
+ now,
+ ruuid,
+ &denom_unknown,
+ &conflict,
+ &nonce_reuse));
}
{
/* ENSURE_COIN_KNOWN */
@@ -396,12 +422,18 @@ run (void *cls)
}
{
struct GNUNET_TIME_Timestamp now;
+ bool balance_ok;
+ uint32_t bad_idx;
+ bool ctr_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,
+ &ctr_conflict));
}
if (ROUNDS == i)
TALER_denom_sig_free (&depos[i].coin.denom_sig);