Merge branch 'master' of git+ssh://git.taler.net/var/git/mint
This commit is contained in:
commit
de430aa464
Binary file not shown.
@ -343,6 +343,8 @@ handle_deposit_finished (void *cls,
|
||||
}
|
||||
switch (response_code)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case MHD_HTTP_OK:
|
||||
if (GNUNET_OK !=
|
||||
verify_deposit_signature_ok (dh,
|
||||
|
@ -574,8 +574,32 @@ keys_completed_cb (void *cls,
|
||||
{
|
||||
struct KeysRequest *kr = cls;
|
||||
struct TALER_MINT_Handle *mint = kr->mint;
|
||||
long response_code;
|
||||
|
||||
/* FIXME: might want to check response code? */
|
||||
if (CURLE_OK !=
|
||||
curl_easy_getinfo (eh,
|
||||
CURLINFO_RESPONSE_CODE,
|
||||
&response_code))
|
||||
{
|
||||
/* unexpected error... */
|
||||
GNUNET_break (0);
|
||||
response_code = 0;
|
||||
}
|
||||
switch (response_code) {
|
||||
case 0:
|
||||
kr->errno = 1;
|
||||
break;
|
||||
case MHD_HTTP_OK:
|
||||
break;
|
||||
default:
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
|
||||
"Mint returned status code %u for /keys\n",
|
||||
response_code);
|
||||
kr->errno = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( (0 != kr->eno) ||
|
||||
(GNUNET_OK !=
|
||||
parse_response_keys_get (kr)) )
|
||||
|
@ -324,6 +324,8 @@ handle_withdraw_status_finished (void *cls,
|
||||
}
|
||||
switch (response_code)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case MHD_HTTP_OK:
|
||||
{
|
||||
json_t *history;
|
||||
@ -818,6 +820,8 @@ handle_withdraw_sign_finished (void *cls,
|
||||
}
|
||||
switch (response_code)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case MHD_HTTP_OK:
|
||||
if (GNUNET_OK !=
|
||||
withdraw_sign_ok (wsh,
|
||||
|
@ -31,32 +31,83 @@ main (int argc, char ** argv)
|
||||
{
|
||||
struct TALER_MINTDB_Plugin *plugin;
|
||||
struct GNUNET_CONFIGURATION_Handle *config;
|
||||
struct PERF_TALER_MINTDB_Cmd test[] =
|
||||
struct PERF_TALER_MINTDB_Cmd test[] =
|
||||
{
|
||||
PERF_TALER_MINTDB_INIT_CMD_LOOP ("loop_db_init_deposit",10000),
|
||||
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION ("start_transaction_init"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT ("init_deposit_insert"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("commit_transaction_init"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("array_depo",
|
||||
"loop_db_init_deposit",
|
||||
"init_deposit_insert",
|
||||
100,
|
||||
PERF_TALER_MINTDB_DEPOSIT),
|
||||
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("endloop_init_deposit",
|
||||
"loop_db_init_deposit"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_DEBUG("Fin loop 1"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_LOOP ("loop_deposit_get",100),
|
||||
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION ("start_transaction_get"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY("load deposit",
|
||||
"loop_deposit_get",
|
||||
"array_depo"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_GET_DEPOSIT("get_deposit",
|
||||
"load_deposit"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("commit_transaction_init"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_END_LOOP("stop2", "loop_deposit_get"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_END("end")
|
||||
// Denomination used to create coins
|
||||
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("00 - Start of interpretor"),
|
||||
|
||||
PERF_TALER_MINTDB_INIT_CMD_LOOP ("01 - denomination loop",
|
||||
PERF_TALER_MINTDB_NB_DENOMINATION_INIT),
|
||||
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION ("01 - start transaction"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_INSERT_DENOMINATION ("01 - denomination"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("01 - commit transaction"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("01 - save denomination",
|
||||
"01 - denomination loop",
|
||||
"01 - denomination",
|
||||
PERF_TALER_MINTDB_NB_DENOMINATION_SAVE),
|
||||
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("01 - denomination loop end",
|
||||
"01 - denomination loop"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("01 - init denomination complete"),
|
||||
// End of initialization
|
||||
// Reserve initialization
|
||||
PERF_TALER_MINTDB_INIT_CMD_LOOP ("02 - init reserve loop",
|
||||
PERF_TALER_MINTDB_NB_RESERVE_INIT),
|
||||
PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE ("02 - reserve"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("02 - save reserve",
|
||||
"02 - init reserve loop",
|
||||
"02 - reserve",
|
||||
PERF_TALER_MINTDB_NB_RESERVE_SAVE),
|
||||
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("02 - init reserve end loop",
|
||||
"02 - init reserve loop"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("02 - reserve init complete"),
|
||||
// End reserve init
|
||||
// Withdrawal initialization
|
||||
PERF_TALER_MINTDB_INIT_CMD_LOOP ("03 - init withdraw loop",
|
||||
PERF_TALER_MINTDB_NB_WITHDRAW_INIT),
|
||||
// PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION ("03 - start transaction"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("03 - denomination load",
|
||||
"03 - init withdraw loop",
|
||||
"01 - save denomination"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("03 - reserve load",
|
||||
"03 - init withdraw loop",
|
||||
"02 - save reserve"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW ("03 - withdraw",
|
||||
"03 - denomination load",
|
||||
"03 - reserve load"),
|
||||
// PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("03 - commit transaction"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("03 - blindcoin array",
|
||||
"03 - init withdraw loop",
|
||||
"03 - withdraw",
|
||||
PERF_TALER_MINTDB_NB_WITHDRAW_SAVE),
|
||||
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("03 - withdraw init end loop",
|
||||
"03 - init withdraw loop"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("03 - withdraw init complete"),
|
||||
//End of withdrawal initialization
|
||||
//Deposit initialization
|
||||
PERF_TALER_MINTDB_INIT_CMD_LOOP ("04 - deposit init loop",
|
||||
PERF_TALER_MINTDB_NB_DEPOSIT_INIT),
|
||||
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION ("04 - start transaction"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("04 - denomination load",
|
||||
"04 - deposit init loop",
|
||||
"01 - save denomination"),
|
||||
|
||||
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT ("04 - deposit",
|
||||
"04 - denomination load"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("04 - commit transaction"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("04 - deposit array",
|
||||
"04 - deposit init loop",
|
||||
"04 - deposit",
|
||||
PERF_TALER_MINTDB_NB_DEPOSIT_SAVE),
|
||||
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("04 - deposit init loop end",
|
||||
"04 - deposit init loop"),
|
||||
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("04 - deposit init complete"),
|
||||
// End of deposit initialization
|
||||
PERF_TALER_MINTDB_INIT_CMD_END ("end"),
|
||||
};
|
||||
// Plugin init
|
||||
|
||||
GNUNET_log_setup ("perf-taler-mintdb",
|
||||
"INFO",
|
||||
NULL);
|
||||
config = GNUNET_CONFIGURATION_create();
|
||||
GNUNET_CONFIGURATION_load(config, "./test-mint-db-postgres.conf");
|
||||
GNUNET_assert (NULL !=
|
||||
|
@ -30,260 +30,8 @@
|
||||
|
||||
|
||||
/**
|
||||
* @return a randomly generated CollectableBlindcoin
|
||||
*/
|
||||
struct TALER_MINTDB_CollectableBlindcoin *
|
||||
PERF_TALER_MINTDB_collectable_blindcoin_init ()
|
||||
{
|
||||
uint32_t random_int;
|
||||
struct GNUNET_CRYPTO_rsa_PrivateKey *denomination_key;
|
||||
struct GNUNET_CRYPTO_EddsaPrivateKey *reserve_sig_key;
|
||||
struct {
|
||||
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
|
||||
uint32_t data;
|
||||
} unsigned_data;
|
||||
struct TALER_MINTDB_CollectableBlindcoin *coin;
|
||||
|
||||
|
||||
coin = GNUNET_new (struct TALER_MINTDB_CollectableBlindcoin);
|
||||
GNUNET_assert (NULL !=
|
||||
(reserve_sig_key = GNUNET_CRYPTO_eddsa_key_create ()));
|
||||
GNUNET_assert (NULL !=
|
||||
(denomination_key = GNUNET_CRYPTO_rsa_private_key_create (512)));
|
||||
GNUNET_assert (NULL ==
|
||||
(coin->denom_pub.rsa_public_key =
|
||||
GNUNET_CRYPTO_rsa_private_key_get_public (denomination_key)));
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (reserve_sig_key,
|
||||
&coin->reserve_pub.eddsa_pub);
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_string_to_amount (CURRENCY ":1.1",
|
||||
&coin->amount_with_fee));
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_string_to_amount (CURRENCY ":1.1",
|
||||
&coin->withdraw_fee));
|
||||
random_int =
|
||||
GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX);
|
||||
GNUNET_assert (NULL !=
|
||||
(coin->sig.rsa_signature =
|
||||
GNUNET_CRYPTO_rsa_sign (denomination_key,
|
||||
&random_int,
|
||||
sizeof (random_int))));
|
||||
GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
|
||||
&coin->h_coin_envelope);
|
||||
unsigned_data.purpose.size = htonl (sizeof (unsigned_data));
|
||||
unsigned_data.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST);
|
||||
unsigned_data.data = htonl (random_int);
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
GNUNET_CRYPTO_eddsa_sign (reserve_sig_key,
|
||||
(struct GNUNET_CRYPTO_EccSignaturePurpose *) &unsigned_data,
|
||||
&coin->reserve_sig.eddsa_signature));
|
||||
GNUNET_free (reserve_sig_key);
|
||||
GNUNET_CRYPTO_rsa_private_key_free (denomination_key);
|
||||
return coin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Liberate memory of @a coin
|
||||
*/
|
||||
int
|
||||
PERF_TALER_MINTDB_collectable_blindcoin_free (struct TALER_MINTDB_CollectableBlindcoin *coin)
|
||||
{
|
||||
if (NULL == coin)
|
||||
return GNUNET_OK;
|
||||
|
||||
GNUNET_CRYPTO_rsa_signature_free (coin->sig.rsa_signature);
|
||||
GNUNET_CRYPTO_rsa_public_key_free (coin->denom_pub.rsa_public_key);
|
||||
GNUNET_free (coin);
|
||||
return GNUNET_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return a randomly generated reserve
|
||||
*/
|
||||
struct TALER_MINTDB_Reserve *
|
||||
PERF_TALER_MINTDB_reserve_init ()
|
||||
{
|
||||
struct TALER_MINTDB_Reserve *reserve;
|
||||
struct GNUNET_CRYPTO_EddsaPrivateKey *reserve_priv;
|
||||
|
||||
GNUNET_assert (NULL !=
|
||||
(reserve = GNUNET_new (struct TALER_MINTDB_Reserve)));
|
||||
GNUNET_assert (NULL !=
|
||||
(reserve_priv = GNUNET_CRYPTO_eddsa_key_create ()));
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (reserve_priv ,
|
||||
&reserve->pub.eddsa_pub);
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_string_to_amount (CURRENCY ":1.1", &reserve->balance));
|
||||
reserve->expiry = GNUNET_TIME_absolute_get_forever_ ();
|
||||
GNUNET_free (reserve_priv);
|
||||
return reserve;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Free memory of a reserve
|
||||
*/
|
||||
int
|
||||
PERF_TALER_MINTDB_reserve_free (struct TALER_MINTDB_Reserve *reserve)
|
||||
{
|
||||
GNUNET_free (reserve);
|
||||
return GNUNET_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return a randomly generated refresh session
|
||||
*/
|
||||
struct TALER_MINTDB_RefreshSession *
|
||||
PERF_TALER_MINTDB_refresh_session_init ()
|
||||
{
|
||||
struct TALER_MINTDB_RefreshSession *refresh_session;
|
||||
|
||||
GNUNET_assert (NULL !=
|
||||
(refresh_session = GNUNET_new (struct TALER_MINTDB_RefreshSession)));
|
||||
refresh_session->noreveal_index = 1;
|
||||
refresh_session->num_oldcoins = 1;
|
||||
refresh_session->num_newcoins = 1;
|
||||
|
||||
return refresh_session;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Free a refresh session
|
||||
*/
|
||||
int
|
||||
PERF_TALER_MINTDB_refresh_session_free (struct TALER_MINTDB_RefreshSession *refresh_session)
|
||||
{
|
||||
GNUNET_free (refresh_session);
|
||||
return GNUNET_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a randomly generated deposit
|
||||
*/
|
||||
struct TALER_MINTDB_Deposit *
|
||||
PERF_TALER_MINTDB_deposit_init ()
|
||||
{
|
||||
struct TALER_MINTDB_Deposit *deposit;
|
||||
struct TALER_CoinPublicInfo coin;
|
||||
struct TALER_CoinSpendSignatureP csig;
|
||||
struct TALER_MerchantPublicKeyP merchant_pub;
|
||||
struct GNUNET_HashCode h_contract;
|
||||
struct GNUNET_HashCode h_wire;
|
||||
const char wire[] = "{"
|
||||
"\"type\":\"SEPA\","
|
||||
"\"IBAN\":\"DE67830654080004822650\","
|
||||
"\"NAME\":\"GNUNET E.\","
|
||||
"\"BIC\":\"GENODEF1SRL\""
|
||||
"}";
|
||||
static uint64_t transaction_id = 0;
|
||||
struct GNUNET_TIME_Absolute timestamp;
|
||||
struct GNUNET_TIME_Absolute refund_deadline;
|
||||
struct TALER_Amount amount_with_fee;
|
||||
struct TALER_Amount deposit_fee;
|
||||
|
||||
GNUNET_assert (NULL !=
|
||||
(deposit = GNUNET_malloc (sizeof (struct TALER_MINTDB_Deposit) + sizeof (wire))));
|
||||
{ // coin
|
||||
struct GNUNET_CRYPTO_EddsaPrivateKey *eddsa_prvt;
|
||||
struct GNUNET_CRYPTO_rsa_PrivateKey *rsa_prv;
|
||||
|
||||
GNUNET_assert (NULL !=
|
||||
(eddsa_prvt = GNUNET_CRYPTO_eddsa_key_create ()));
|
||||
GNUNET_assert (NULL !=
|
||||
(rsa_prv = GNUNET_CRYPTO_rsa_private_key_create (PERF_TALER_MINTDB_RSA_SIZE)));
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (eddsa_prvt,
|
||||
&coin.coin_pub.eddsa_pub);
|
||||
GNUNET_assert (NULL !=
|
||||
(coin.denom_pub.rsa_public_key =
|
||||
GNUNET_CRYPTO_rsa_private_key_get_public (rsa_prv)));
|
||||
GNUNET_assert (NULL !=
|
||||
(coin.denom_sig.rsa_signature =
|
||||
GNUNET_CRYPTO_rsa_sign (rsa_prv,
|
||||
&coin.coin_pub.eddsa_pub,
|
||||
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey))));
|
||||
|
||||
GNUNET_CRYPTO_rsa_private_key_free (rsa_prv);
|
||||
GNUNET_free (eddsa_prvt);
|
||||
}
|
||||
{ //csig
|
||||
struct u32_presign
|
||||
{
|
||||
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
|
||||
uint32_t data;
|
||||
} unsigned_data;
|
||||
struct GNUNET_CRYPTO_EddsaPrivateKey *eddsa_prvt;
|
||||
|
||||
GNUNET_assert (NULL !=
|
||||
(eddsa_prvt = GNUNET_CRYPTO_eddsa_key_create ()));
|
||||
unsigned_data.data = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
|
||||
UINT32_MAX);
|
||||
unsigned_data.purpose.size = htonl (sizeof (struct u32_presign));
|
||||
unsigned_data.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST);
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
GNUNET_CRYPTO_eddsa_sign (eddsa_prvt,
|
||||
&unsigned_data.purpose,
|
||||
&csig.eddsa_signature));
|
||||
GNUNET_free (eddsa_prvt);
|
||||
}
|
||||
{ //merchant_pub
|
||||
struct GNUNET_CRYPTO_EddsaPrivateKey *eddsa_prv;
|
||||
|
||||
GNUNET_assert(NULL !=
|
||||
(eddsa_prv = GNUNET_CRYPTO_eddsa_key_create ()));
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (
|
||||
eddsa_prv,
|
||||
&merchant_pub.eddsa_pub);
|
||||
GNUNET_free (eddsa_prv);
|
||||
}
|
||||
GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
|
||||
&h_contract);
|
||||
GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
|
||||
&h_wire);
|
||||
timestamp = GNUNET_TIME_absolute_get ();
|
||||
refund_deadline = GNUNET_TIME_absolute_get ();
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_string_to_amount (CURRENCY ":1.1",
|
||||
&amount_with_fee));
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_string_to_amount (CURRENCY ":0.1",
|
||||
&deposit_fee));
|
||||
deposit->coin = coin;
|
||||
deposit->csig = csig;
|
||||
deposit->h_contract = h_contract;
|
||||
deposit->h_wire = h_wire;
|
||||
deposit->wire = json_loads (wire, 0, NULL);
|
||||
deposit->transaction_id = transaction_id++;
|
||||
deposit->timestamp = timestamp;
|
||||
deposit->refund_deadline = refund_deadline;
|
||||
deposit->amount_with_fee = amount_with_fee;
|
||||
deposit->deposit_fee = deposit_fee;
|
||||
return deposit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Free memory of a deposit
|
||||
*/
|
||||
int
|
||||
PERF_TALER_MINTDB_deposit_free (struct TALER_MINTDB_Deposit *deposit)
|
||||
{
|
||||
if ( NULL == deposit)
|
||||
return GNUNET_OK;
|
||||
GNUNET_CRYPTO_rsa_public_key_free (deposit->coin.denom_pub.rsa_public_key);
|
||||
GNUNET_CRYPTO_rsa_signature_free (deposit->coin.denom_sig.rsa_signature);
|
||||
json_decref (deposit->wire);
|
||||
GNUNET_free (deposit);
|
||||
|
||||
return GNUNET_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate a randomly generate DenominationKeyInformation
|
||||
* Generate a dummy DenominationKeyInformation for testing purposes
|
||||
* @return a dummy denomination key
|
||||
*/
|
||||
struct TALER_MINTDB_DenominationKeyIssueInformation *
|
||||
PERF_TALER_MINTDB_denomination_init ()
|
||||
@ -340,7 +88,40 @@ PERF_TALER_MINTDB_denomination_init ()
|
||||
|
||||
|
||||
/**
|
||||
* Free memory for a DenominationKeyIssueInformation
|
||||
* Copies the given denomination
|
||||
* @param reserve the deposit copy
|
||||
* @return a copy of @a deposit; NULL if error
|
||||
*/
|
||||
struct TALER_MINTDB_DenominationKeyIssueInformation *
|
||||
PERF_TALER_MINTDB_denomination_copy (const struct TALER_MINTDB_DenominationKeyIssueInformation *dki)
|
||||
{
|
||||
struct TALER_MINTDB_DenominationKeyIssueInformation *copy;
|
||||
|
||||
GNUNET_assert (NULL !=
|
||||
(copy = GNUNET_new (struct TALER_MINTDB_DenominationKeyIssueInformation)));
|
||||
*copy = *dki;
|
||||
{
|
||||
char *buffer = NULL;
|
||||
int size;
|
||||
GNUNET_assert (0 <
|
||||
(size = GNUNET_CRYPTO_rsa_private_key_encode (
|
||||
dki->denom_priv.rsa_private_key,
|
||||
&buffer)));
|
||||
GNUNET_assert (NULL !=
|
||||
(copy->denom_priv.rsa_private_key =
|
||||
GNUNET_CRYPTO_rsa_private_key_decode(buffer, size)));
|
||||
GNUNET_free (buffer);
|
||||
}
|
||||
GNUNET_assert (NULL !=
|
||||
(copy->denom_pub.rsa_public_key =
|
||||
GNUNET_CRYPTO_rsa_public_key_dup (dki->denom_pub.rsa_public_key)));
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Free memory of a DenominationKeyIssueInformation
|
||||
* @param dki pointer to the struct to free
|
||||
*/
|
||||
int
|
||||
PERF_TALER_MINTDB_denomination_free (struct TALER_MINTDB_DenominationKeyIssueInformation *dki)
|
||||
@ -355,6 +136,357 @@ PERF_TALER_MINTDB_denomination_free (struct TALER_MINTDB_DenominationKeyIssueInf
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate a dummy reserve for testing
|
||||
* @return a reserve with 1000 EUR in it
|
||||
*/
|
||||
struct TALER_MINTDB_Reserve *
|
||||
PERF_TALER_MINTDB_reserve_init ()
|
||||
{
|
||||
struct TALER_MINTDB_Reserve *reserve;
|
||||
struct GNUNET_CRYPTO_EddsaPrivateKey *reserve_priv;
|
||||
|
||||
GNUNET_assert (NULL !=
|
||||
(reserve = GNUNET_new (struct TALER_MINTDB_Reserve)));
|
||||
GNUNET_assert (NULL !=
|
||||
(reserve_priv = GNUNET_CRYPTO_eddsa_key_create ()));
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (reserve_priv ,
|
||||
&reserve->pub.eddsa_pub);
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_string_to_amount (CURRENCY ":1000", &reserve->balance));
|
||||
reserve->expiry = GNUNET_TIME_absolute_get_forever_ ();
|
||||
GNUNET_free (reserve_priv);
|
||||
return reserve;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copies the given reserve
|
||||
* @param reserve the reserve to copy
|
||||
* @return a copy of @a reserve; NULL if error
|
||||
*/
|
||||
struct TALER_MINTDB_Reserve *
|
||||
PERF_TALER_MINTDB_reserve_copy (const struct TALER_MINTDB_Reserve *reserve)
|
||||
{
|
||||
struct TALER_MINTDB_Reserve *copy;
|
||||
GNUNET_assert (NULL != (copy = GNUNET_new (struct TALER_MINTDB_Reserve)));
|
||||
*copy = *reserve;
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Free memory of a reserve
|
||||
* @param reserve pointer to the structure to be freed
|
||||
*/
|
||||
int
|
||||
PERF_TALER_MINTDB_reserve_free (struct TALER_MINTDB_Reserve *reserve)
|
||||
{
|
||||
if (NULL == reserve)
|
||||
return GNUNET_OK;
|
||||
GNUNET_free (reserve);
|
||||
return GNUNET_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate a dummy deposit for testing purposes
|
||||
* @param dki the denomination key used to sign the key
|
||||
*/
|
||||
struct TALER_MINTDB_Deposit *
|
||||
PERF_TALER_MINTDB_deposit_init (const struct TALER_MINTDB_DenominationKeyIssueInformation *dki)
|
||||
{
|
||||
struct TALER_MINTDB_Deposit *deposit;
|
||||
struct TALER_CoinPublicInfo coin;
|
||||
struct TALER_CoinSpendSignatureP csig;
|
||||
struct TALER_MerchantPublicKeyP merchant_pub;
|
||||
struct GNUNET_HashCode h_contract;
|
||||
struct GNUNET_HashCode h_wire;
|
||||
const char wire[] = "{"
|
||||
"\"type\":\"SEPA\","
|
||||
"\"IBAN\":\"DE67830654080004822650\","
|
||||
"\"NAME\":\"GNUNET E.\","
|
||||
"\"BIC\":\"GENODEF1SRL\""
|
||||
"}";
|
||||
static uint64_t transaction_id = 0;
|
||||
struct GNUNET_TIME_Absolute timestamp;
|
||||
struct GNUNET_TIME_Absolute refund_deadline;
|
||||
struct TALER_Amount amount_with_fee;
|
||||
struct TALER_Amount deposit_fee;
|
||||
|
||||
GNUNET_assert (NULL !=
|
||||
(deposit = GNUNET_malloc (sizeof (struct TALER_MINTDB_Deposit) + sizeof (wire))));
|
||||
{ // coin
|
||||
struct GNUNET_CRYPTO_EddsaPrivateKey *eddsa_prvt;
|
||||
|
||||
GNUNET_assert (NULL !=
|
||||
(eddsa_prvt = GNUNET_CRYPTO_eddsa_key_create ()));
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (eddsa_prvt,
|
||||
&coin.coin_pub.eddsa_pub);
|
||||
GNUNET_assert (NULL !=
|
||||
(coin.denom_pub.rsa_public_key =
|
||||
GNUNET_CRYPTO_rsa_public_key_dup (dki->denom_pub.rsa_public_key)));
|
||||
GNUNET_assert (NULL !=
|
||||
(coin.denom_sig.rsa_signature =
|
||||
GNUNET_CRYPTO_rsa_sign (dki->denom_priv.rsa_private_key,
|
||||
&coin.coin_pub.eddsa_pub,
|
||||
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey))));
|
||||
}
|
||||
{ //csig
|
||||
struct u32_presign
|
||||
{
|
||||
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
|
||||
uint32_t data;
|
||||
} unsigned_data;
|
||||
struct GNUNET_CRYPTO_EddsaPrivateKey *eddsa_prvt;
|
||||
|
||||
GNUNET_assert (NULL !=
|
||||
(eddsa_prvt = GNUNET_CRYPTO_eddsa_key_create ()));
|
||||
unsigned_data.data = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
|
||||
UINT32_MAX);
|
||||
unsigned_data.purpose.size = htonl (sizeof (struct u32_presign));
|
||||
unsigned_data.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST);
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
GNUNET_CRYPTO_eddsa_sign (eddsa_prvt,
|
||||
&unsigned_data.purpose,
|
||||
&csig.eddsa_signature));
|
||||
GNUNET_free (eddsa_prvt);
|
||||
}
|
||||
{ //merchant_pub
|
||||
struct GNUNET_CRYPTO_EddsaPrivateKey *eddsa_prv;
|
||||
|
||||
GNUNET_assert(NULL !=
|
||||
(eddsa_prv = GNUNET_CRYPTO_eddsa_key_create ()));
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (
|
||||
eddsa_prv,
|
||||
&merchant_pub.eddsa_pub);
|
||||
GNUNET_free (eddsa_prv);
|
||||
}
|
||||
GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
|
||||
&h_contract);
|
||||
GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
|
||||
&h_wire);
|
||||
timestamp = GNUNET_TIME_absolute_get ();
|
||||
refund_deadline = GNUNET_TIME_absolute_get ();
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_string_to_amount (CURRENCY ":1.1",
|
||||
&amount_with_fee));
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_string_to_amount (CURRENCY ":0.1",
|
||||
&deposit_fee));
|
||||
deposit->coin = coin;
|
||||
deposit->csig = csig;
|
||||
deposit->h_contract = h_contract;
|
||||
deposit->h_wire = h_wire;
|
||||
deposit->wire = json_loads (wire, 0, NULL);
|
||||
deposit->transaction_id = transaction_id++;
|
||||
deposit->timestamp = timestamp;
|
||||
deposit->refund_deadline = refund_deadline;
|
||||
deposit->amount_with_fee = amount_with_fee;
|
||||
deposit->deposit_fee = deposit_fee;
|
||||
return deposit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copies the given deposit
|
||||
* @param reserve the deposit copy
|
||||
* @return a copy of @a deposit; NULL if error
|
||||
*/
|
||||
struct TALER_MINTDB_Deposit *
|
||||
PERF_TALER_MINTDB_deposit_copy (const struct TALER_MINTDB_Deposit *deposit)
|
||||
{
|
||||
struct TALER_MINTDB_Deposit *copy;
|
||||
|
||||
GNUNET_assert (NULL != (copy = GNUNET_new (struct TALER_MINTDB_Deposit)));
|
||||
*copy = *deposit;
|
||||
json_incref (copy->wire);
|
||||
GNUNET_assert (NULL !=
|
||||
(copy->coin.denom_pub.rsa_public_key =
|
||||
GNUNET_CRYPTO_rsa_public_key_dup (deposit->coin.denom_pub.rsa_public_key)));
|
||||
{
|
||||
char *buffer = NULL;
|
||||
int size;
|
||||
GNUNET_assert (0 <
|
||||
(size = GNUNET_CRYPTO_rsa_signature_encode (
|
||||
deposit->coin.denom_sig.rsa_signature,
|
||||
&buffer)));
|
||||
GNUNET_assert (NULL !=
|
||||
(copy->coin.denom_sig.rsa_signature =
|
||||
GNUNET_CRYPTO_rsa_signature_decode(buffer, size)));
|
||||
GNUNET_free (buffer);
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Free memory of a deposit
|
||||
* @param deposit pointer to the structure to free
|
||||
*/
|
||||
int
|
||||
PERF_TALER_MINTDB_deposit_free (struct TALER_MINTDB_Deposit *deposit)
|
||||
{
|
||||
if ( NULL == deposit)
|
||||
return GNUNET_OK;
|
||||
GNUNET_CRYPTO_rsa_public_key_free (deposit->coin.denom_pub.rsa_public_key);
|
||||
GNUNET_CRYPTO_rsa_signature_free (deposit->coin.denom_sig.rsa_signature);
|
||||
json_decref (deposit->wire);
|
||||
GNUNET_free (deposit);
|
||||
|
||||
return GNUNET_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate a CollectableBlindcoin for testing purpuses
|
||||
* @param dki denomination key used to sign the coin
|
||||
* @param reserve reserve providing the money for the coin
|
||||
* @return a randomly generated CollectableBlindcoin
|
||||
*/
|
||||
struct TALER_MINTDB_CollectableBlindcoin *
|
||||
PERF_TALER_MINTDB_collectable_blindcoin_init (
|
||||
const struct TALER_MINTDB_DenominationKeyIssueInformation *dki,
|
||||
const struct TALER_MINTDB_Reserve *reserve)
|
||||
{
|
||||
uint32_t random_int;
|
||||
struct GNUNET_CRYPTO_rsa_PrivateKey *denomination_key;
|
||||
struct GNUNET_CRYPTO_EddsaPrivateKey *reserve_sig_key;
|
||||
struct {
|
||||
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
|
||||
uint32_t data;
|
||||
} unsigned_data;
|
||||
struct TALER_MINTDB_CollectableBlindcoin *coin;
|
||||
|
||||
GNUNET_assert (NULL !=
|
||||
(coin = GNUNET_new (struct TALER_MINTDB_CollectableBlindcoin)));
|
||||
GNUNET_assert (NULL !=
|
||||
(reserve_sig_key = GNUNET_CRYPTO_eddsa_key_create ()));
|
||||
{
|
||||
char *buffer = NULL;
|
||||
int size;
|
||||
GNUNET_assert (0 <
|
||||
(size = GNUNET_CRYPTO_rsa_private_key_encode (
|
||||
dki->denom_priv.rsa_private_key,
|
||||
&buffer)));
|
||||
GNUNET_assert (NULL !=
|
||||
(denomination_key =
|
||||
GNUNET_CRYPTO_rsa_private_key_decode (buffer, size)));
|
||||
GNUNET_free (buffer);
|
||||
}
|
||||
GNUNET_assert (NULL !=
|
||||
(coin->denom_pub.rsa_public_key =
|
||||
GNUNET_CRYPTO_rsa_private_key_get_public (denomination_key)));
|
||||
coin->reserve_pub.eddsa_pub = reserve->pub.eddsa_pub;
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_string_to_amount (CURRENCY ":1.1",
|
||||
&coin->amount_with_fee));
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_string_to_amount (CURRENCY ":1.1",
|
||||
&coin->withdraw_fee));
|
||||
random_int =
|
||||
GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX);
|
||||
GNUNET_assert (NULL !=
|
||||
(coin->sig.rsa_signature =
|
||||
GNUNET_CRYPTO_rsa_sign (denomination_key,
|
||||
&random_int,
|
||||
sizeof (random_int))));
|
||||
char *buffer;
|
||||
GNUNET_CRYPTO_rsa_signature_encode (coin->sig.rsa_signature, &buffer);
|
||||
free (buffer);
|
||||
GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
|
||||
&coin->h_coin_envelope);
|
||||
unsigned_data.purpose.size = htonl (sizeof (unsigned_data));
|
||||
unsigned_data.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST);
|
||||
unsigned_data.data = htonl (random_int);
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
GNUNET_CRYPTO_eddsa_sign (reserve_sig_key,
|
||||
(struct GNUNET_CRYPTO_EccSignaturePurpose *) &unsigned_data,
|
||||
&coin->reserve_sig.eddsa_signature));
|
||||
GNUNET_free (reserve_sig_key);
|
||||
GNUNET_CRYPTO_rsa_private_key_free (denomination_key);
|
||||
return coin;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copies the given coin
|
||||
* @param coin the coin to copy
|
||||
* @return a copy of coin; NULL if error
|
||||
*/
|
||||
struct TALER_MINTDB_CollectableBlindcoin *
|
||||
PERF_TALER_MINTDB_collectable_blindcoin_copy (const struct TALER_MINTDB_CollectableBlindcoin *coin)
|
||||
{
|
||||
struct TALER_MINTDB_CollectableBlindcoin *copy;
|
||||
|
||||
GNUNET_assert (NULL !=
|
||||
(copy = GNUNET_new (struct TALER_MINTDB_CollectableBlindcoin)));
|
||||
*copy = *coin;
|
||||
// No signature copy function found, Hacking it in
|
||||
{
|
||||
char *buffer = NULL;
|
||||
int size;
|
||||
GNUNET_assert (0 <
|
||||
(size = GNUNET_CRYPTO_rsa_signature_encode (
|
||||
coin->sig.rsa_signature,
|
||||
&buffer)));
|
||||
GNUNET_assert (NULL !=
|
||||
(copy->sig.rsa_signature = GNUNET_CRYPTO_rsa_signature_decode(
|
||||
buffer,
|
||||
size)));
|
||||
GNUNET_free (buffer);
|
||||
}
|
||||
GNUNET_assert (NULL !=
|
||||
(copy->denom_pub.rsa_public_key =
|
||||
GNUNET_CRYPTO_rsa_public_key_dup (coin->denom_pub.rsa_public_key)));
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Liberate memory of @a coin
|
||||
* @param coin pointer to the structure to free
|
||||
*/
|
||||
int
|
||||
PERF_TALER_MINTDB_collectable_blindcoin_free (struct TALER_MINTDB_CollectableBlindcoin *coin)
|
||||
{
|
||||
if (NULL == coin)
|
||||
return GNUNET_OK;
|
||||
|
||||
GNUNET_CRYPTO_rsa_signature_free (coin->sig.rsa_signature);
|
||||
GNUNET_CRYPTO_rsa_public_key_free (coin->denom_pub.rsa_public_key);
|
||||
GNUNET_free (coin);
|
||||
return GNUNET_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return a randomly generated refresh session
|
||||
*/
|
||||
struct TALER_MINTDB_RefreshSession *
|
||||
PERF_TALER_MINTDB_refresh_session_init ()
|
||||
{
|
||||
struct TALER_MINTDB_RefreshSession *refresh_session;
|
||||
|
||||
GNUNET_assert (NULL !=
|
||||
(refresh_session = GNUNET_new (struct TALER_MINTDB_RefreshSession)));
|
||||
refresh_session->noreveal_index = 1;
|
||||
refresh_session->num_oldcoins = 1;
|
||||
refresh_session->num_newcoins = 1;
|
||||
|
||||
return refresh_session;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Free a refresh session
|
||||
*/
|
||||
int
|
||||
PERF_TALER_MINTDB_refresh_session_free (struct TALER_MINTDB_RefreshSession *refresh_session)
|
||||
{
|
||||
GNUNET_free (refresh_session);
|
||||
return GNUNET_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate a random CoinPublicInfo
|
||||
*/
|
||||
|
@ -27,74 +27,114 @@
|
||||
#define CURRENCY "EUR"
|
||||
|
||||
|
||||
/**
|
||||
* @return a randomly generated CollectableBlindcoin
|
||||
*/
|
||||
struct TALER_MINTDB_CollectableBlindcoin *
|
||||
PERF_TALER_MINTDB_collectable_blindcoin_init (void);
|
||||
|
||||
|
||||
/**
|
||||
* Liberate memory of @a coin
|
||||
*/
|
||||
int
|
||||
PERF_TALER_MINTDB_collectable_blindcoin_free (struct TALER_MINTDB_CollectableBlindcoin *NAME);
|
||||
|
||||
|
||||
/**
|
||||
* @return a randomly generated reserve
|
||||
*/
|
||||
struct TALER_MINTDB_Reserve *
|
||||
PERF_TALER_MINTDB_reserve_init (void);
|
||||
|
||||
|
||||
/**
|
||||
* Free memory of a reserve
|
||||
*/
|
||||
int
|
||||
PERF_TALER_MINTDB_reserve_free (struct TALER_MINTDB_Reserve *reserve);
|
||||
|
||||
|
||||
/**
|
||||
* @return a randomly generated refresh session
|
||||
*/
|
||||
struct TALER_MINTDB_RefreshSession *
|
||||
PERF_TALER_MINTDB_refresh_session_init (void);
|
||||
|
||||
|
||||
/**
|
||||
* Frees memory of a refresh_session
|
||||
*/
|
||||
int
|
||||
PERF_TALER_MINTDB_refresh_session_free (struct TALER_MINTDB_RefreshSession *refresh_session);
|
||||
|
||||
|
||||
/**
|
||||
* Create a randomly generated deposit
|
||||
*/
|
||||
struct TALER_MINTDB_Deposit *
|
||||
PERF_TALER_MINTDB_deposit_init (void);
|
||||
|
||||
|
||||
/**
|
||||
* Free memory of a deposit
|
||||
*/
|
||||
int
|
||||
PERF_TALER_MINTDB_deposit_free (struct TALER_MINTDB_Deposit *deposit);
|
||||
|
||||
|
||||
/**
|
||||
* Generate a randomly generate DenominationKeyInformation
|
||||
* Generate a dummy DenominationKeyInformation for testing purposes
|
||||
* @return a dummy denomination key
|
||||
*/
|
||||
struct TALER_MINTDB_DenominationKeyIssueInformation *
|
||||
PERF_TALER_MINTDB_denomination_init (void);
|
||||
|
||||
|
||||
/**
|
||||
* Free memory for a DenominationKeyIssueInformation
|
||||
* Copies the given denomination
|
||||
* @param reserve the deposit copy
|
||||
* @return a copy of @a deposit; NULL if error
|
||||
*/
|
||||
struct TALER_MINTDB_DenominationKeyIssueInformation *
|
||||
PERF_TALER_MINTDB_denomination_copy (
|
||||
const struct TALER_MINTDB_DenominationKeyIssueInformation *dki);
|
||||
|
||||
|
||||
/**
|
||||
* Free memory of a DenominationKeyIssueInformation
|
||||
* @param dki pointer to the struct to free
|
||||
*/
|
||||
int
|
||||
PERF_TALER_MINTDB_denomination_free (struct TALER_MINTDB_DenominationKeyIssueInformation *dki);
|
||||
PERF_TALER_MINTDB_denomination_free (
|
||||
struct TALER_MINTDB_DenominationKeyIssueInformation *dki);
|
||||
|
||||
|
||||
/**
|
||||
* Generate a dummy reserve for testing
|
||||
* @return a reserve with 1000 EUR in it
|
||||
*/
|
||||
struct TALER_MINTDB_Reserve *
|
||||
PERF_TALER_MINTDB_reserve_init (void);
|
||||
|
||||
|
||||
/**
|
||||
* Copies the given reserve
|
||||
* @param reserve the reserve to copy
|
||||
* @return a copy of @a reserve; NULL if error
|
||||
*/
|
||||
struct TALER_MINTDB_Reserve *
|
||||
PERF_TALER_MINTDB_reserve_copy (const struct TALER_MINTDB_Reserve *reserve);
|
||||
|
||||
|
||||
/**
|
||||
* Free memory of a reserve
|
||||
* @param reserve pointer to the structure to be freed
|
||||
*/
|
||||
int
|
||||
PERF_TALER_MINTDB_reserve_free (struct TALER_MINTDB_Reserve *reserve);
|
||||
|
||||
|
||||
/**
|
||||
* Generate a dummy deposit for testing purposes
|
||||
* @param dki the denomination key used to sign the key
|
||||
*/
|
||||
struct TALER_MINTDB_Deposit *
|
||||
PERF_TALER_MINTDB_deposit_init (
|
||||
const struct TALER_MINTDB_DenominationKeyIssueInformation *dki);
|
||||
|
||||
|
||||
/**
|
||||
* Copies the given deposit
|
||||
* @param reserve the deposit copy
|
||||
* @return a copy of @a deposit; NULL if error
|
||||
*/
|
||||
struct TALER_MINTDB_Deposit *
|
||||
PERF_TALER_MINTDB_deposit_copy (const struct TALER_MINTDB_Deposit *deposit);
|
||||
|
||||
|
||||
/**
|
||||
* Free memory of a deposit
|
||||
* @param deposit pointer to the structure to free
|
||||
*/
|
||||
int
|
||||
PERF_TALER_MINTDB_deposit_free (struct TALER_MINTDB_Deposit *deposit);
|
||||
|
||||
|
||||
/**
|
||||
* Generate a CollectableBlindcoin for testing purpuses
|
||||
* @param dki denomination key used to sign the coin
|
||||
* @param reserve reserve providing the money for the coin
|
||||
* @return a randomly generated CollectableBlindcoin
|
||||
*/
|
||||
struct TALER_MINTDB_CollectableBlindcoin *
|
||||
PERF_TALER_MINTDB_collectable_blindcoin_init (
|
||||
const struct TALER_MINTDB_DenominationKeyIssueInformation *dki,
|
||||
const struct TALER_MINTDB_Reserve *reserve);
|
||||
|
||||
|
||||
/**
|
||||
* Copies the given coin
|
||||
* @param coin the coin to copy
|
||||
* @return a copy of coin; NULL if error
|
||||
*/
|
||||
struct TALER_MINTDB_CollectableBlindcoin *
|
||||
PERF_TALER_MINTDB_collectable_blindcoin_copy (
|
||||
const struct TALER_MINTDB_CollectableBlindcoin *coin);
|
||||
|
||||
|
||||
/**
|
||||
* Liberate memory of @a coin
|
||||
* @param coin pointer to the structure to free
|
||||
*/
|
||||
int
|
||||
PERF_TALER_MINTDB_collectable_blindcoin_free (
|
||||
struct TALER_MINTDB_CollectableBlindcoin *coin);
|
||||
|
||||
|
||||
/**
|
||||
@ -109,4 +149,19 @@ PERF_TALER_MINTDB_coin_public_info_init (void);
|
||||
*/
|
||||
int PERF_TALER_MINTDB_coin_public_info_free (struct TALER_CoinPublicInfo *cpi);
|
||||
|
||||
|
||||
/**
|
||||
* @return a randomly generated refresh session
|
||||
*/
|
||||
struct TALER_MINTDB_RefreshSession *
|
||||
PERF_TALER_MINTDB_refresh_session_init (void);
|
||||
|
||||
|
||||
/**
|
||||
* Frees memory of a refresh_session
|
||||
*/
|
||||
int
|
||||
PERF_TALER_MINTDB_refresh_session_free (
|
||||
struct TALER_MINTDB_RefreshSession *refresh_session);
|
||||
|
||||
#endif
|
||||
|
@ -47,9 +47,10 @@ struct PERF_TALER_MINTDB_interpreter_state
|
||||
/**
|
||||
* The current index of the interpreter
|
||||
*/
|
||||
int i;
|
||||
unsigned int i;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Free the memory of @a data, with data of type @a type
|
||||
*/
|
||||
@ -86,8 +87,7 @@ data_free (union PERF_TALER_MINTDB_Data *data, enum PERF_TALER_MINTDB_Type type)
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -99,7 +99,7 @@ data_free (union PERF_TALER_MINTDB_Data *data, enum PERF_TALER_MINTDB_Type type)
|
||||
static int
|
||||
cmd_find (const struct PERF_TALER_MINTDB_Cmd *cmd, const char *search)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
for (i=0; PERF_TALER_MINTDB_CMD_END != cmd[i].command; i++)
|
||||
if (0 == strcmp (cmd[i].label, search))
|
||||
@ -109,39 +109,52 @@ cmd_find (const struct PERF_TALER_MINTDB_Cmd *cmd, const char *search)
|
||||
|
||||
|
||||
/**
|
||||
* Initialization of a command array
|
||||
* Initialization of a command array
|
||||
*/
|
||||
static int
|
||||
cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
|
||||
{
|
||||
int i = 0;
|
||||
unsigned int i = 0;
|
||||
|
||||
for (i=0; PERF_TALER_MINTDB_CMD_END != cmd[i].command; i++)
|
||||
{
|
||||
switch (cmd[i].command)
|
||||
{
|
||||
case PERF_TALER_MINTDB_CMD_SAVE_ARRAY:
|
||||
// Allocation of memory for saving data
|
||||
cmd[i].details.save_array.data_saved =
|
||||
GNUNET_new_array (cmd[i].details.save_array.nb_saved,
|
||||
{
|
||||
int save_label;
|
||||
|
||||
GNUNET_assert (GNUNET_SYSERR !=
|
||||
(save_label = cmd_find (cmd,
|
||||
cmd[i].details.save_array.label_save)));
|
||||
/* Allocation of memory for saving data */
|
||||
cmd[i].details.save_array.data_saved =
|
||||
GNUNET_new_array (cmd[i].details.save_array.nb_saved,
|
||||
union PERF_TALER_MINTDB_Data);
|
||||
/* Getting the type saved from the given label */
|
||||
cmd[i].details.save_array.type_saved =
|
||||
cmd[save_label].exposed_type;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case PERF_TALER_MINTDB_CMD_LOAD_ARRAY:
|
||||
// Creating the permutation array to randomize the data order
|
||||
GNUNET_assert (NULL !=
|
||||
(cmd[i].details.load_array.permutation =
|
||||
GNUNET_CRYPTO_random_permute (
|
||||
GNUNET_CRYPTO_QUALITY_WEAK,
|
||||
cmd[cmd_find (cmd,
|
||||
cmd[i].details
|
||||
.load_array.label_save)]
|
||||
.details.save_array.nb_saved)));
|
||||
/* Creating the permutation array to randomize the data order */
|
||||
{
|
||||
int save_index ;
|
||||
|
||||
// Initializing the type based on the type of the saved array
|
||||
cmd[i].exposed_type = cmd[cmd_find (cmd,
|
||||
cmd[i].details.load_array.label_save)]
|
||||
.details.save_array.type_saved;
|
||||
GNUNET_assert (GNUNET_SYSERR !=
|
||||
(save_index = cmd_find (
|
||||
cmd,
|
||||
cmd[i].details.load_array.label_save)));
|
||||
GNUNET_assert (NULL !=
|
||||
(cmd[i].details.load_array.permutation =
|
||||
GNUNET_CRYPTO_random_permute (
|
||||
GNUNET_CRYPTO_QUALITY_WEAK,
|
||||
cmd[save_index].details.save_array.nb_saved)));
|
||||
/* Initializing the type based on the type of the saved array */
|
||||
cmd[i].exposed_type = cmd[save_index].details.save_array.type_saved;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -158,7 +171,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
|
||||
static int
|
||||
cmd_clean (struct PERF_TALER_MINTDB_Cmd cmd[])
|
||||
{
|
||||
int i = 0;
|
||||
unsigned int i = 0;
|
||||
|
||||
for (i = 0; PERF_TALER_MINTDB_CMD_END != cmd[i].command; i++)
|
||||
{
|
||||
@ -166,7 +179,7 @@ cmd_clean (struct PERF_TALER_MINTDB_Cmd cmd[])
|
||||
{
|
||||
case PERF_TALER_MINTDB_CMD_SAVE_ARRAY:
|
||||
{
|
||||
int j;
|
||||
unsigned int j;
|
||||
for (j = 0; j < cmd[i].details.save_array.nb_saved; j++)
|
||||
{
|
||||
data_free (&cmd[i].details.save_array.data_saved[j],
|
||||
@ -198,30 +211,29 @@ cmd_clean (struct PERF_TALER_MINTDB_Cmd cmd[])
|
||||
static void
|
||||
interpret_end_loop (struct PERF_TALER_MINTDB_interpreter_state *state)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
union PERF_TALER_MINTDB_Data zero = {0};
|
||||
int jump = cmd_find (state->cmd,
|
||||
state->cmd[state->i].details.end_loop.label_loop);
|
||||
int jump;
|
||||
GNUNET_assert (GNUNET_SYSERR !=
|
||||
(jump = cmd_find (state->cmd,
|
||||
state->cmd[state->i]
|
||||
.details.end_loop.label_loop)));
|
||||
// Cleaning up the memory in the loop
|
||||
for (i = jump; i < state->i; i++)
|
||||
{
|
||||
// If the exposed variable has not been copied it is freed
|
||||
if ( GNUNET_NO == state->cmd[i].exposed_saved)
|
||||
data_free (&state->cmd[i].exposed, state->cmd[i].exposed_type);
|
||||
state->cmd[i].exposed_saved = GNUNET_NO;
|
||||
// Anyway we need to make the data zero.
|
||||
data_free (&state->cmd[i].exposed, state->cmd[i].exposed_type);
|
||||
state->cmd[i].exposed = zero;
|
||||
}
|
||||
|
||||
state->cmd[jump].details.loop.curr_iteration++;
|
||||
// If the loop is not finished
|
||||
if (state->cmd[jump].details.loop.max_iterations >
|
||||
/* If the loop is not finished */
|
||||
if (state->cmd[jump].details.loop.max_iterations >
|
||||
state->cmd[jump].details.loop.curr_iteration)
|
||||
{
|
||||
// jump back to the start
|
||||
/* jump back to the start */
|
||||
state->i = jump;
|
||||
}else{
|
||||
// Reset the loop counter and continue running
|
||||
/* Reset the loop counter and continue running */
|
||||
state->cmd[jump].details.loop.curr_iteration = 0;
|
||||
}
|
||||
}
|
||||
@ -234,37 +246,40 @@ interpret_end_loop (struct PERF_TALER_MINTDB_interpreter_state *state)
|
||||
static void
|
||||
interpret_save_array (struct PERF_TALER_MINTDB_interpreter_state *state)
|
||||
{
|
||||
int loop_index;
|
||||
int selection_chance;
|
||||
int loop_index, save_index;
|
||||
unsigned int selection_chance;
|
||||
|
||||
// Array initialization on first loop iteration
|
||||
// Alows for nested loops
|
||||
if (0 == state->cmd[cmd_find (state->cmd,
|
||||
state->cmd[state->i]
|
||||
.details.save_array.label_loop)]
|
||||
.details.loop.curr_iteration)
|
||||
GNUNET_assert (GNUNET_SYSERR !=
|
||||
(loop_index = cmd_find (state->cmd,
|
||||
state->cmd[state->i]
|
||||
.details.save_array.label_loop)));
|
||||
GNUNET_assert (GNUNET_SYSERR !=
|
||||
(save_index = cmd_find (state->cmd,
|
||||
state->cmd[state->i]
|
||||
.details.save_array.label_save)));
|
||||
/* Array initialization on first loop iteration
|
||||
Alows for nested loops */
|
||||
if (0 == state->cmd[loop_index].details.loop.curr_iteration)
|
||||
{
|
||||
state->cmd[state->i].details.save_array.index = 0;
|
||||
}
|
||||
loop_index = cmd_find (state->cmd,
|
||||
state->cmd[state->i].details.save_array.label_loop);
|
||||
// The probobility distribution of the saved items will be a little biased
|
||||
// against the few last items but it should not be a big problem.
|
||||
/* The probobility distribution of the saved items will be a little biased
|
||||
against the few last items but it should not be a big problem. */
|
||||
selection_chance = state->cmd[loop_index].details.loop.max_iterations /
|
||||
state->cmd[state->i].details.save_array.nb_saved;
|
||||
/*
|
||||
* If the remaining sapce is equal to the remaining number of
|
||||
* If the remaining space is equal to the remaining number of
|
||||
* iterations, the item is automaticly saved.
|
||||
*
|
||||
* Else it is saved only if rdn is 0
|
||||
* Else it is saved only if the random numbre generated is 0
|
||||
*/
|
||||
if ((0 < (state->cmd[state->i].details.save_array.nb_saved -
|
||||
if ((0 < (state->cmd[state->i].details.save_array.nb_saved -
|
||||
state->cmd[state->i].details.save_array.index)) &&
|
||||
(((state->cmd[loop_index].details.loop.max_iterations -
|
||||
(((state->cmd[loop_index].details.loop.max_iterations -
|
||||
state->cmd[loop_index].details.loop.curr_iteration) ==
|
||||
(state->cmd[state->i].details.save_array.nb_saved -
|
||||
(state->cmd[state->i].details.save_array.nb_saved -
|
||||
state->cmd[state->i].details.save_array.index))
|
||||
|| (0 == GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
|
||||
|| (0 == GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
|
||||
selection_chance))))
|
||||
{
|
||||
union PERF_TALER_MINTDB_Data *save_location;
|
||||
@ -272,10 +287,7 @@ interpret_save_array (struct PERF_TALER_MINTDB_interpreter_state *state)
|
||||
|
||||
save_location = &state->cmd[state->i].details.save_array
|
||||
.data_saved[state->cmd[state->i].details.save_array.index];
|
||||
item_saved = &state->cmd[cmd_find (state->cmd,
|
||||
state->cmd[state->i]
|
||||
.details.save_array.label_save)]
|
||||
.exposed;
|
||||
item_saved = &state->cmd[save_index].exposed;
|
||||
switch (state->cmd[state->i].details.save_array.type_saved)
|
||||
{
|
||||
case PERF_TALER_MINTDB_TIME:
|
||||
@ -283,19 +295,19 @@ interpret_save_array (struct PERF_TALER_MINTDB_interpreter_state *state)
|
||||
break;
|
||||
|
||||
case PERF_TALER_MINTDB_DEPOSIT:
|
||||
save_location->deposit = item_saved->deposit;
|
||||
save_location->deposit = PERF_TALER_MINTDB_deposit_copy (item_saved->deposit);
|
||||
break;
|
||||
|
||||
case PERF_TALER_MINTDB_BLINDCOIN:
|
||||
save_location->blindcoin = item_saved->blindcoin;
|
||||
save_location->blindcoin = PERF_TALER_MINTDB_collectable_blindcoin_copy (item_saved->blindcoin);
|
||||
break;
|
||||
|
||||
case PERF_TALER_MINTDB_RESERVE:
|
||||
save_location->reserve = item_saved->reserve;
|
||||
save_location->reserve = PERF_TALER_MINTDB_reserve_copy (item_saved->reserve);
|
||||
break;
|
||||
|
||||
case PERF_TALER_MINTDB_DENOMINATION_INFO:
|
||||
save_location->dki = item_saved->dki;
|
||||
save_location->dki = PERF_TALER_MINTDB_denomination_copy (item_saved->dki);
|
||||
break;
|
||||
|
||||
case PERF_TALER_MINTDB_COIN_INFO:
|
||||
@ -305,32 +317,45 @@ interpret_save_array (struct PERF_TALER_MINTDB_interpreter_state *state)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
state->cmd[cmd_find (state->cmd,
|
||||
state->cmd[state->i].details.save_array.label_save)]
|
||||
.exposed_saved = GNUNET_YES;
|
||||
state->cmd[state->i].details.save_array.index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run when the current command is LOAD_ARRAY
|
||||
* Get data from a SAVE_ARRAY and exposes a copy
|
||||
*/
|
||||
static void
|
||||
interpret_load_array (struct PERF_TALER_MINTDB_interpreter_state *state)
|
||||
{
|
||||
unsigned int loop_iter;
|
||||
int loop_index, save_index;
|
||||
union PERF_TALER_MINTDB_Data zero = {0};
|
||||
union PERF_TALER_MINTDB_Data *loaded_data;
|
||||
|
||||
loop_index = cmd_find (state->cmd,
|
||||
state->cmd[state->i].details.load_array.label_loop);
|
||||
save_index = cmd_find (state->cmd,
|
||||
state->cmd[state->i].details.load_array.label_save);
|
||||
GNUNET_assert (GNUNET_SYSERR !=
|
||||
(loop_index = cmd_find (state->cmd,
|
||||
state->cmd[state->i]
|
||||
.details.load_array.label_loop)));
|
||||
GNUNET_assert (GNUNET_SYSERR !=
|
||||
(save_index = cmd_find (state->cmd,
|
||||
state->cmd[state->i]
|
||||
.details.load_array.label_save)));
|
||||
loop_iter = state->cmd[loop_index].details.loop.curr_iteration;
|
||||
{
|
||||
int i, quotient;
|
||||
|
||||
/* in case the iteration number is higher than the amount saved,
|
||||
* the number is run several times in the permutation array */
|
||||
quotient = loop_iter / state->cmd[save_index].details.save_array.nb_saved;
|
||||
loop_iter = loop_iter % state->cmd[save_index].details.save_array.nb_saved;
|
||||
for (i=0; i<=quotient; i++)
|
||||
loop_iter = state->cmd[state->i].details.load_array.permutation[loop_iter];
|
||||
}
|
||||
/* Extracting the data from the loop_indexth indice in save_index
|
||||
* array.
|
||||
*/
|
||||
loaded_data = &state->cmd[save_index].details.save_array.data_saved[
|
||||
state->cmd[state->i].details.load_array.permutation[
|
||||
state->cmd[loop_index].details.loop.curr_iteration]];
|
||||
|
||||
loaded_data = &state->cmd[save_index].details.save_array.data_saved[loop_iter];
|
||||
switch (state->cmd[state->i].exposed_type)
|
||||
{
|
||||
case PERF_TALER_MINTDB_TIME:
|
||||
@ -338,31 +363,37 @@ interpret_load_array (struct PERF_TALER_MINTDB_interpreter_state *state)
|
||||
break;
|
||||
|
||||
case PERF_TALER_MINTDB_DEPOSIT:
|
||||
state->cmd[state->i].exposed.deposit = loaded_data->deposit;
|
||||
state->cmd[state->i].exposed.deposit =
|
||||
PERF_TALER_MINTDB_deposit_copy (loaded_data->deposit);
|
||||
break;
|
||||
|
||||
case PERF_TALER_MINTDB_BLINDCOIN:
|
||||
state->cmd[state->i].exposed.blindcoin = loaded_data->blindcoin;
|
||||
state->cmd[state->i].exposed.blindcoin =
|
||||
PERF_TALER_MINTDB_collectable_blindcoin_copy (loaded_data->blindcoin);
|
||||
break;
|
||||
|
||||
case PERF_TALER_MINTDB_RESERVE:
|
||||
state->cmd[state->i].exposed.reserve = loaded_data->reserve;
|
||||
state->cmd[state->i].exposed.reserve =
|
||||
PERF_TALER_MINTDB_reserve_copy (loaded_data->reserve);
|
||||
break;
|
||||
|
||||
case PERF_TALER_MINTDB_DENOMINATION_INFO:
|
||||
state->cmd[state->i].exposed.dki = loaded_data->dki;
|
||||
state->cmd[state->i].exposed.dki =
|
||||
PERF_TALER_MINTDB_denomination_copy (loaded_data->dki);
|
||||
break;
|
||||
|
||||
case PERF_TALER_MINTDB_COIN_INFO:
|
||||
state->cmd[state->i].exposed.cpi = loaded_data->cpi;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
*loaded_data = zero;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main interpreter loop.
|
||||
*
|
||||
*
|
||||
*/
|
||||
static int
|
||||
interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
|
||||
@ -376,7 +407,7 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
|
||||
return GNUNET_YES;
|
||||
|
||||
case PERF_TALER_MINTDB_CMD_DEBUG:
|
||||
printf ("%s\n", state->cmd[state->i].label);
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", state->cmd[state->i].label);
|
||||
break;
|
||||
|
||||
case PERF_TALER_MINTDB_CMD_LOOP:
|
||||
@ -392,22 +423,26 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
|
||||
|
||||
case PERF_TALER_MINTDB_CMD_GAUGER:
|
||||
{
|
||||
int start_index, stop_index;
|
||||
int start_index, stop_index;
|
||||
struct timespec start, stop;
|
||||
unsigned long elapsed_ms;
|
||||
|
||||
start_index = cmd_find (state->cmd,
|
||||
state->cmd[state->i].details.gauger.label_start);
|
||||
stop_index = cmd_find (state->cmd,
|
||||
state->cmd[state->i].details.gauger.label_stop);
|
||||
GNUNET_assert (GNUNET_SYSERR !=
|
||||
(start_index = cmd_find (state->cmd,
|
||||
state->cmd[state->i]
|
||||
.details.gauger.label_start)));
|
||||
GNUNET_assert (GNUNET_SYSERR !=
|
||||
(stop_index = cmd_find (state->cmd,
|
||||
state->cmd[state->i]
|
||||
.details.gauger.label_stop)));
|
||||
start = state->cmd[start_index].exposed.time;
|
||||
stop = state->cmd[stop_index].exposed.time;
|
||||
elapsed_ms = (start.tv_sec - stop.tv_sec) * 1000 +
|
||||
elapsed_ms = (start.tv_sec - stop.tv_sec) * 1000 +
|
||||
(start.tv_nsec - stop.tv_nsec) / 1000000;
|
||||
|
||||
GAUGER ("MINTDB",
|
||||
state->cmd[state->i].details.gauger.description,
|
||||
elapsed_ms,
|
||||
GAUGER ("MINTDB",
|
||||
state->cmd[state->i].details.gauger.description,
|
||||
elapsed_ms / state->cmd[state->i].details.gauger.divide,
|
||||
"milliseconds");
|
||||
}
|
||||
break;
|
||||
@ -437,12 +472,19 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
|
||||
|
||||
case PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT:
|
||||
{
|
||||
struct TALER_MINTDB_Deposit *deposit =
|
||||
PERF_TALER_MINTDB_deposit_init ();
|
||||
int dki_index;
|
||||
struct TALER_MINTDB_Deposit *deposit;
|
||||
GNUNET_assert (GNUNET_SYSERR !=
|
||||
(dki_index = cmd_find(state->cmd,
|
||||
state->cmd[state->i]
|
||||
.details.insert_deposit.label_dki)));
|
||||
GNUNET_assert (NULL !=
|
||||
(deposit = PERF_TALER_MINTDB_deposit_init (
|
||||
state->cmd[dki_index].exposed.dki)));
|
||||
|
||||
GNUNET_assert (
|
||||
state->plugin->insert_deposit (state->plugin->cls,
|
||||
state->session,
|
||||
state->plugin->insert_deposit (state->plugin->cls,
|
||||
state->session,
|
||||
deposit));
|
||||
state->cmd[state->i].exposed.deposit = deposit;
|
||||
}
|
||||
@ -450,25 +492,30 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
|
||||
|
||||
case PERF_TALER_MINTDB_CMD_GET_DEPOSIT:
|
||||
{
|
||||
struct TALER_MINTDB_Deposit *deposit =
|
||||
state->cmd[cmd_find (state->cmd,
|
||||
state->cmd[state->i]
|
||||
.details.get_deposit.label_source)]
|
||||
.exposed.deposit; // Get the deposit from the source
|
||||
int source_index;
|
||||
struct TALER_MINTDB_Deposit *deposit;
|
||||
|
||||
state->plugin->have_deposit (state->plugin->cls,
|
||||
state->session,
|
||||
GNUNET_assert (GNUNET_SYSERR !=
|
||||
(source_index = cmd_find (state->cmd,
|
||||
state->cmd[state->i]
|
||||
.details.get_deposit.label_source)));
|
||||
GNUNET_assert (NULL !=
|
||||
(deposit = state->cmd[source_index].exposed.deposit));
|
||||
state->plugin->have_deposit (state->plugin->cls,
|
||||
state->session,
|
||||
deposit);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case PERF_TALER_MINTDB_CMD_INSERT_RESERVE:
|
||||
{
|
||||
struct TALER_MINTDB_Reserve *reserve;
|
||||
json_t *details = json_pack ("si","justification",
|
||||
GNUNET_CRYPTO_random_u32 (
|
||||
GNUNET_CRYPTO_QUALITY_WEAK,
|
||||
UINT32_MAX));
|
||||
json_t *details = NULL;
|
||||
GNUNET_assert (NULL !=
|
||||
(details = json_pack ("{s:i}","justification",
|
||||
GNUNET_CRYPTO_random_u32 (
|
||||
GNUNET_CRYPTO_QUALITY_WEAK,
|
||||
UINT32_MAX))));
|
||||
reserve = PERF_TALER_MINTDB_reserve_init ();
|
||||
state->plugin->reserves_in_insert (
|
||||
state->plugin->cls,
|
||||
@ -476,7 +523,7 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
|
||||
&reserve->pub,
|
||||
&reserve->balance,
|
||||
details
|
||||
);
|
||||
);
|
||||
json_decref (details);
|
||||
state->cmd[state->i].exposed.reserve = reserve;
|
||||
}
|
||||
@ -484,17 +531,21 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
|
||||
|
||||
case PERF_TALER_MINTDB_CMD_GET_RESERVE:
|
||||
{
|
||||
struct TALER_MINTDB_Reserve *reserve =
|
||||
state->cmd[cmd_find (state->cmd,
|
||||
state->cmd[state->i]
|
||||
.details.get_reserve.label_source)]
|
||||
.exposed.reserve; // Get the deposit from the source
|
||||
int source_index;
|
||||
struct TALER_MINTDB_Reserve *reserve;
|
||||
|
||||
state->plugin->reserve_get (state->plugin->cls,
|
||||
state->session,
|
||||
reserve);
|
||||
GNUNET_assert (GNUNET_SYSERR !=
|
||||
(source_index = cmd_find (state->cmd,
|
||||
state->cmd[state->i]
|
||||
.details.get_reserve.label_source)));
|
||||
GNUNET_assert (NULL !=
|
||||
(reserve = state->cmd[source_index].exposed.reserve));
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
(state->plugin->reserve_get (state->plugin->cls,
|
||||
state->session,
|
||||
reserve)));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case PERF_TALER_MINTDB_CMD_INSERT_DENOMINATION:
|
||||
{
|
||||
@ -511,11 +562,15 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
|
||||
|
||||
case PERF_TALER_MINTDB_CMD_GET_DENOMINATION:
|
||||
{
|
||||
struct TALER_MINTDB_DenominationKeyIssueInformation *dki =
|
||||
state->cmd[cmd_find (state->cmd,
|
||||
state->cmd[state->i]
|
||||
.details.get_denomination.label_source)]
|
||||
.exposed.dki;
|
||||
int source_index;
|
||||
struct TALER_MINTDB_DenominationKeyIssueInformation *dki;
|
||||
|
||||
GNUNET_assert (GNUNET_SYSERR !=
|
||||
(source_index = cmd_find (state->cmd,
|
||||
state->cmd[state->i]
|
||||
.details.get_denomination.label_source)));
|
||||
GNUNET_assert (NULL !=
|
||||
(dki = state->cmd[source_index].exposed.dki));
|
||||
state->plugin->get_denomination_info (state->plugin->cls,
|
||||
state->session,
|
||||
&dki->denom_pub,
|
||||
@ -525,8 +580,22 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
|
||||
|
||||
case PERF_TALER_MINTDB_CMD_INSERT_WITHDRAW:
|
||||
{
|
||||
struct TALER_MINTDB_CollectableBlindcoin *blindcoin =
|
||||
PERF_TALER_MINTDB_collectable_blindcoin_init ();
|
||||
int dki_index, reserve_index;
|
||||
struct TALER_MINTDB_CollectableBlindcoin *blindcoin ;
|
||||
|
||||
GNUNET_assert (GNUNET_SYSERR !=
|
||||
(dki_index = cmd_find (
|
||||
state->cmd,
|
||||
state->cmd[state->i].details.insert_withdraw.label_dki)));
|
||||
GNUNET_assert (GNUNET_SYSERR !=
|
||||
(reserve_index = cmd_find (
|
||||
state->cmd,
|
||||
state->cmd[state->i].details.insert_withdraw.label_reserve)));
|
||||
GNUNET_assert (NULL !=
|
||||
(blindcoin =
|
||||
PERF_TALER_MINTDB_collectable_blindcoin_init (
|
||||
state->cmd[dki_index].exposed.dki,
|
||||
state->cmd[reserve_index].exposed.reserve)));
|
||||
|
||||
state->plugin->insert_withdraw_info (state->plugin->cls,
|
||||
state->session,
|
||||
@ -537,12 +606,15 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
|
||||
|
||||
case PERF_TALER_MINTDB_CMD_GET_WITHDRAW:
|
||||
{
|
||||
struct TALER_MINTDB_CollectableBlindcoin *blindcoin =
|
||||
state->cmd[cmd_find (state->cmd,
|
||||
state->cmd[state->i]
|
||||
.details.get_denomination.label_source)]
|
||||
.exposed.blindcoin;
|
||||
|
||||
int source_index;
|
||||
struct TALER_MINTDB_CollectableBlindcoin *blindcoin ;
|
||||
|
||||
GNUNET_assert (GNUNET_SYSERR !=
|
||||
(source_index = cmd_find (state->cmd,
|
||||
state->cmd[state->i]
|
||||
.details.get_denomination.label_source)));
|
||||
GNUNET_assert (NULL !=
|
||||
(blindcoin = state->cmd[source_index].exposed.blindcoin));
|
||||
state->plugin->get_withdraw_info (state->plugin->cls,
|
||||
state->session,
|
||||
&blindcoin->h_coin_envelope,
|
||||
@ -566,7 +638,7 @@ int
|
||||
PERF_TALER_MINTDB_interpret (struct TALER_MINTDB_Plugin *db_plugin,
|
||||
struct PERF_TALER_MINTDB_Cmd cmd[])
|
||||
{
|
||||
struct PERF_TALER_MINTDB_interpreter_state state =
|
||||
struct PERF_TALER_MINTDB_interpreter_state state =
|
||||
{.i = 0, .cmd = cmd, .plugin = db_plugin};
|
||||
|
||||
// Initializing commands
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Prints @ _label to stdout
|
||||
*/
|
||||
#define PERF_TALER_MINTDB_INIT_CMD_DEBUG(_label) \
|
||||
{ \
|
||||
@ -46,6 +46,7 @@
|
||||
.label = _label, \
|
||||
.exposed_type = PERF_TALER_MINTDB_NONE \
|
||||
}
|
||||
|
||||
/**
|
||||
* The begining of a loop
|
||||
* @param _label the name of the loop
|
||||
@ -58,7 +59,7 @@
|
||||
.exposed_type = PERF_TALER_MINTDB_NONE , \
|
||||
.details.loop = { \
|
||||
.max_iterations = _iter , \
|
||||
.curr_iteration = 0} \
|
||||
.curr_iteration = 0 } \
|
||||
}
|
||||
|
||||
/**
|
||||
@ -85,16 +86,21 @@
|
||||
/**
|
||||
* Commits the duration between @a _label_start and @a _label_stop
|
||||
* to Gauger with @a _description explaining
|
||||
* @param _label_start label of the start of the measurment
|
||||
* @param _label_stop label of the end of the measurment
|
||||
* @param _description description of the measure displayed in gauger
|
||||
* @param _divide number of measurments in the interval
|
||||
*/
|
||||
#define PERF_TALER_MINTDB_INIT_CMD_GAUGER(_label, _start_time, _stop_time, _description) \
|
||||
#define PERF_TALER_MINTDB_INIT_CMD_GAUGER(_label, _label_start, _label_stop, _description, _divide) \
|
||||
{ \
|
||||
.command = PERF_TALER_MINTDB_CMD_GAUGER, \
|
||||
.label = _label, \
|
||||
.exposed_type = PERF_TALER_MINTDB_NONE, \
|
||||
.details.gauger = { \
|
||||
.label_start = _label_start, \
|
||||
.label_end = _label_end, \
|
||||
.description = _description \
|
||||
.label_stop = _label_stop, \
|
||||
.description = _description, \
|
||||
.divide = _divide, \
|
||||
} \
|
||||
}
|
||||
|
||||
@ -122,7 +128,7 @@
|
||||
* Extracts @a _nb_saved items of type @a _save_type
|
||||
* from the command @a _label_save during the loop @a _label_loop
|
||||
*/
|
||||
#define PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY(_label, _label_loop, _label_save, _nb_saved, _save_type) \
|
||||
#define PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY(_label, _label_loop, _label_save, _nb_saved) \
|
||||
{ \
|
||||
.command = PERF_TALER_MINTDB_CMD_SAVE_ARRAY, \
|
||||
.label = _label, \
|
||||
@ -131,7 +137,6 @@
|
||||
.label_loop = _label_loop, \
|
||||
.label_save = _label_save, \
|
||||
.nb_saved = _nb_saved, \
|
||||
.type_saved = _save_type \
|
||||
} \
|
||||
}
|
||||
|
||||
@ -149,82 +154,15 @@
|
||||
.label_save = _label_save \
|
||||
} \
|
||||
}
|
||||
/**
|
||||
* Insert a deposit into the database
|
||||
*/
|
||||
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT(_label) \
|
||||
{ \
|
||||
.command = PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT,\
|
||||
.label = _label, \
|
||||
.exposed_type = PERF_TALER_MINTDB_DEPOSIT, \
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a deposit is in the database
|
||||
* @param _label_deposit Label of the deposit to use
|
||||
*/
|
||||
#define PERF_TALER_MINTDB_INIT_CMD_GET_DEPOSIT(_label, _label_deposit) \
|
||||
{ \
|
||||
.command = PERF_TALER_MINTDB_CMD_GET_DEPOSIT, \
|
||||
.label = _label, \
|
||||
.exposed_type = PERF_TALER_MINTDB_NONE, \
|
||||
.details.get_deposit.label_source = _label_deposit \
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new reserve in the database
|
||||
*/
|
||||
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE(_label) \
|
||||
{ \
|
||||
.command = PERF_TALER_MINTDB_CMD_INSERT_RESERVE \
|
||||
.label = _label \
|
||||
.exposed_type = PERF_TALER_MINTDB_RESERVE \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Polls the database for a secific reserve's details
|
||||
* @param _label_source Source for the reserve to poll
|
||||
*/
|
||||
#define PERF_TALER_MINTDB_INIT_CMD_GET_RESERVE(_label, _label_source) \
|
||||
{ \
|
||||
.command = PERF_TALER_MINTDB_CMD_GET_RESERVE \
|
||||
.label = _label, \
|
||||
.exposed_type = PERF_TALER_MINTDB_NONE, \
|
||||
.details.get_reserve.label_source = _label_source \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inserts informations about a withdrawal in the database
|
||||
*/
|
||||
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW(_label) \
|
||||
{ \
|
||||
.command = PERF_TALER_MINTDB_CMD_INSERT_WITHDRAW, \
|
||||
.label = _label, \
|
||||
.exposed_type = PERF_TALER_MINTDB_BLINDCOIN, \
|
||||
}\
|
||||
|
||||
|
||||
/**
|
||||
* Polls the database about informations regarding a secific withdrawal
|
||||
*/
|
||||
#define PERF_TALER_MINTDB_INIT_CMD_GET_WITHDRAW(_label, _label_source) \
|
||||
{ \
|
||||
.command = PERF_TALER_MINTDB_CMD_GET_WITHDRAW, \
|
||||
.label = _label, \
|
||||
.exposed_type = PERF_TALER_MINTDB_NONE, \
|
||||
.details.get_withdraw.label_source = _label_source, \
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts informations about a denomination key in the database
|
||||
*/
|
||||
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_DENOMINATION(_label) \
|
||||
{ \
|
||||
.command = PERF_TALER_MINTDB_CMD_INSERT_WITHDRAW, \
|
||||
.command = PERF_TALER_MINTDB_CMD_INSERT_DENOMINATION, \
|
||||
.label = _label, \
|
||||
.exposed_type = PERF_TALER_MINTDB_DENOMINATION_KEY, \
|
||||
.exposed_type = PERF_TALER_MINTDB_DENOMINATION_INFO, \
|
||||
}
|
||||
|
||||
/**
|
||||
@ -238,6 +176,84 @@
|
||||
.details.get_denomination.label_source = _label_source, \
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new reserve in the database
|
||||
*/
|
||||
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE(_label) \
|
||||
{ \
|
||||
.command = PERF_TALER_MINTDB_CMD_INSERT_RESERVE, \
|
||||
.label = _label, \
|
||||
.exposed_type = PERF_TALER_MINTDB_RESERVE \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Polls the database for a secific reserve's details
|
||||
* @param _label_source Source for the reserve to poll
|
||||
*/
|
||||
#define PERF_TALER_MINTDB_INIT_CMD_GET_RESERVE(_label, _label_source) \
|
||||
{ \
|
||||
.command = PERF_TALER_MINTDB_CMD_GET_RESERVE, \
|
||||
.label = _label, \
|
||||
.exposed_type = PERF_TALER_MINTDB_NONE, \
|
||||
.details.get_reserve.label_source = _label_source \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Insert a deposit into the database
|
||||
* @param _label_dki source to use for the denomination key
|
||||
*/
|
||||
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT(_label, _label_dki) \
|
||||
{ \
|
||||
.command = PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT,\
|
||||
.label = _label, \
|
||||
.exposed_type = PERF_TALER_MINTDB_DEPOSIT, \
|
||||
.details.insert_deposit.label_dki = _label_dki, \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a deposit is in the database
|
||||
* @param _label_deposit Label of the deposit to use
|
||||
*/
|
||||
#define PERF_TALER_MINTDB_INIT_CMD_GET_DEPOSIT(_label, _label_deposit) \
|
||||
{ \
|
||||
.command = PERF_TALER_MINTDB_CMD_GET_DEPOSIT, \
|
||||
.label = _label, \
|
||||
.exposed_type = PERF_TALER_MINTDB_NONE, \
|
||||
.details.get_deposit.label_source = _label_deposit \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inserts informations about a withdrawal in the database
|
||||
* @param _label_dki denomination key used to sign the coin
|
||||
* @param _label_reserve reserve used to emmit the coin
|
||||
*/
|
||||
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW(_label, _label_dki, _label_reserve) \
|
||||
{ \
|
||||
.command = PERF_TALER_MINTDB_CMD_INSERT_WITHDRAW, \
|
||||
.label = _label, \
|
||||
.exposed_type = PERF_TALER_MINTDB_BLINDCOIN, \
|
||||
.details.insert_withdraw = {\
|
||||
.label_dki = _label_dki, \
|
||||
.label_reserve = _label_reserve, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Polls the database about informations regarding a secific withdrawal
|
||||
*/
|
||||
#define PERF_TALER_MINTDB_INIT_CMD_GET_WITHDRAW(_label, _label_source) \
|
||||
{ \
|
||||
.command = PERF_TALER_MINTDB_CMD_GET_WITHDRAW, \
|
||||
.label = _label, \
|
||||
.exposed_type = PERF_TALER_MINTDB_NONE, \
|
||||
.details.get_withdraw.label_source = _label_source, \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The type of data stored
|
||||
@ -249,9 +265,7 @@ enum PERF_TALER_MINTDB_Type
|
||||
PERF_TALER_MINTDB_TIME,
|
||||
PERF_TALER_MINTDB_DEPOSIT,
|
||||
PERF_TALER_MINTDB_BLINDCOIN,
|
||||
PERF_TALER_MINTDB_RESERVE_KEY,
|
||||
PERF_TALER_MINTDB_RESERVE,
|
||||
PERF_TALER_MINTDB_DENOMINATION_KEY,
|
||||
PERF_TALER_MINTDB_DENOMINATION_INFO,
|
||||
PERF_TALER_MINTDB_COIN_INFO,
|
||||
};
|
||||
@ -266,7 +280,6 @@ union PERF_TALER_MINTDB_Data
|
||||
struct TALER_MINTDB_Deposit *deposit;
|
||||
struct TALER_MINTDB_CollectableBlindcoin *blindcoin;
|
||||
struct TALER_MINTDB_Reserve *reserve;
|
||||
struct TALER_DenominationPublicKey *dpk;
|
||||
struct TALER_MINTDB_DenominationKeyIssueInformation *dki;
|
||||
struct TALER_CoinPublicInfo *cpi;
|
||||
};
|
||||
@ -334,8 +347,11 @@ enum PERF_TALER_MINTDB_CMD_Name
|
||||
// Insert informations about a denomination key in the database
|
||||
PERF_TALER_MINTDB_CMD_INSERT_DENOMINATION,
|
||||
|
||||
// polls the database for informations about a specific denomination key
|
||||
PERF_TALER_MINTDB_CMD_GET_DENOMINATION
|
||||
// Polls the database for informations about a specific denomination key
|
||||
PERF_TALER_MINTDB_CMD_GET_DENOMINATION,
|
||||
|
||||
// Refresh a coin
|
||||
PERF_TALER_MINTDB_CMD_REFRESH_COIN,
|
||||
};
|
||||
|
||||
|
||||
@ -346,7 +362,7 @@ struct PERF_TALER_MINTDB_CMD_loop_details
|
||||
{
|
||||
// Maximum number of iteration in the loop
|
||||
const unsigned int max_iterations;
|
||||
int curr_iteration;
|
||||
unsigned int curr_iteration;
|
||||
};
|
||||
|
||||
|
||||
@ -381,6 +397,12 @@ struct PERF_TALER_MINTDB_CMD_gauger_details
|
||||
* Description of the metric, used in GAUGER
|
||||
*/
|
||||
const char *description;
|
||||
|
||||
/**
|
||||
* Constant the result needs to be divided by
|
||||
* to get the result per unit
|
||||
*/
|
||||
float divide;
|
||||
};
|
||||
|
||||
|
||||
@ -438,6 +460,18 @@ struct PERF_TALER_MINTDB_CMD_load_array_details
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Data used by the command insert_deposit
|
||||
*/
|
||||
struct PERF_TALER_MINTDB_CMD_insert_deposit_details
|
||||
{
|
||||
/**
|
||||
* Label of the source where the reserve used to create the coin is
|
||||
*/
|
||||
const char *label_dki;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Extra data requiered for the GET_DEPOSIT command
|
||||
*/
|
||||
@ -470,6 +504,35 @@ struct PERF_TALER_MINTDB_CMD_get_denomination_details
|
||||
const char *label_source;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Extra data related to the get withdraw command
|
||||
*/
|
||||
struct PERF_TALER_MINTDB_CMD_insert_withdraw_details
|
||||
{
|
||||
/**
|
||||
* label of the denomination key used to sign the coin
|
||||
*/
|
||||
const char *label_dki;
|
||||
|
||||
/**
|
||||
* label of the reserve the money to mint the coin comes from
|
||||
*/
|
||||
const char *label_reserve;
|
||||
};
|
||||
|
||||
/**
|
||||
* Extra data requiered for refreshing coins
|
||||
*/
|
||||
struct PERF_TALER_MINTDB_CMD_refresh_coin_details
|
||||
{
|
||||
/**
|
||||
* The label of the coin to refresh
|
||||
*/
|
||||
const char *label_source;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Contains extra data required for any command
|
||||
*/
|
||||
@ -480,9 +543,12 @@ union PERF_TALER_MINTDB_CMD_Details
|
||||
struct PERF_TALER_MINTDB_CMD_gauger_details gauger;
|
||||
struct PERF_TALER_MINTDB_CMD_save_array_details save_array;
|
||||
struct PERF_TALER_MINTDB_CMD_load_array_details load_array;
|
||||
struct PERF_TALER_MINTDB_CMD_insert_deposit_details insert_deposit;
|
||||
struct PERF_TALER_MINTDB_CMD_get_deposit_details get_deposit;
|
||||
struct PERF_TALER_MINTDB_CMD_get_reserve_details get_reserve;
|
||||
struct PERF_TALER_MINTDB_CMD_get_denomination_details get_denomination;
|
||||
struct PERF_TALER_MINTDB_CMD_refresh_coin_details refresh;
|
||||
struct PERF_TALER_MINTDB_CMD_insert_withdraw_details insert_withdraw;
|
||||
};
|
||||
|
||||
|
||||
@ -515,12 +581,6 @@ struct PERF_TALER_MINTDB_Cmd
|
||||
* Data easily accessible
|
||||
*/
|
||||
union PERF_TALER_MINTDB_Data exposed;
|
||||
|
||||
/**
|
||||
* GNUNET_YES if the exposed value hav been saved during last loop iteration
|
||||
* GNUNET_NO if it hasn't
|
||||
*/
|
||||
int exposed_saved;
|
||||
};
|
||||
|
||||
|
||||
@ -533,5 +593,4 @@ PERF_TALER_MINTDB_interpret(
|
||||
struct TALER_MINTDB_Plugin *db_plugin,
|
||||
struct PERF_TALER_MINTDB_Cmd cmd[]);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -1,18 +1,18 @@
|
||||
/*
|
||||
This file is part of TALER
|
||||
Copyright (C) 2014, 2015 Christian Grothoff (and other contributing authors)
|
||||
This file is part of TALER
|
||||
Copyright (C) 2014, 2015 Christian Grothoff (and other contributing authors)
|
||||
|
||||
TALER is free software; you can redistribute it and/or modify it under the
|
||||
terms of the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 3, or (at your option) any later version.
|
||||
TALER is free software; you can redistribute it and/or modify it under the
|
||||
terms of the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 3, or (at your option) any later version.
|
||||
|
||||
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mintdb/perf_taler_mintdb_values.h
|
||||
* @brief Values for tweaking the performance analysis
|
||||
@ -22,16 +22,17 @@
|
||||
#define __PERF_TALER_MINTDB__VALUES_H__
|
||||
|
||||
|
||||
#define PERF_TALER_MINTDB_NB_DENOMINATION_INIT 10
|
||||
#define PERF_TALER_MINTDB_NB_DENOMINATION_SAVE 10
|
||||
|
||||
#define NB_DEPOSIT_INIT 100000
|
||||
#define NB_DEPOSIT_GET 1000
|
||||
#define NB_DEPOSIT_MARGIN 10000
|
||||
|
||||
#define NB_BLINDCOIN_INIT 100000
|
||||
#define PERF_TALER_MINTDB_NB_RESERVE_INIT 100
|
||||
#define PERF_TALER_MINTDB_NB_RESERVE_SAVE 10
|
||||
|
||||
|
||||
// Temporary macro to compile
|
||||
#define GAUGER(a,b,c,d)
|
||||
#define PERF_TALER_MINTDB_NB_DEPOSIT_INIT 1000
|
||||
#define PERF_TALER_MINTDB_NB_DEPOSIT_SAVE 10
|
||||
|
||||
|
||||
#define PERF_TALER_MINTDB_NB_WITHDRAW_INIT 100
|
||||
#define PERF_TALER_MINTDB_NB_WITHDRAW_SAVE 10
|
||||
#endif
|
||||
|
@ -14,8 +14,8 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNUnet; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user