aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/exchangedb_accounts.c2
-rw-r--r--src/exchangedb/exchangedb_auditorkeys.c35
-rw-r--r--src/exchangedb/exchangedb_denomkeys.c90
-rw-r--r--src/exchangedb/exchangedb_fees.c10
-rw-r--r--src/exchangedb/exchangedb_signkeys.c21
-rw-r--r--src/exchangedb/perf_taler_exchangedb.c298
-rw-r--r--src/exchangedb/perf_taler_exchangedb_init.c64
-rw-r--r--src/exchangedb/perf_taler_exchangedb_init.h33
-rw-r--r--src/exchangedb/perf_taler_exchangedb_interpreter.c2197
-rw-r--r--src/exchangedb/perf_taler_exchangedb_interpreter.h420
-rw-r--r--src/exchangedb/plugin_exchangedb_common.c20
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c995
-rw-r--r--src/exchangedb/test_exchangedb.c280
-rw-r--r--src/exchangedb/test_exchangedb_auditors.c2
-rw-r--r--src/exchangedb/test_exchangedb_denomkeys.c24
-rw-r--r--src/exchangedb/test_exchangedb_signkeys.c5
-rw-r--r--src/exchangedb/test_perf_taler_exchangedb.c101
17 files changed, 2409 insertions, 2188 deletions
diff --git a/src/exchangedb/exchangedb_accounts.c b/src/exchangedb/exchangedb_accounts.c
index 10328fbe3..f336b53a4 100644
--- a/src/exchangedb/exchangedb_accounts.c
+++ b/src/exchangedb/exchangedb_accounts.c
@@ -100,7 +100,7 @@ check_for_account (void *cls,
ai.plugin_name = plugin_name;
ai.payto_url = payto_url;
ai.wire_response_filename = wire_response_filename;
-
+
ai.debit_enabled = (GNUNET_YES ==
GNUNET_CONFIGURATION_get_value_yesno (ctx->cfg,
section,
diff --git a/src/exchangedb/exchangedb_auditorkeys.c b/src/exchangedb/exchangedb_auditorkeys.c
index 38498d9b5..6546c1a3f 100644
--- a/src/exchangedb/exchangedb_auditorkeys.c
+++ b/src/exchangedb/exchangedb_auditorkeys.c
@@ -141,8 +141,8 @@ auditor_iter (void *cls,
return GNUNET_OK;
}
if ( (size - sizeof (struct AuditorFileHeaderP)) / dki_len <
- (sizeof (struct TALER_DenominationKeyValidityPS) +
- sizeof (struct TALER_AuditorSignatureP)) )
+ (sizeof (struct TALER_DenominationKeyValidityPS)
+ + sizeof (struct TALER_AuditorSignatureP)) )
{
GNUNET_break_op (0);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -152,9 +152,9 @@ auditor_iter (void *cls,
return GNUNET_OK;
}
url_len = size
- - sizeof (struct AuditorFileHeaderP)
- - dki_len * (sizeof (struct TALER_DenominationKeyValidityPS) +
- sizeof (struct TALER_AuditorSignatureP));
+ - sizeof (struct AuditorFileHeaderP)
+ - dki_len * (sizeof (struct TALER_DenominationKeyValidityPS)
+ + sizeof (struct TALER_AuditorSignatureP));
sigs = (const struct TALER_AuditorSignatureP *) &af[1];
dki = (const struct TALER_DenominationKeyValidityPS *) &sigs[dki_len];
auditor_url = (const char *) &dki[dki_len];
@@ -171,12 +171,12 @@ auditor_iter (void *cls,
/* Ignoring return value to not interrupt the iteration */
if (GNUNET_OK !=
(iret = aic->it (aic->it_cls,
- &af->apub,
- auditor_url,
- &af->mpub,
- dki_len,
- sigs,
- dki)))
+ &af->apub,
+ auditor_url,
+ &af->mpub,
+ dki_len,
+ sigs,
+ dki)))
{
GNUNET_free (af);
if (GNUNET_SYSERR == iret)
@@ -248,7 +248,8 @@ TALER_EXCHANGEDB_auditor_write (const char *filename,
const struct TALER_AuditorSignatureP *asigs,
const struct TALER_MasterPublicKeyP *mpub,
unsigned int dki_len,
- const struct TALER_DenominationKeyValidityPS *dki)
+ const struct
+ TALER_DenominationKeyValidityPS *dki)
{
struct AuditorFileHeaderP af;
struct GNUNET_DISK_FileHandle *fh;
@@ -262,9 +263,11 @@ TALER_EXCHANGEDB_auditor_write (const char *filename,
af.dki_len = htonl ((uint32_t) dki_len);
ret = GNUNET_SYSERR;
if (NULL == (fh = GNUNET_DISK_file_open
- (filename,
- GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_TRUNCATE,
- GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE)))
+ (filename,
+ GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE
+ | GNUNET_DISK_OPEN_TRUNCATE,
+ GNUNET_DISK_PERM_USER_READ
+ | GNUNET_DISK_PERM_USER_WRITE)))
goto cleanup;
wsize = sizeof (struct AuditorFileHeaderP);
if (GNUNET_SYSERR == (wrote = GNUNET_DISK_file_write (fh,
@@ -291,7 +294,7 @@ TALER_EXCHANGEDB_auditor_write (const char *filename,
auditor_url,
wsize))
ret = GNUNET_OK;
- cleanup:
+ cleanup:
eno = errno;
if (NULL != fh)
(void) GNUNET_DISK_file_close (fh);
diff --git a/src/exchangedb/exchangedb_denomkeys.c b/src/exchangedb/exchangedb_denomkeys.c
index d9e604ebe..be2ee66b2 100644
--- a/src/exchangedb/exchangedb_denomkeys.c
+++ b/src/exchangedb/exchangedb_denomkeys.c
@@ -59,8 +59,10 @@ GNUNET_NETWORK_STRUCT_END
*/
int
TALER_EXCHANGEDB_denomination_key_revoke (const char *revocation_dir,
- const struct GNUNET_HashCode *denom_hash,
- const struct TALER_MasterPrivateKeyP *mpriv)
+ const struct
+ GNUNET_HashCode *denom_hash,
+ const struct
+ TALER_MasterPrivateKeyP *mpriv)
{
struct TALER_MasterDenominationKeyRevocationPS rm;
char *fn;
@@ -69,7 +71,7 @@ TALER_EXCHANGEDB_denomination_key_revoke (const char *revocation_dir,
ret = GNUNET_SYSERR;
GNUNET_asprintf (&fn,
- "%s" DIR_SEPARATOR_STR
+ "%s" DIR_SEPARATOR_STR
"%s.rev",
revocation_dir,
GNUNET_h2s_full (denom_hash));
@@ -83,9 +85,10 @@ TALER_EXCHANGEDB_denomination_key_revoke (const char *revocation_dir,
rd.denom_hash = *denom_hash;
if (sizeof (rd) !=
GNUNET_DISK_fn_write (fn,
- &rd,
- sizeof (rd),
- GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE))
+ &rd,
+ sizeof (rd),
+ GNUNET_DISK_PERM_USER_READ
+ | GNUNET_DISK_PERM_USER_WRITE))
ret = GNUNET_SYSERR;
else
ret = GNUNET_OK;
@@ -104,7 +107,9 @@ TALER_EXCHANGEDB_denomination_key_revoke (const char *revocation_dir,
*/
int
TALER_EXCHANGEDB_denomination_key_read (const char *filename,
- struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki)
+ struct
+ TALER_EXCHANGEDB_DenominationKeyIssueInformation
+ *dki)
{
uint64_t size;
size_t offset;
@@ -156,7 +161,8 @@ TALER_EXCHANGEDB_denomination_key_read (const char *filename,
offset);
GNUNET_free (data);
if (0 == GNUNET_TIME_absolute_get_remaining
- (GNUNET_TIME_absolute_ntoh (dki->issue.properties.expire_withdraw)).rel_value_us)
+ (GNUNET_TIME_absolute_ntoh (
+ dki->issue.properties.expire_withdraw)).rel_value_us)
{
if (0 != UNLINK (filename))
{
@@ -180,7 +186,9 @@ TALER_EXCHANGEDB_denomination_key_read (const char *filename,
*/
int
TALER_EXCHANGEDB_denomination_key_write (const char *filename,
- const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki)
+ const struct
+ TALER_EXCHANGEDB_DenominationKeyIssueInformation
+ *dki)
{
char *priv_enc;
size_t priv_enc_size;
@@ -198,9 +206,11 @@ TALER_EXCHANGEDB_denomination_key_write (const char *filename,
GNUNET_DISK_directory_create_for_file (filename))
return GNUNET_SYSERR;
if (NULL == (fh = GNUNET_DISK_file_open
- (filename,
- GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_TRUNCATE,
- GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE | GNUNET_DISK_OPEN_FAILIFEXISTS)))
+ (filename,
+ GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE
+ | GNUNET_DISK_OPEN_TRUNCATE,
+ GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE
+ | GNUNET_DISK_OPEN_FAILIFEXISTS)))
goto cleanup;
wsize = sizeof (struct TALER_EXCHANGEDB_DenominationKeyInformationP);
if (GNUNET_SYSERR == (wrote = GNUNET_DISK_file_write (fh,
@@ -217,7 +227,7 @@ TALER_EXCHANGEDB_denomination_key_write (const char *filename,
if (wrote != priv_enc_size)
goto cleanup;
ret = GNUNET_OK;
- cleanup:
+ cleanup:
GNUNET_free_non_null (priv_enc);
if (NULL != fh)
(void) GNUNET_DISK_file_close (fh);
@@ -328,7 +338,8 @@ denomkeys_iterate_topdir_iter (void *cls,
*/
int
TALER_EXCHANGEDB_denomination_keys_iterate (const char *exchange_base_dir,
- TALER_EXCHANGEDB_DenominationKeyIterator it,
+ TALER_EXCHANGEDB_DenominationKeyIterator
+ it,
void *it_cls)
{
char *dir;
@@ -336,7 +347,8 @@ TALER_EXCHANGEDB_denomination_keys_iterate (const char *exchange_base_dir,
int ret;
GNUNET_asprintf (&dir,
- "%s" DIR_SEPARATOR_STR TALER_EXCHANGEDB_DIR_DENOMINATION_KEYS,
+ "%s" DIR_SEPARATOR_STR
+ TALER_EXCHANGEDB_DIR_DENOMINATION_KEYS,
exchange_base_dir);
dic.it = it;
dic.it_cls = it_cls;
@@ -363,7 +375,7 @@ struct RevocationsIterateContext
* Closure for @e it.
*/
void *it_cls;
-
+
/**
* Master public key to use to validate revocations.
*/
@@ -385,7 +397,7 @@ struct RevocationsIterateContext
*/
static int
revocations_iterate_cb (void *cls,
- const char *filename)
+ const char *filename)
{
struct RevocationsIterateContext *ric = cls;
struct RevocationFileP rf;
@@ -394,34 +406,37 @@ revocations_iterate_cb (void *cls,
/* Check if revocation is valid... */
if (sizeof (rf) !=
GNUNET_DISK_fn_read (filename,
- &rf,
- sizeof (rf)))
+ &rf,
+ sizeof (rf)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Invalid revocation file `%s' found and ignored (bad size)\n"),
- filename);
+ _ (
+ "Invalid revocation file `%s' found and ignored (bad size)\n"),
+ filename);
return GNUNET_OK;
}
rm.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED);
rm.purpose.size = htonl (sizeof (rm));
rm.h_denom_pub = rf.denom_hash;
if (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED,
- &rm.purpose,
- &rf.msig.eddsa_signature,
- &ric->master_pub->eddsa_pub))
+ GNUNET_CRYPTO_eddsa_verify (
+ TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED,
+ &rm.purpose,
+ &rf.msig.eddsa_signature,
+ &ric->master_pub->eddsa_pub))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Invalid revocation file `%s' found and ignored (bad signature)\n"),
- filename);
+ _ (
+ "Invalid revocation file `%s' found and ignored (bad signature)\n"),
+ filename);
return GNUNET_OK;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Denomination key `%s' was revoked!\n",
- GNUNET_h2s (&rm.h_denom_pub));
+ "Denomination key `%s' was revoked!\n",
+ GNUNET_h2s (&rm.h_denom_pub));
return ric->it (ric->it_cls,
- &rm.h_denom_pub,
- &rf.msig);
+ &rm.h_denom_pub,
+ &rf.msig);
}
@@ -439,9 +454,10 @@ revocations_iterate_cb (void *cls,
*/
int
TALER_EXCHANGEDB_revocations_iterate (const char *revocation_dir,
- const struct TALER_MasterPublicKeyP *master_pub,
- TALER_EXCHANGEDB_RevocationIterator it,
- void *it_cls)
+ const struct
+ TALER_MasterPublicKeyP *master_pub,
+ TALER_EXCHANGEDB_RevocationIterator it,
+ void *it_cls)
{
struct RevocationsIterateContext ric = {
.it = it,
@@ -452,10 +468,10 @@ TALER_EXCHANGEDB_revocations_iterate (const char *revocation_dir,
if (GNUNET_OK !=
GNUNET_DISK_directory_create (revocation_dir))
return 0; /* directory doesn't exist and we couldn't even create it,
- clearly means there are no revocations there */
+ clearly means there are no revocations there */
return GNUNET_DISK_directory_scan (revocation_dir,
- &revocations_iterate_cb,
- &ric);
+ &revocations_iterate_cb,
+ &ric);
}
diff --git a/src/exchangedb/exchangedb_fees.c b/src/exchangedb/exchangedb_fees.c
index d6fdac4de..f06be73ad 100644
--- a/src/exchangedb/exchangedb_fees.c
+++ b/src/exchangedb/exchangedb_fees.c
@@ -191,11 +191,11 @@ TALER_EXCHANGEDB_fees_write (const char *filename,
return GNUNET_SYSERR;
fh = GNUNET_DISK_file_open (filename,
- GNUNET_DISK_OPEN_WRITE |
- GNUNET_DISK_OPEN_TRUNCATE |
- GNUNET_DISK_OPEN_CREATE,
- GNUNET_DISK_PERM_USER_READ |
- GNUNET_DISK_PERM_USER_WRITE);
+ GNUNET_DISK_OPEN_WRITE
+ | GNUNET_DISK_OPEN_TRUNCATE
+ | GNUNET_DISK_OPEN_CREATE,
+ GNUNET_DISK_PERM_USER_READ
+ | GNUNET_DISK_PERM_USER_WRITE);
if (NULL == fh)
return GNUNET_SYSERR;
diff --git a/src/exchangedb/exchangedb_signkeys.c b/src/exchangedb/exchangedb_signkeys.c
index cb16ee49d..10e4f7a65 100644
--- a/src/exchangedb/exchangedb_signkeys.c
+++ b/src/exchangedb/exchangedb_signkeys.c
@@ -63,18 +63,20 @@ signkeys_iterate_dir_iter (void *cls,
nread = GNUNET_DISK_fn_read (filename,
&issue,
- sizeof (struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP));
+ sizeof (struct
+ TALER_EXCHANGEDB_PrivateSigningKeyInformationP));
if (nread != sizeof (struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Invalid signkey file `%s': wrong size (%d, expected %u)\n",
filename,
(int) nread,
- (unsigned int) sizeof (struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP));
+ (unsigned int) sizeof (struct
+ TALER_EXCHANGEDB_PrivateSigningKeyInformationP));
return GNUNET_OK;
}
if (0 == GNUNET_TIME_absolute_get_remaining
- (GNUNET_TIME_absolute_ntoh (issue.issue.expire)).rel_value_us)
+ (GNUNET_TIME_absolute_ntoh (issue.issue.expire)).rel_value_us)
{
if (0 != UNLINK (filename))
{
@@ -143,7 +145,8 @@ get_signkey_file (const char *exchange_directory,
char *fn;
GNUNET_asprintf (&fn,
- "%s" DIR_SEPARATOR_STR TALER_EXCHANGEDB_DIR_SIGNING_KEYS DIR_SEPARATOR_STR "%llu",
+ "%s" DIR_SEPARATOR_STR TALER_EXCHANGEDB_DIR_SIGNING_KEYS
+ DIR_SEPARATOR_STR "%llu",
exchange_directory,
(unsigned long long) start.abs_value_us);
return fn;
@@ -161,7 +164,9 @@ get_signkey_file (const char *exchange_directory,
int
TALER_EXCHANGEDB_signing_key_write (const char *exchange_base_dir,
struct GNUNET_TIME_Absolute start,
- const struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP *ski)
+ const struct
+ TALER_EXCHANGEDB_PrivateSigningKeyInformationP
+ *ski)
{
char *skf;
ssize_t nwrite;
@@ -173,8 +178,10 @@ TALER_EXCHANGEDB_signing_key_write (const char *exchange_base_dir,
return GNUNET_SYSERR;
nwrite = GNUNET_DISK_fn_write (skf,
ski,
- sizeof (struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP),
- GNUNET_DISK_PERM_USER_WRITE | GNUNET_DISK_PERM_USER_READ);
+ sizeof (struct
+ TALER_EXCHANGEDB_PrivateSigningKeyInformationP),
+ GNUNET_DISK_PERM_USER_WRITE
+ | GNUNET_DISK_PERM_USER_READ);
if (sizeof (struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP) != nwrite)
{
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/exchangedb/perf_taler_exchangedb.c b/src/exchangedb/perf_taler_exchangedb.c
index 5cde719c1..64fde0c1d 100644
--- a/src/exchangedb/perf_taler_exchangedb.c
+++ b/src/exchangedb/perf_taler_exchangedb.c
@@ -50,86 +50,85 @@
* and logs the results using Gauger
*/
int
-main (int argc, char ** argv)
+main (int argc, char **argv)
{
int ret;
- struct PERF_TALER_EXCHANGEDB_Cmd benchmark[] =
- {
+ struct PERF_TALER_EXCHANGEDB_Cmd benchmark[] = {
/* Denomination used to create coins */
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("Initializing database"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("01 - denomination loop",
- NB_DENOMINATION_INIT),
+ NB_DENOMINATION_INIT),
PERF_TALER_EXCHANGEDB_INIT_CMD_START_TRANSACTION (""),
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_DENOMINATION ("01 - denomination"),
PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_DENOMINATION ("01 - insert",
- "01 - denomination"),
+ "01 - denomination"),
PERF_TALER_EXCHANGEDB_INIT_CMD_COMMIT_TRANSACTION (""),
PERF_TALER_EXCHANGEDB_INIT_CMD_SAVE_ARRAY ("01 - save denomination",
- "01 - denomination loop",
- "01 - denomination",
- NB_DENOMINATION_SAVE),
+ "01 - denomination loop",
+ "01 - denomination",
+ NB_DENOMINATION_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("01 - end",
- "01 - denomination loop"),
+ "01 - denomination loop"),
/* End of initialization */
/* Reserve initialization */
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("02 - init reserve loop",
NB_RESERVE_INIT),
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_RESERVE ("02 - reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_RESERVE ("02 - insert",
- "02 - reserve"),
+ "02 - reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_SAVE_ARRAY ("02 - save reserve",
- "02 - init reserve loop",
- "02 - reserve",
- NB_RESERVE_SAVE),
+ "02 - init reserve loop",
+ "02 - reserve",
+ NB_RESERVE_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("02 - end",
- "02 - init reserve loop"),
+ "02 - init reserve loop"),
/* End reserve init */
/* Withdrawal initialization */
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("03 - init withdraw loop",
- NB_WITHDRAW_INIT),
+ NB_WITHDRAW_INIT),
PERF_TALER_EXCHANGEDB_INIT_CMD_START_TRANSACTION (""),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("03 - denomination load",
- "03 - init withdraw loop",
- "01 - save denomination"),
+ "03 - init withdraw loop",
+ "01 - save denomination"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("03 - reserve load",
- "03 - init withdraw loop",
- "02 - save reserve"),
+ "03 - init withdraw loop",
+ "02 - save reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_WITHDRAW ("03 - withdraw",
- "03 - denomination load",
- "03 - reserve load"),
+ "03 - denomination load",
+ "03 - reserve load"),
PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_WITHDRAW ("03 - insert",
- "03 - withdraw"),
+ "03 - withdraw"),
PERF_TALER_EXCHANGEDB_INIT_CMD_COMMIT_TRANSACTION (""),
PERF_TALER_EXCHANGEDB_INIT_CMD_SAVE_ARRAY ("03 - save coin",
- "03 - init withdraw loop",
- "03 - withdraw",
- NB_WITHDRAW_SAVE),
+ "03 - init withdraw loop",
+ "03 - withdraw",
+ NB_WITHDRAW_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("03 - end",
- "03 - init withdraw loop"),
+ "03 - init withdraw loop"),
/*End of withdrawal initialization */
/*Deposit initialization */
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("04 - deposit init loop",
- NB_DEPOSIT_INIT),
+ NB_DEPOSIT_INIT),
PERF_TALER_EXCHANGEDB_INIT_CMD_START_TRANSACTION (""),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("04 - coin load",
- "04 - deposit init loop",
- "03 - save coin"),
+ "04 - deposit init loop",
+ "03 - save coin"),
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_DEPOSIT ("04 - deposit",
- "04 - coin load"),
+ "04 - coin load"),
PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_DEPOSIT ("04 - insert",
- "04 - deposit"),
+ "04 - deposit"),
PERF_TALER_EXCHANGEDB_INIT_CMD_COMMIT_TRANSACTION (""),
PERF_TALER_EXCHANGEDB_INIT_CMD_SAVE_ARRAY ("04 - deposit array",
- "04 - deposit init loop",
- "04 - deposit",
- NB_DEPOSIT_SAVE),
+ "04 - deposit init loop",
+ "04 - deposit",
+ NB_DEPOSIT_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("",
- "04 - deposit init loop"),
+ "04 - deposit init loop"),
/* End of deposit initialization */
/* Session initialization */
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("05 - refresh session init loop",
- NB_REFRESH_INIT),
+ NB_REFRESH_INIT),
PERF_TALER_EXCHANGEDB_INIT_CMD_START_TRANSACTION (""),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("05 - denomination load",
"05 - refresh session init loop",
@@ -140,8 +139,9 @@ main (int argc, char ** argv)
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_WITHDRAW ("05 - withdraw",
"05 - denomination load",
"05 - reserve load"),
- PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_REFRESH_SESSION ("05 - refresh session",
- "05 - withdraw"),
+ PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_REFRESH_SESSION (
+ "05 - refresh session",
+ "05 - withdraw"),
PERF_TALER_EXCHANGEDB_INIT_CMD_SAVE_ARRAY ("05 - session array",
"05 - refresh session init loop",
"05 - refresh session",
@@ -152,190 +152,190 @@ main (int argc, char ** argv)
/* End of refresh session initialization */
/* Refresh melt initialization */
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("06 - refresh melt init loop",
- NB_MELT_INIT),
+ NB_MELT_INIT),
PERF_TALER_EXCHANGEDB_INIT_CMD_START_TRANSACTION (""),
/* TODO: initialize using coins & sessions created localy
* in order to make sure the same coin are not melted twice*/
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("06 - session hash",
- "06 - refresh melt init loop",
- "05 - session array"),
+ "06 - refresh melt init loop",
+ "05 - session array"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("06 - coin",
- "06 - refresh melt init loop",
- "03 - save coin"),
+ "06 - refresh melt init loop",
+ "03 - save coin"),
PERF_TALER_EXCHANGEDB_INIT_CMD_COMMIT_TRANSACTION (""),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("06 - end",
- "06 - refresh melt init loop"),
+ "06 - refresh melt init loop"),
/* End of refresh melt initialization */
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("End of initialization"),
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("Start of performances measuring"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("21 - start"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("21 - reserve insert measure",
- NB_RESERVE_SAVE),
+ NB_RESERVE_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_RESERVE ("21 - reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_RESERVE ("21 - insert",
- "21 - reserve"),
+ "21 - reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("",
- "21 - reserve insert measure"),
+ "21 - reserve insert measure"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("21 - stop"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GAUGER ("21 - gauger",
- "21 - start",
- "21 - stop",
- "POSTGRES",
- "Number of reserve inserted per second",
- "item/sec",
- NB_RESERVE_SAVE),
+ "21 - start",
+ "21 - stop",
+ "POSTGRES",
+ "Number of reserve inserted per second",
+ "item/sec",
+ NB_RESERVE_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("End of reserve insertion"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("22 - start"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("22 - reserve load measure",
- NB_RESERVE_SAVE),
+ NB_RESERVE_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("22 - reserve",
- "22 - reserve load measure",
- "02 - save reserve"),
+ "22 - reserve load measure",
+ "02 - save reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_RESERVE ("22 - get",
- "22 - reserve"),
+ "22 - reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("",
- "22 - reserve load measure"),
+ "22 - reserve load measure"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("22 - stop"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GAUGER ("",
- "22 - start",
- "22 - stop",
- "POSTGRES",
- "Number of reserve loaded per second",
- "item/sec",
- NB_RESERVE_SAVE),
+ "22 - start",
+ "22 - stop",
+ "POSTGRES",
+ "Number of reserve loaded per second",
+ "item/sec",
+ NB_RESERVE_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("End of reserve retreival"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("23 - start"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("23 - reserve history measure",
- NB_RESERVE_SAVE),
+ NB_RESERVE_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("23 - reserve",
- "23 - reserve history measure",
- "02 - save reserve"),
+ "23 - reserve history measure",
+ "02 - save reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_RESERVE_HISTORY ("",
- "23 - reserve"),
+ "23 - reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("",
- "23 - reserve history measure"),
+ "23 - reserve history measure"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("23 - stop"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GAUGER ("",
- "23 - start",
- "23 - stop",
- "POSTGRES",
- "Number of reserve history loaded per second",
- "item/sec",
- NB_RESERVE_SAVE),
+ "23 - start",
+ "23 - stop",
+ "POSTGRES",
+ "Number of reserve history loaded per second",
+ "item/sec",
+ NB_RESERVE_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("End of reserve history access"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("24 - start"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("24 - withdraw insert measure",
- NB_WITHDRAW_SAVE),
+ NB_WITHDRAW_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("24 - reserve",
- "24 - withdraw insert measure",
- "02 - save reserve"),
+ "24 - withdraw insert measure",
+ "02 - save reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("24 - denomination",
- "24 - withdraw insert measure",
- "01 - save denomination"),
+ "24 - withdraw insert measure",
+ "01 - save denomination"),
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_WITHDRAW ("24 - withdraw",
- "24 - denomination",
- "24 - reserve"),
+ "24 - denomination",
+ "24 - reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_WITHDRAW ("24 - insert",
- "24 - withdraw"),
+ "24 - withdraw"),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("",
- "24 - withdraw insert measure"),
+ "24 - withdraw insert measure"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("24 - stop"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GAUGER ("",
- "24 - start",
- "24 - stop",
- "POSTGRES",
- "Number of withdraw insert per second",
- "item/sec",
- NB_WITHDRAW_SAVE),
+ "24 - start",
+ "24 - stop",
+ "POSTGRES",
+ "Number of withdraw insert per second",
+ "item/sec",
+ NB_WITHDRAW_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("End of withdraw insertion"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("25 - start"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("25 - withdraw insert measure",
- NB_RESERVE_SAVE),
+ NB_RESERVE_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("25 - coin",
- "25 - withdraw insert measure",
- "03 - save coin"),
+ "25 - withdraw insert measure",
+ "03 - save coin"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_WITHDRAW ("",
- "25 - coin"),
+ "25 - coin"),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("",
- "25 - withdraw insert measure"),
+ "25 - withdraw insert measure"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("25 - stop"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GAUGER ("",
- "25 - start",
- "25 - stop",
- "POSTGRES",
- "Number of withdraw loaded per second",
- "item/sec",
- NB_RESERVE_SAVE),
+ "25 - start",
+ "25 - stop",
+ "POSTGRES",
+ "Number of withdraw loaded per second",
+ "item/sec",
+ NB_RESERVE_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("End of withdraw loading"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("26 - start"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("26 - get coin transaction",
- NB_WITHDRAW_SAVE),
+ NB_WITHDRAW_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("26 - coin",
- "26 - get coin transaction",
- "03 - save coin"),
- PERF_TALER_EXCHANGEDB_INIT_CMD_GET_COIN_TRANSACTION("",
- "26 - coin"),
+ "26 - get coin transaction",
+ "03 - save coin"),
+ PERF_TALER_EXCHANGEDB_INIT_CMD_GET_COIN_TRANSACTION ("",
+ "26 - coin"),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("",
- "26 - get coin transaction"),
+ "26 - get coin transaction"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("26 - end"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GAUGER ("",
- "26 - start",
- "26 - end",
- "POSTGRES",
- "Number of coin transaction history loaded per second",
- "item/sec",
- NB_WITHDRAW_SAVE),
+ "26 - start",
+ "26 - end",
+ "POSTGRES",
+ "Number of coin transaction history loaded per second",
+ "item/sec",
+ NB_WITHDRAW_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("End of transaction loading"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("27 - start"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("27 - /reserve/withdraw",
- NB_WITHDRAW_SAVE),
+ NB_WITHDRAW_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("27 - reserve",
- "27 - /reserve/withdraw",
- "02 - save reserve"),
+ "27 - /reserve/withdraw",
+ "02 - save reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("27 - dki",
- "27 - /reserve/withdraw",
- "01 - save denomination"),
+ "27 - /reserve/withdraw",
+ "01 - save denomination"),
PERF_TALER_EXCHANGEDB_INIT_CMD_WITHDRAW_SIGN ("",
- "27 - dki",
- "27 - reserve"),
+ "27 - dki",
+ "27 - reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("",
- "27 - /reserve/withdraw"),
+ "27 - /reserve/withdraw"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("27 - end"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GAUGER ("",
- "27 - start",
- "27 - end",
- "POSTGRES",
- "Number of /reserve/withdraw per second",
- "item/sec",
- NB_WITHDRAW_SAVE),
+ "27 - start",
+ "27 - end",
+ "POSTGRES",
+ "Number of /reserve/withdraw per second",
+ "item/sec",
+ NB_WITHDRAW_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("End of /reserve/withdraw"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("28 - start"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("28 - /deposit",
- NB_DEPOSIT_SAVE),
+ NB_DEPOSIT_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("28 - coin",
- "28 - /deposit",
- "03 - save coin"),
+ "28 - /deposit",
+ "03 - save coin"),
PERF_TALER_EXCHANGEDB_INIT_CMD_DEPOSIT ("28 - deposit",
- "28 - coin"),
+ "28 - coin"),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("",
- "28 - /deposit"),
+ "28 - /deposit"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("28 - stop"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GAUGER ("",
- "28 - start",
- "28 - stop",
- "POSTGRES",
- "Number of /deposit per second",
- "item/sec",
- NB_DEPOSIT_SAVE),
+ "28 - start",
+ "28 - stop",
+ "POSTGRES",
+ "Number of /deposit per second",
+ "item/sec",
+ NB_DEPOSIT_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("29 - start"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("29 - insert refresh session",
NB_REFRESH_SAVE),
@@ -349,30 +349,32 @@ main (int argc, char ** argv)
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_WITHDRAW ("29 - withdraw",
"29 - denomination load",
"29 - reserve load"),
- PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_REFRESH_SESSION ("29 - refresh session",
- "29 - withdraw"),
+ PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_REFRESH_SESSION (
+ "29 - refresh session",
+ "29 - withdraw"),
PERF_TALER_EXCHANGEDB_INIT_CMD_SAVE_ARRAY ("29 - session array",
"29 - insert refresh session",
"29 - refresh session",
NB_RESERVE_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_COMMIT_TRANSACTION (""),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("",
- "29 - insert refresh session"),
+ "29 - insert refresh session"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("29 - stop"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GAUGER ("",
- "29 - start",
- "29 - stop",
- "POSTGRES",
- "Number of refresh session inserted per second",
- "item/sec",
- NB_REFRESH_SAVE),
+ "29 - start",
+ "29 - stop",
+ "POSTGRES",
+ "Number of refresh session inserted per second",
+ "item/sec",
+ NB_REFRESH_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_END (""),
};
ret = PERF_TALER_EXCHANGEDB_run_benchmark (
"perf-taler-exchangedb",
"./test-exchange-db-postgres.conf",
- (struct PERF_TALER_EXCHANGEDB_Cmd []) {PERF_TALER_EXCHANGEDB_INIT_CMD_END("")},
+ (struct PERF_TALER_EXCHANGEDB_Cmd []) {PERF_TALER_EXCHANGEDB_INIT_CMD_END (
+ "")},
benchmark);
if (GNUNET_SYSERR == ret)
return 1;
diff --git a/src/exchangedb/perf_taler_exchangedb_init.c b/src/exchangedb/perf_taler_exchangedb_init.c
index 7053bca48..d27634bd8 100644
--- a/src/exchangedb/perf_taler_exchangedb_init.c
+++ b/src/exchangedb/perf_taler_exchangedb_init.c
@@ -43,7 +43,7 @@ PERF_TALER_EXCHANGEDB_denomination_init ()
struct TALER_DenominationPublicKey denom_pub;
struct TALER_EXCHANGEDB_DenominationKeyInformationP issue;
- master_prvt = GNUNET_CRYPTO_eddsa_key_create();
+ master_prvt = GNUNET_CRYPTO_eddsa_key_create ();
dki = GNUNET_new (struct TALER_EXCHANGEDB_DenominationKeyIssueInformation);
GNUNET_assert (NULL != dki);
@@ -61,16 +61,21 @@ PERF_TALER_EXCHANGEDB_denomination_init ()
struct TALER_Amount amount;
struct GNUNET_TIME_Absolute now;
- properties.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY);
- properties.purpose.size = htonl (sizeof (struct TALER_DenominationKeyValidityPS));
+ properties.purpose.purpose = htonl (
+ TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY);
+ properties.purpose.size = htonl (sizeof (struct
+ TALER_DenominationKeyValidityPS));
GNUNET_CRYPTO_eddsa_key_get_public (master_prvt,
&properties.master.eddsa_pub);
- now = GNUNET_TIME_absolute_get();
+ now = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&now);
properties.start = GNUNET_TIME_absolute_hton (now);
- properties.expire_withdraw = GNUNET_TIME_absolute_hton (GNUNET_TIME_UNIT_FOREVER_ABS);
- properties.expire_deposit = GNUNET_TIME_absolute_hton (GNUNET_TIME_UNIT_FOREVER_ABS);
- properties.expire_legal = GNUNET_TIME_absolute_hton (GNUNET_TIME_UNIT_FOREVER_ABS);
+ properties.expire_withdraw = GNUNET_TIME_absolute_hton (
+ GNUNET_TIME_UNIT_FOREVER_ABS);
+ properties.expire_deposit = GNUNET_TIME_absolute_hton (
+ GNUNET_TIME_UNIT_FOREVER_ABS);
+ properties.expire_legal = GNUNET_TIME_absolute_hton (
+ GNUNET_TIME_UNIT_FOREVER_ABS);
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (CURRENCY ":1.1", &amount));
TALER_amount_hton (&properties.value, &amount);
@@ -105,15 +110,18 @@ PERF_TALER_EXCHANGEDB_denomination_init ()
* @return a copy of @a deposit; NULL if error
*/
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *
-PERF_TALER_EXCHANGEDB_denomination_copy (const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki)
+PERF_TALER_EXCHANGEDB_denomination_copy (const struct
+ TALER_EXCHANGEDB_DenominationKeyIssueInformation
+ *dki)
{
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *copy;
GNUNET_assert (NULL !=
- (copy = GNUNET_new (struct TALER_EXCHANGEDB_DenominationKeyIssueInformation)));
+ (copy = GNUNET_new (struct
+ TALER_EXCHANGEDB_DenominationKeyIssueInformation)));
{/* denom_priv */
copy->denom_priv.rsa_private_key =
- GNUNET_CRYPTO_rsa_private_key_dup ( dki->denom_priv.rsa_private_key);
+ GNUNET_CRYPTO_rsa_private_key_dup (dki->denom_priv.rsa_private_key);
}
{/* denom_pub */
copy->denom_pub.rsa_public_key =
@@ -132,7 +140,9 @@ PERF_TALER_EXCHANGEDB_denomination_copy (const struct TALER_EXCHANGEDB_Denominat
* @param dki pointer to the struct to free
*/
int
-PERF_TALER_EXCHANGEDB_denomination_free (struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki)
+PERF_TALER_EXCHANGEDB_denomination_free (struct
+ TALER_EXCHANGEDB_DenominationKeyIssueInformation
+ *dki)
{
if (NULL == dki)
return GNUNET_OK;
@@ -166,7 +176,8 @@ PERF_TALER_EXCHANGEDB_reserve_init ()
GNUNET_CRYPTO_eddsa_key_get_public (&reserve->private,
&reserve->reserve.pub.eddsa_pub);
GNUNET_assert (GNUNET_OK ==
- TALER_string_to_amount (CURRENCY ":1000", &reserve->reserve.balance));
+ TALER_string_to_amount (CURRENCY ":1000",
+ &reserve->reserve.balance));
reserve->reserve.expiry = GNUNET_TIME_UNIT_FOREVER_ABS;
return reserve;
}
@@ -178,7 +189,8 @@ PERF_TALER_EXCHANGEDB_reserve_init ()
* @return a copy of @a reserve; NULL if error
*/
struct PERF_TALER_EXCHANGEDB_Reserve *
-PERF_TALER_EXCHANGEDB_reserve_copy (const struct PERF_TALER_EXCHANGEDB_Reserve *reserve)
+PERF_TALER_EXCHANGEDB_reserve_copy (const struct
+ PERF_TALER_EXCHANGEDB_Reserve *reserve)
{
struct PERF_TALER_EXCHANGEDB_Reserve *copy;
GNUNET_assert (NULL !=
@@ -193,7 +205,8 @@ PERF_TALER_EXCHANGEDB_reserve_copy (const struct PERF_TALER_EXCHANGEDB_Reserve *
* @param reserve pointer to the structure to be freed
*/
int
-PERF_TALER_EXCHANGEDB_reserve_free (struct PERF_TALER_EXCHANGEDB_Reserve *reserve)
+PERF_TALER_EXCHANGEDB_reserve_free (struct
+ PERF_TALER_EXCHANGEDB_Reserve *reserve)
{
if (NULL == reserve)
return GNUNET_OK;
@@ -208,7 +221,8 @@ PERF_TALER_EXCHANGEDB_reserve_free (struct PERF_TALER_EXCHANGEDB_Reserve *reserv
* @param dki the denomination key used to sign the key
*/
struct TALER_EXCHANGEDB_Deposit *
-PERF_TALER_EXCHANGEDB_deposit_init (const struct PERF_TALER_EXCHANGEDB_Coin *coin)
+PERF_TALER_EXCHANGEDB_deposit_init (const struct
+ PERF_TALER_EXCHANGEDB_Coin *coin)
{
struct TALER_EXCHANGEDB_Deposit *deposit;
struct TALER_CoinSpendSignatureP csig;
@@ -225,7 +239,7 @@ PERF_TALER_EXCHANGEDB_deposit_init (const struct PERF_TALER_EXCHANGEDB_Coin *coi
&h_contract_terms);
GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
&h_wire);
- { //csig
+ { // csig
struct u32_presign
{
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
@@ -242,11 +256,11 @@ PERF_TALER_EXCHANGEDB_deposit_init (const struct PERF_TALER_EXCHANGEDB_Coin *coi
&unsigned_data.purpose,
&csig.eddsa_signature));
}
- { //merchant_pub
+ { // merchant_pub
struct GNUNET_CRYPTO_EddsaPrivateKey *eddsa_prv;
eddsa_prv = GNUNET_CRYPTO_eddsa_key_create ();
- GNUNET_assert(NULL != eddsa_prv);
+ GNUNET_assert (NULL != eddsa_prv);
GNUNET_CRYPTO_eddsa_key_get_public (eddsa_prv,
&merchant_pub.eddsa_pub);
GNUNET_free (eddsa_prv);
@@ -289,7 +303,8 @@ PERF_TALER_EXCHANGEDB_deposit_init (const struct PERF_TALER_EXCHANGEDB_Coin *coi
* @return a copy of @a deposit; NULL if error
*/
struct TALER_EXCHANGEDB_Deposit *
-PERF_TALER_EXCHANGEDB_deposit_copy (const struct TALER_EXCHANGEDB_Deposit *deposit)
+PERF_TALER_EXCHANGEDB_deposit_copy (const struct
+ TALER_EXCHANGEDB_Deposit *deposit)
{
struct TALER_EXCHANGEDB_Deposit *copy;
@@ -337,7 +352,7 @@ PERF_TALER_EXCHANGEDB_coin_init (
GNUNET_assert (NULL != coin);
/* priv */
- priv = GNUNET_CRYPTO_eddsa_key_create();
+ priv = GNUNET_CRYPTO_eddsa_key_create ();
GNUNET_assert (NULL != priv);
coin->priv = *priv;
GNUNET_free (priv);
@@ -480,14 +495,16 @@ PERF_TALER_EXCHANGEDB_refresh_melt_init (struct TALER_RefreshCommitmentP *rc,
* @return an copy of @ melt
*/
struct TALER_EXCHANGEDB_RefreshMelt *
-PERF_TALER_EXCHANGEDB_refresh_melt_copy (const struct TALER_EXCHANGEDB_RefreshMelt *melt)
+PERF_TALER_EXCHANGEDB_refresh_melt_copy (const struct
+ TALER_EXCHANGEDB_RefreshMelt *melt)
{
struct TALER_EXCHANGEDB_RefreshMelt *copy;
copy = GNUNET_new (struct TALER_EXCHANGEDB_RefreshMelt);
*copy = *melt;
copy->session.coin.denom_sig.rsa_signature =
- GNUNET_CRYPTO_rsa_signature_dup (melt->session.coin.denom_sig.rsa_signature);
+ GNUNET_CRYPTO_rsa_signature_dup (
+ melt->session.coin.denom_sig.rsa_signature);
GNUNET_assert (NULL != copy->session.coin.denom_sig.rsa_signature);
return copy;
@@ -501,7 +518,8 @@ PERF_TALER_EXCHANGEDB_refresh_melt_copy (const struct TALER_EXCHANGEDB_RefreshMe
* @return #GNUNET_OK if the operation was successful, #GNUNET_SYSERROR
*/
int
-PERF_TALER_EXCHANGEDB_refresh_melt_free (struct TALER_EXCHANGEDB_RefreshMelt *melt)
+PERF_TALER_EXCHANGEDB_refresh_melt_free (struct
+ TALER_EXCHANGEDB_RefreshMelt *melt)
{
GNUNET_CRYPTO_rsa_signature_free (melt->session.coin.denom_sig.rsa_signature);
GNUNET_free (melt);
diff --git a/src/exchangedb/perf_taler_exchangedb_init.h b/src/exchangedb/perf_taler_exchangedb_init.h
index a1f2559e2..f20b35c5b 100644
--- a/src/exchangedb/perf_taler_exchangedb_init.h
+++ b/src/exchangedb/perf_taler_exchangedb_init.h
@@ -79,7 +79,9 @@ PERF_TALER_EXCHANGEDB_denomination_init (void);
* @return a copy of @a deposit; NULL if error
*/
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *
-PERF_TALER_EXCHANGEDB_denomination_copy (const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki);
+PERF_TALER_EXCHANGEDB_denomination_copy (const struct
+ TALER_EXCHANGEDB_DenominationKeyIssueInformation
+ *dki);
/**
@@ -87,7 +89,9 @@ PERF_TALER_EXCHANGEDB_denomination_copy (const struct TALER_EXCHANGEDB_Denominat
* @param dki pointer to the struct to free
*/
int
-PERF_TALER_EXCHANGEDB_denomination_free (struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki);
+PERF_TALER_EXCHANGEDB_denomination_free (struct
+ TALER_EXCHANGEDB_DenominationKeyIssueInformation
+ *dki);
/**
@@ -104,7 +108,8 @@ PERF_TALER_EXCHANGEDB_reserve_init (void);
* @return a copy of @a reserve; NULL if error
*/
struct PERF_TALER_EXCHANGEDB_Reserve *
-PERF_TALER_EXCHANGEDB_reserve_copy (const struct PERF_TALER_EXCHANGEDB_Reserve *reserve);
+PERF_TALER_EXCHANGEDB_reserve_copy (const struct
+ PERF_TALER_EXCHANGEDB_Reserve *reserve);
/**
@@ -112,7 +117,8 @@ PERF_TALER_EXCHANGEDB_reserve_copy (const struct PERF_TALER_EXCHANGEDB_Reserve *
* @param reserve pointer to the structure to be freed
*/
int
-PERF_TALER_EXCHANGEDB_reserve_free (struct PERF_TALER_EXCHANGEDB_Reserve *reserve);
+PERF_TALER_EXCHANGEDB_reserve_free (struct
+ PERF_TALER_EXCHANGEDB_Reserve *reserve);
/**
@@ -120,7 +126,8 @@ PERF_TALER_EXCHANGEDB_reserve_free (struct PERF_TALER_EXCHANGEDB_Reserve *reserv
* @param dki the denomination key used to sign the key
*/
struct TALER_EXCHANGEDB_Deposit *
-PERF_TALER_EXCHANGEDB_deposit_init (const struct PERF_TALER_EXCHANGEDB_Coin *coin);
+PERF_TALER_EXCHANGEDB_deposit_init (const struct
+ PERF_TALER_EXCHANGEDB_Coin *coin);
/**
@@ -129,7 +136,8 @@ PERF_TALER_EXCHANGEDB_deposit_init (const struct PERF_TALER_EXCHANGEDB_Coin *coi
* @return a copy of @a deposit; NULL if error
*/
struct TALER_EXCHANGEDB_Deposit *
-PERF_TALER_EXCHANGEDB_deposit_copy (const struct TALER_EXCHANGEDB_Deposit *deposit);
+PERF_TALER_EXCHANGEDB_deposit_copy (const struct
+ TALER_EXCHANGEDB_Deposit *deposit);
/**
@@ -147,8 +155,11 @@ PERF_TALER_EXCHANGEDB_deposit_free (struct TALER_EXCHANGEDB_Deposit *deposit);
* @return a randomly generated CollectableBlindcoin
*/
struct PERF_TALER_EXCHANGEDB_Coin *
-PERF_TALER_EXCHANGEDB_coin_init (const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki,
- const struct PERF_TALER_EXCHANGEDB_Reserve *reserve);
+PERF_TALER_EXCHANGEDB_coin_init (const struct
+ TALER_EXCHANGEDB_DenominationKeyIssueInformation
+ *dki,
+ const struct
+ PERF_TALER_EXCHANGEDB_Reserve *reserve);
/**
@@ -187,7 +198,8 @@ PERF_TALER_EXCHANGEDB_refresh_melt_init (struct TALER_RefreshCommitmentP *rc,
* @return an copy of @ melt
*/
struct TALER_EXCHANGEDB_RefreshMelt *
-PERF_TALER_EXCHANGEDB_refresh_melt_copy (const struct TALER_EXCHANGEDB_RefreshMelt *melt);
+PERF_TALER_EXCHANGEDB_refresh_melt_copy (const struct
+ TALER_EXCHANGEDB_RefreshMelt *melt);
/**
@@ -197,6 +209,7 @@ PERF_TALER_EXCHANGEDB_refresh_melt_copy (const struct TALER_EXCHANGEDB_RefreshMe
* @return #GNUNET_OK if the operation was successful, #GNUNET_SYSERROR
*/
int
-PERF_TALER_EXCHANGEDB_refresh_melt_free (struct TALER_EXCHANGEDB_RefreshMelt *melt);
+PERF_TALER_EXCHANGEDB_refresh_melt_free (struct
+ TALER_EXCHANGEDB_RefreshMelt *melt);
#endif
diff --git a/src/exchangedb/perf_taler_exchangedb_interpreter.c b/src/exchangedb/perf_taler_exchangedb_interpreter.c
index 6c968410b..8286966c2 100644
--- a/src/exchangedb/perf_taler_exchangedb_interpreter.c
+++ b/src/exchangedb/perf_taler_exchangedb_interpreter.c
@@ -110,31 +110,31 @@ data_copy (const struct PERF_TALER_EXCHANGEDB_Data *data,
copy->type = data->type;
switch (data->type)
{
- case PERF_TALER_EXCHANGEDB_TIME:
- copy->data.time = GNUNET_new (struct GNUNET_TIME_Absolute);
- *copy->data.time = *data->data.time;
- return;
- case PERF_TALER_EXCHANGEDB_DEPOSIT:
- copy->data.deposit
- = PERF_TALER_EXCHANGEDB_deposit_copy (data->data.deposit);
- return;
- case PERF_TALER_EXCHANGEDB_COIN:
- copy->data.coin
- = PERF_TALER_EXCHANGEDB_coin_copy (data->data.coin);
- return;
- case PERF_TALER_EXCHANGEDB_RESERVE:
- copy->data.reserve
- = PERF_TALER_EXCHANGEDB_reserve_copy (data->data.reserve);
- return;
- case PERF_TALER_EXCHANGEDB_DENOMINATION_INFO:
- copy->data.dki
- = PERF_TALER_EXCHANGEDB_denomination_copy (data->data.dki);
- return;
- case PERF_TALER_EXCHANGEDB_REFRESH_HASH:
- copy->data.rc = data->data.rc;
- break;
- case PERF_TALER_EXCHANGEDB_NONE:
- break;
+ case PERF_TALER_EXCHANGEDB_TIME:
+ copy->data.time = GNUNET_new (struct GNUNET_TIME_Absolute);
+ *copy->data.time = *data->data.time;
+ return;
+ case PERF_TALER_EXCHANGEDB_DEPOSIT:
+ copy->data.deposit
+ = PERF_TALER_EXCHANGEDB_deposit_copy (data->data.deposit);
+ return;
+ case PERF_TALER_EXCHANGEDB_COIN:
+ copy->data.coin
+ = PERF_TALER_EXCHANGEDB_coin_copy (data->data.coin);
+ return;
+ case PERF_TALER_EXCHANGEDB_RESERVE:
+ copy->data.reserve
+ = PERF_TALER_EXCHANGEDB_reserve_copy (data->data.reserve);
+ return;
+ case PERF_TALER_EXCHANGEDB_DENOMINATION_INFO:
+ copy->data.dki
+ = PERF_TALER_EXCHANGEDB_denomination_copy (data->data.dki);
+ return;
+ case PERF_TALER_EXCHANGEDB_REFRESH_HASH:
+ copy->data.rc = data->data.rc;
+ break;
+ case PERF_TALER_EXCHANGEDB_NONE:
+ break;
}
}
@@ -151,7 +151,7 @@ cmd_find (const struct PERF_TALER_EXCHANGEDB_Cmd *cmd,
{
unsigned int i;
- for (i=0; PERF_TALER_EXCHANGEDB_CMD_END != cmd[i].command; i++)
+ for (i = 0; PERF_TALER_EXCHANGEDB_CMD_END != cmd[i].command; i++)
if (0 == strcmp (cmd[i].label, search))
return i;
return GNUNET_SYSERR;
@@ -171,718 +171,721 @@ cmd_init (struct PERF_TALER_EXCHANGEDB_Cmd cmd[])
{
unsigned int i;
- for (i=0; PERF_TALER_EXCHANGEDB_CMD_END != cmd[i].command; i++)
+ for (i = 0; PERF_TALER_EXCHANGEDB_CMD_END != cmd[i].command; i++)
{
switch (cmd[i].command)
{
- case PERF_TALER_EXCHANGEDB_CMD_END_LOOP:
- {
- int ret;
+ case PERF_TALER_EXCHANGEDB_CMD_END_LOOP:
+ {
+ int ret;
- ret = cmd_find (cmd,
- cmd[i].details.end_loop.label_loop);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
+ ret = cmd_find (cmd,
cmd[i].details.end_loop.label_loop);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_CMD_LOOP != cmd[ret].command)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s at %s\n",
- i,
- cmd[i].details.end_loop.label_loop,
- cmd[i].label);
- return GNUNET_SYSERR;
- }
- cmd[i].details.end_loop.index_loop = ret;
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.end_loop.label_loop);
+ return GNUNET_SYSERR;
}
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY:
+ if (PERF_TALER_EXCHANGEDB_CMD_LOOP != cmd[ret].command)
{
- int ret;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s at %s\n",
+ i,
+ cmd[i].details.end_loop.label_loop,
+ cmd[i].label);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.end_loop.index_loop = ret;
+ }
+ break;
- ret = cmd_find (cmd,
- cmd[i].details.save_array.label_save);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s at %s\n",
- i,
- cmd[i].details.save_array.label_save,
- cmd[i].label);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_NONE == cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s at %s\n",
- i,
- cmd[i].details.save_array.label_save,
- cmd[i].label);
- return GNUNET_SYSERR;
- }
- cmd[i].details.save_array.index_save = ret;
+ case PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY:
+ {
+ int ret;
- ret = cmd_find (cmd,
- cmd[i].details.save_array.label_loop);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s at %s\n",
- i,
- cmd[i].details.save_array.label_loop,
- cmd[i].label);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_CMD_LOOP != cmd[ret].command)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s at %s\n",
- i,
- cmd[i].details.save_array.label_loop,
- cmd[i].label);
- return GNUNET_SYSERR;
- }
- cmd[i].details.save_array.index_loop = ret;
-
- GNUNET_assert (NULL == cmd[i].details.save_array.data_saved);
- cmd[i].details.save_array.data_saved =
- GNUNET_new_array (cmd[i].details.save_array.nb_saved,
- struct PERF_TALER_EXCHANGEDB_Data);
- cmd[i].details.save_array.type_saved =
- cmd[cmd[i].details.save_array.index_save].exposed.type;
+ ret = cmd_find (cmd,
+ cmd[i].details.save_array.label_save);
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s at %s\n",
+ i,
+ cmd[i].details.save_array.label_save,
+ cmd[i].label);
+ return GNUNET_SYSERR;
}
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_LOAD_ARRAY:
+ if (PERF_TALER_EXCHANGEDB_NONE == cmd[ret].exposed.type)
{
- int ret;
-
- ret = cmd_find (cmd,
- cmd[i].details.load_array.label_save);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s at %s\n",
- i,
- cmd[i].details.load_array.label_save,
- cmd[i].label);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY != cmd[ret].command)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s at %s\n",
- i,
- cmd[i].details.load_array.label_save,
- cmd[i].label);
- return GNUNET_SYSERR;
- }
- cmd[i].details.load_array.index_save = ret;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s at %s\n",
+ i,
+ cmd[i].details.save_array.label_save,
+ cmd[i].label);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.save_array.index_save = ret;
- ret = cmd_find (cmd,
- cmd[i].details.load_array.label_loop);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
- cmd[i].details.load_array.label_loop);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_CMD_LOOP != cmd[ret].command)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
- cmd[i].details.load_array.label_loop);
- return GNUNET_SYSERR;
- }
- cmd[i].details.load_array.index_loop = ret;
+ ret = cmd_find (cmd,
+ cmd[i].details.save_array.label_loop);
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s at %s\n",
+ i,
+ cmd[i].details.save_array.label_loop,
+ cmd[i].label);
+ return GNUNET_SYSERR;
+ }
+ if (PERF_TALER_EXCHANGEDB_CMD_LOOP != cmd[ret].command)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s at %s\n",
+ i,
+ cmd[i].details.save_array.label_loop,
+ cmd[i].label);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.save_array.index_loop = ret;
+
+ GNUNET_assert (NULL == cmd[i].details.save_array.data_saved);
+ cmd[i].details.save_array.data_saved =
+ GNUNET_new_array (cmd[i].details.save_array.nb_saved,
+ struct PERF_TALER_EXCHANGEDB_Data);
+ cmd[i].details.save_array.type_saved =
+ cmd[cmd[i].details.save_array.index_save].exposed.type;
+ }
+ break;
- cmd[i].details.load_array.permutation =
- GNUNET_CRYPTO_random_permute (
- GNUNET_CRYPTO_QUALITY_WEAK,
- cmd[cmd[i].details.load_array.index_save].details.save_array.nb_saved);
- GNUNET_assert (NULL != cmd[i].details.load_array.permutation);
+ case PERF_TALER_EXCHANGEDB_CMD_LOAD_ARRAY:
+ {
+ int ret;
- cmd[i].exposed.type = cmd[cmd[i].details.load_array.index_save].details.save_array.type_saved;
+ ret = cmd_find (cmd,
+ cmd[i].details.load_array.label_save);
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s at %s\n",
+ i,
+ cmd[i].details.load_array.label_save,
+ cmd[i].label);
+ return GNUNET_SYSERR;
+ }
+ if (PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY != cmd[ret].command)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s at %s\n",
+ i,
+ cmd[i].details.load_array.label_save,
+ cmd[i].label);
+ return GNUNET_SYSERR;
}
- break;
+ cmd[i].details.load_array.index_save = ret;
- case PERF_TALER_EXCHANGEDB_CMD_LOAD_RANDOM:
+ ret = cmd_find (cmd,
+ cmd[i].details.load_array.label_loop);
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.load_array.label_loop);
+ return GNUNET_SYSERR;
+ }
+ if (PERF_TALER_EXCHANGEDB_CMD_LOOP != cmd[ret].command)
{
- int ret;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.load_array.label_loop);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.load_array.index_loop = ret;
+
+ cmd[i].details.load_array.permutation =
+ GNUNET_CRYPTO_random_permute (
+ GNUNET_CRYPTO_QUALITY_WEAK,
+ cmd[cmd[i].details.load_array.index_save].details.save_array.
+ nb_saved);
+ GNUNET_assert (NULL != cmd[i].details.load_array.permutation);
+
+ cmd[i].exposed.type =
+ cmd[cmd[i].details.load_array.index_save].details.save_array.
+ type_saved;
+ }
+ break;
- ret = cmd_find (cmd,
- cmd[i].details.load_random.label_save);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
- cmd[i].details.load_random.label_save);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY != cmd[ret].command)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
+ case PERF_TALER_EXCHANGEDB_CMD_LOAD_RANDOM:
+ {
+ int ret;
+
+ ret = cmd_find (cmd,
cmd[i].details.load_random.label_save);
- return GNUNET_SYSERR;
- }
- cmd[i].details.load_random.index_save = ret;
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.load_random.label_save);
+ return GNUNET_SYSERR;
}
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_GAUGER:
+ if (PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY != cmd[ret].command)
{
- int ret;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.load_random.label_save);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.load_random.index_save = ret;
+ }
+ break;
- ret = cmd_find (cmd,
- cmd[i].details.gauger.label_start);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
- cmd[i].details.gauger.label_start);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_TIME != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
+ case PERF_TALER_EXCHANGEDB_CMD_GAUGER:
+ {
+ int ret;
+
+ ret = cmd_find (cmd,
cmd[i].details.gauger.label_start);
- return GNUNET_SYSERR;
- }
- cmd[i].details.gauger.index_start = ret;
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.gauger.label_start);
+ return GNUNET_SYSERR;
+ }
+ if (PERF_TALER_EXCHANGEDB_TIME != cmd[ret].exposed.type)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.gauger.label_start);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.gauger.index_start = ret;
- ret = cmd_find (cmd,
- cmd[i].details.gauger.label_stop);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
+ ret = cmd_find (cmd,
cmd[i].details.gauger.label_stop);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_TIME != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
- cmd[i].details.gauger.label_stop);
- return GNUNET_SYSERR;
- }
- cmd[i].details.gauger.index_stop = ret;
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.gauger.label_stop);
+ return GNUNET_SYSERR;
}
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_INSERT_DENOMINATION:
+ if (PERF_TALER_EXCHANGEDB_TIME != cmd[ret].exposed.type)
{
- int ret;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.gauger.label_stop);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.gauger.index_stop = ret;
+ }
+ break;
- ret = cmd_find (cmd,
- cmd[i].details.insert_denomination.label_denom);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
- cmd[i].details.insert_denomination.label_denom);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_DENOMINATION_INFO != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
+ case PERF_TALER_EXCHANGEDB_CMD_INSERT_DENOMINATION:
+ {
+ int ret;
+
+ ret = cmd_find (cmd,
cmd[i].details.insert_denomination.label_denom);
- return GNUNET_SYSERR;
- }
- cmd[i].details.insert_denomination.index_denom = ret;
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.insert_denomination.label_denom);
+ return GNUNET_SYSERR;
}
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_GET_DENOMINATION:
+ if (PERF_TALER_EXCHANGEDB_DENOMINATION_INFO != cmd[ret].exposed.type)
{
- int ret;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.insert_denomination.label_denom);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.insert_denomination.index_denom = ret;
+ }
+ break;
- ret = cmd_find (cmd,
- cmd[i].details.get_denomination.label_denom);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
- cmd[i].details.get_denomination.label_denom);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_DENOMINATION_INFO != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
+ case PERF_TALER_EXCHANGEDB_CMD_GET_DENOMINATION:
+ {
+ int ret;
+
+ ret = cmd_find (cmd,
cmd[i].details.get_denomination.label_denom);
- return GNUNET_SYSERR;
- }
- cmd[i].details.get_denomination.index_denom = ret;
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.get_denomination.label_denom);
+ return GNUNET_SYSERR;
}
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_INSERT_RESERVE:
+ if (PERF_TALER_EXCHANGEDB_DENOMINATION_INFO != cmd[ret].exposed.type)
{
- int ret;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.get_denomination.label_denom);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.get_denomination.index_denom = ret;
+ }
+ break;
- ret = cmd_find (cmd,
- cmd[i].details.insert_reserve.label_reserve);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
- cmd[i].details.insert_reserve.label_reserve);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_RESERVE != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
+ case PERF_TALER_EXCHANGEDB_CMD_INSERT_RESERVE:
+ {
+ int ret;
+
+ ret = cmd_find (cmd,
cmd[i].details.insert_reserve.label_reserve);
- return GNUNET_SYSERR;
- }
- cmd[i].details.insert_reserve.index_reserve = ret;
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.insert_reserve.label_reserve);
+ return GNUNET_SYSERR;
}
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_GET_RESERVE:
+ if (PERF_TALER_EXCHANGEDB_RESERVE != cmd[ret].exposed.type)
{
- int ret;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.insert_reserve.label_reserve);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.insert_reserve.index_reserve = ret;
+ }
+ break;
- ret = cmd_find (cmd,
- cmd[i].details.get_reserve.label_reserve);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
- cmd[i].details.get_reserve.label_reserve);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_RESERVE != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
+ case PERF_TALER_EXCHANGEDB_CMD_GET_RESERVE:
+ {
+ int ret;
+
+ ret = cmd_find (cmd,
cmd[i].details.get_reserve.label_reserve);
- return GNUNET_SYSERR;
- }
- cmd[i].details.get_reserve.index_reserve = ret;
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.get_reserve.label_reserve);
+ return GNUNET_SYSERR;
}
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_GET_RESERVE_HISTORY:
+ if (PERF_TALER_EXCHANGEDB_RESERVE != cmd[ret].exposed.type)
{
- int ret;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.get_reserve.label_reserve);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.get_reserve.index_reserve = ret;
+ }
+ break;
- ret = cmd_find (cmd,
- cmd[i].details.get_reserve_history.label_reserve);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
- cmd[i].details.get_reserve_history.label_reserve);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_RESERVE != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
+ case PERF_TALER_EXCHANGEDB_CMD_GET_RESERVE_HISTORY:
+ {
+ int ret;
+
+ ret = cmd_find (cmd,
cmd[i].details.get_reserve_history.label_reserve);
- return GNUNET_SYSERR;
- }
- cmd[i].details.get_reserve_history.index_reserve = ret;
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.get_reserve_history.label_reserve);
+ return GNUNET_SYSERR;
}
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_CREATE_WITHDRAW:
+ if (PERF_TALER_EXCHANGEDB_RESERVE != cmd[ret].exposed.type)
{
- int ret;
-
- ret = cmd_find (cmd,
- cmd[i].details.create_withdraw.label_dki);
- {
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
- cmd[i].details.create_withdraw.label_dki);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_DENOMINATION_INFO != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
- cmd[i].details.create_withdraw.label_dki);
- return GNUNET_SYSERR;
- }
- }
- cmd[i].details.create_withdraw.index_dki = ret;
- ret = cmd_find (cmd,
- cmd[i].details.create_withdraw.label_reserve);
- {
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
- cmd[i].details.create_withdraw.label_reserve);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_RESERVE != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
- cmd[i].details.create_withdraw.label_reserve);
- return GNUNET_SYSERR;
- }
- }
- cmd[i].details.create_withdraw.index_reserve = ret;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.get_reserve_history.label_reserve);
+ return GNUNET_SYSERR;
}
- break;
+ cmd[i].details.get_reserve_history.index_reserve = ret;
+ }
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_INSERT_WITHDRAW:
- {
- int ret;
+ case PERF_TALER_EXCHANGEDB_CMD_CREATE_WITHDRAW:
+ {
+ int ret;
- ret = cmd_find (cmd,
- cmd[i].details.insert_withdraw.label_coin);
+ ret = cmd_find (cmd,
+ cmd[i].details.create_withdraw.label_dki);
+ {
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
- cmd[i].details.insert_withdraw.label_coin);
+ cmd[i].details.create_withdraw.label_dki);
return GNUNET_SYSERR;
}
- if (PERF_TALER_EXCHANGEDB_COIN != cmd[ret].exposed.type)
+ if (PERF_TALER_EXCHANGEDB_DENOMINATION_INFO != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s\n",
i,
- cmd[i].details.insert_withdraw.label_coin);
+ cmd[i].details.create_withdraw.label_dki);
return GNUNET_SYSERR;
}
- cmd[i].details.insert_withdraw.index_coin = ret;
}
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_GET_WITHDRAW:
+ cmd[i].details.create_withdraw.index_dki = ret;
+ ret = cmd_find (cmd,
+ cmd[i].details.create_withdraw.label_reserve);
{
- int ret;
-
- ret = cmd_find (cmd,
- cmd[i].details.get_withdraw.label_coin);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
- cmd[i].details.get_withdraw.label_coin);
+ cmd[i].details.create_withdraw.label_reserve);
return GNUNET_SYSERR;
}
- if (PERF_TALER_EXCHANGEDB_COIN != cmd[ret].exposed.type)
+ if (PERF_TALER_EXCHANGEDB_RESERVE != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s\n",
i,
- cmd[i].details.get_withdraw.label_coin);
+ cmd[i].details.create_withdraw.label_reserve);
return GNUNET_SYSERR;
}
- cmd[i].details.get_withdraw.index_coin = ret;
}
- break;
+ cmd[i].details.create_withdraw.index_reserve = ret;
+ }
+ break;
+
+ case PERF_TALER_EXCHANGEDB_CMD_INSERT_WITHDRAW:
+ {
+ int ret;
- case PERF_TALER_EXCHANGEDB_CMD_GET_COIN_TRANSACTION:
+ ret = cmd_find (cmd,
+ cmd[i].details.insert_withdraw.label_coin);
+ if (GNUNET_SYSERR == ret)
{
- int ret;
- ret = cmd_find (cmd,
- cmd[i].details.get_coin_transaction.label_coin);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
- cmd[i].details.get_coin_transaction.label_coin);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_COIN != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
- cmd[i].details.get_coin_transaction.label_coin);
- return GNUNET_SYSERR;
- }
- cmd[i].details.get_coin_transaction.index_coin = ret;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.insert_withdraw.label_coin);
+ return GNUNET_SYSERR;
}
- break;
+ if (PERF_TALER_EXCHANGEDB_COIN != cmd[ret].exposed.type)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.insert_withdraw.label_coin);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.insert_withdraw.index_coin = ret;
+ }
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_CREATE_DEPOSIT:
+ case PERF_TALER_EXCHANGEDB_CMD_GET_WITHDRAW:
+ {
+ int ret;
+
+ ret = cmd_find (cmd,
+ cmd[i].details.get_withdraw.label_coin);
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.get_withdraw.label_coin);
+ return GNUNET_SYSERR;
+ }
+ if (PERF_TALER_EXCHANGEDB_COIN != cmd[ret].exposed.type)
{
- int ret;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.get_withdraw.label_coin);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.get_withdraw.index_coin = ret;
+ }
+ break;
- ret = cmd_find (cmd,
- cmd[i].details.create_deposit.label_coin);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
- cmd[i].details.create_deposit.label_coin);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_COIN != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
- cmd[i].details.create_deposit.label_coin);
- return GNUNET_SYSERR;
- }
- cmd[i].details.create_deposit.index_coin = ret;
+ case PERF_TALER_EXCHANGEDB_CMD_GET_COIN_TRANSACTION:
+ {
+ int ret;
+ ret = cmd_find (cmd,
+ cmd[i].details.get_coin_transaction.label_coin);
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.get_coin_transaction.label_coin);
+ return GNUNET_SYSERR;
+ }
+ if (PERF_TALER_EXCHANGEDB_COIN != cmd[ret].exposed.type)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.get_coin_transaction.label_coin);
+ return GNUNET_SYSERR;
}
- break;
+ cmd[i].details.get_coin_transaction.index_coin = ret;
+ }
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_INSERT_DEPOSIT:
+ case PERF_TALER_EXCHANGEDB_CMD_CREATE_DEPOSIT:
+ {
+ int ret;
+
+ ret = cmd_find (cmd,
+ cmd[i].details.create_deposit.label_coin);
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.create_deposit.label_coin);
+ return GNUNET_SYSERR;
+ }
+ if (PERF_TALER_EXCHANGEDB_COIN != cmd[ret].exposed.type)
{
- int ret;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.create_deposit.label_coin);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.create_deposit.index_coin = ret;
+ }
+ break;
- ret = cmd_find( cmd,
- cmd[i].details.insert_deposit.label_deposit);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
- cmd[i].details.insert_deposit.label_deposit);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_DEPOSIT != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
+ case PERF_TALER_EXCHANGEDB_CMD_INSERT_DEPOSIT:
+ {
+ int ret;
+
+ ret = cmd_find (cmd,
cmd[i].details.insert_deposit.label_deposit);
- return GNUNET_SYSERR;
- }
- cmd[i].details.insert_deposit.index_deposit = ret;
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.insert_deposit.label_deposit);
+ return GNUNET_SYSERR;
}
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_GET_DEPOSIT:
+ if (PERF_TALER_EXCHANGEDB_DEPOSIT != cmd[ret].exposed.type)
{
- int ret;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.insert_deposit.label_deposit);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.insert_deposit.index_deposit = ret;
+ }
+ break;
- ret = cmd_find (cmd,
- cmd[i].details.get_deposit.label_deposit);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
- cmd[i].details.get_deposit.label_deposit);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_DEPOSIT != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
+ case PERF_TALER_EXCHANGEDB_CMD_GET_DEPOSIT:
+ {
+ int ret;
+
+ ret = cmd_find (cmd,
cmd[i].details.get_deposit.label_deposit);
- return GNUNET_SYSERR;
- }
- cmd[i].details.get_deposit.index_deposit = ret;
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.get_deposit.label_deposit);
+ return GNUNET_SYSERR;
}
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_CREATE_REFRESH_SESSION:
+ if (PERF_TALER_EXCHANGEDB_DEPOSIT != cmd[ret].exposed.type)
{
- int ret;
-
- ret = cmd_find (cmd,
- cmd[i].details.create_refresh_session.label_coin);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s at %s\n",
- i,
- cmd[i].details.create_refresh_session.label_coin,
- cmd[i].label);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_COIN != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s at %s\n",
- i,
- cmd[i].details.create_refresh_session.label_coin,
- cmd[i].label);
- return GNUNET_SYSERR;
- }
- cmd[i].details.create_refresh_session.index_coin = ret;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.get_deposit.label_deposit);
+ return GNUNET_SYSERR;
}
- break;
+ cmd[i].details.get_deposit.index_deposit = ret;
+ }
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_SESSION:
- {
- int ret;
+ case PERF_TALER_EXCHANGEDB_CMD_CREATE_REFRESH_SESSION:
+ {
+ int ret;
- ret = cmd_find (cmd,
- cmd[i].details.get_refresh_session.label_hash);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s at %s\n",
- i,
- cmd[i].details.get_refresh_session.label_hash,
- cmd[i].label);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_REFRESH_HASH != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s at %s\n",
- i,
- cmd[i].details.get_refresh_session.label_hash,
- cmd[i].label);
- return GNUNET_SYSERR;
- }
- cmd[i].details.get_refresh_session.index_hash = ret;
+ ret = cmd_find (cmd,
+ cmd[i].details.create_refresh_session.label_coin);
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s at %s\n",
+ i,
+ cmd[i].details.create_refresh_session.label_coin,
+ cmd[i].label);
+ return GNUNET_SYSERR;
+ }
+ if (PERF_TALER_EXCHANGEDB_COIN != cmd[ret].exposed.type)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s at %s\n",
+ i,
+ cmd[i].details.create_refresh_session.label_coin,
+ cmd[i].label);
+ return GNUNET_SYSERR;
}
- break;
+ cmd[i].details.create_refresh_session.index_coin = ret;
+ }
+ break;
+
+ case PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_SESSION:
+ {
+ int ret;
- case PERF_TALER_EXCHANGEDB_CMD_INSERT_REFRESH_REVEAL:
+ ret = cmd_find (cmd,
+ cmd[i].details.get_refresh_session.label_hash);
+ if (GNUNET_SYSERR == ret)
{
- int ret;
- ret = cmd_find (cmd,
- cmd[i].details.insert_refresh_reveal.label_hash);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
- cmd[i].details.insert_refresh_reveal.label_hash);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_REFRESH_HASH != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s at %s\n",
+ i,
+ cmd[i].details.get_refresh_session.label_hash,
+ cmd[i].label);
+ return GNUNET_SYSERR;
+ }
+ if (PERF_TALER_EXCHANGEDB_REFRESH_HASH != cmd[ret].exposed.type)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s at %s\n",
+ i,
+ cmd[i].details.get_refresh_session.label_hash,
+ cmd[i].label);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.get_refresh_session.index_hash = ret;
+ }
+ break;
+
+ case PERF_TALER_EXCHANGEDB_CMD_INSERT_REFRESH_REVEAL:
+ {
+ int ret;
+ ret = cmd_find (cmd,
cmd[i].details.insert_refresh_reveal.label_hash);
- return GNUNET_SYSERR;
- }
- cmd[i].details.insert_refresh_reveal.index_hash = ret;
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.insert_refresh_reveal.label_hash);
+ return GNUNET_SYSERR;
+ }
+ if (PERF_TALER_EXCHANGEDB_REFRESH_HASH != cmd[ret].exposed.type)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.insert_refresh_reveal.label_hash);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.insert_refresh_reveal.index_hash = ret;
- ret = cmd_find (cmd,
- cmd[i].details.insert_refresh_reveal.label_denom);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
- cmd[i].details.insert_refresh_reveal.label_denom);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_DENOMINATION_INFO != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
+ ret = cmd_find (cmd,
cmd[i].details.insert_refresh_reveal.label_denom);
- return GNUNET_SYSERR;
- }
- cmd[i].details.insert_refresh_reveal.index_denom = ret;
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.insert_refresh_reveal.label_denom);
+ return GNUNET_SYSERR;
}
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_REVEAL:
+ if (PERF_TALER_EXCHANGEDB_DENOMINATION_INFO != cmd[ret].exposed.type)
{
- int ret;
- ret = cmd_find (cmd,
- cmd[i].details.get_refresh_reveal.label_hash);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
- cmd[i].details.get_refresh_reveal.label_hash);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_REFRESH_HASH != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.insert_refresh_reveal.label_denom);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.insert_refresh_reveal.index_denom = ret;
+ }
+ break;
+
+ case PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_REVEAL:
+ {
+ int ret;
+ ret = cmd_find (cmd,
cmd[i].details.get_refresh_reveal.label_hash);
- return GNUNET_SYSERR;
- }
- cmd[i].details.get_refresh_reveal.index_hash = ret;
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.get_refresh_reveal.label_hash);
+ return GNUNET_SYSERR;
}
- break;
+ if (PERF_TALER_EXCHANGEDB_REFRESH_HASH != cmd[ret].exposed.type)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.get_refresh_reveal.label_hash);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.get_refresh_reveal.index_hash = ret;
+ }
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_GET_LINK_DATA:
- {
- int ret;
- ret = cmd_find (cmd,
- cmd[i].details.get_link_data_list.label_hash);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Undefined reference to %s\n",
- i,
- cmd[i].details.get_link_data_list.label_hash);
- return GNUNET_SYSERR;
- }
- if (PERF_TALER_EXCHANGEDB_REFRESH_HASH != cmd[ret].exposed.type)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%d:Wrong type reference to %s\n",
- i,
+ case PERF_TALER_EXCHANGEDB_CMD_GET_LINK_DATA:
+ {
+ int ret;
+ ret = cmd_find (cmd,
cmd[i].details.get_link_data_list.label_hash);
- return GNUNET_SYSERR;
- }
- cmd[i].details.get_link_data_list.index_hash = ret;
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.get_link_data_list.label_hash);
+ return GNUNET_SYSERR;
}
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_END:
- case PERF_TALER_EXCHANGEDB_CMD_DEBUG:
- case PERF_TALER_EXCHANGEDB_CMD_LOOP:
- case PERF_TALER_EXCHANGEDB_CMD_NEW_SESSION:
- case PERF_TALER_EXCHANGEDB_CMD_START_TRANSACTION:
- case PERF_TALER_EXCHANGEDB_CMD_COMMIT_TRANSACTION:
- case PERF_TALER_EXCHANGEDB_CMD_ABORT_TRANSACTION:
- case PERF_TALER_EXCHANGEDB_CMD_GET_TIME:
- case PERF_TALER_EXCHANGEDB_CMD_CREATE_DENOMINATION:
- case PERF_TALER_EXCHANGEDB_CMD_CREATE_RESERVE:
- break;
+ if (PERF_TALER_EXCHANGEDB_REFRESH_HASH != cmd[ret].exposed.type)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.get_link_data_list.label_hash);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.get_link_data_list.index_hash = ret;
+ }
+ break;
+
+ case PERF_TALER_EXCHANGEDB_CMD_END:
+ case PERF_TALER_EXCHANGEDB_CMD_DEBUG:
+ case PERF_TALER_EXCHANGEDB_CMD_LOOP:
+ case PERF_TALER_EXCHANGEDB_CMD_NEW_SESSION:
+ case PERF_TALER_EXCHANGEDB_CMD_START_TRANSACTION:
+ case PERF_TALER_EXCHANGEDB_CMD_COMMIT_TRANSACTION:
+ case PERF_TALER_EXCHANGEDB_CMD_ABORT_TRANSACTION:
+ case PERF_TALER_EXCHANGEDB_CMD_GET_TIME:
+ case PERF_TALER_EXCHANGEDB_CMD_CREATE_DENOMINATION:
+ case PERF_TALER_EXCHANGEDB_CMD_CREATE_RESERVE:
+ break;
}
}
return GNUNET_OK;
@@ -897,30 +900,30 @@ cmd_clean (struct PERF_TALER_EXCHANGEDB_Cmd cmd[])
{
unsigned int i;
- for (i=0; PERF_TALER_EXCHANGEDB_CMD_END != cmd[i].command; i++)
+ for (i = 0; PERF_TALER_EXCHANGEDB_CMD_END != cmd[i].command; i++)
{
switch (cmd[i].command)
{
- case PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY:
- {
- unsigned int j;
+ case PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY:
+ {
+ 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]);
- }
- GNUNET_free (cmd[i].details.save_array.data_saved);
- cmd[i].details.save_array.data_saved = NULL;
+ for (j = 0; j < cmd[i].details.save_array.nb_saved; j++)
+ {
+ data_free (&cmd[i].details.save_array.data_saved[j]);
}
- break;
+ GNUNET_free (cmd[i].details.save_array.data_saved);
+ cmd[i].details.save_array.data_saved = NULL;
+ }
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_LOAD_ARRAY:
- GNUNET_free (cmd[i].details.load_array.permutation);
- cmd[i].details.load_array.permutation = NULL;
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_LOAD_ARRAY:
+ GNUNET_free (cmd[i].details.load_array.permutation);
+ cmd[i].details.load_array.permutation = NULL;
+ break;
- default:
- break;
+ default:
+ break;
}
data_free (&cmd[i].exposed);
}
@@ -986,27 +989,28 @@ interpret_save_array (struct PERF_TALER_EXCHANGEDB_interpreter_state *state)
}
/* The probability 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 = loop_ref->details.loop.max_iterations /
- cmd->details.save_array.nb_saved;
+ selection_chance = loop_ref->details.loop.max_iterations
+ / cmd->details.save_array.nb_saved;
/*
* If the remaining space is equal to the remaining number of
* iterations, the item is automaticly saved.
*
* Else it is saved only if the random numbre generated is 0
*/
- if ( (0 < (cmd->details.save_array.nb_saved -
- cmd->details.save_array.index) ) &&
- ( ((loop_ref->details.loop.max_iterations -
- loop_ref->details.loop.curr_iteration) ==
- (cmd->details.save_array.nb_saved -
- cmd->details.save_array.index)) ||
+ if ( (0 < (cmd->details.save_array.nb_saved
+ - cmd->details.save_array.index) ) &&
+ ( ((loop_ref->details.loop.max_iterations
+ - loop_ref->details.loop.curr_iteration) ==
+ (cmd->details.save_array.nb_saved
+ - cmd->details.save_array.index)) ||
(0 == GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
selection_chance)) ) )
{
struct PERF_TALER_EXCHANGEDB_Data *save_location;
struct PERF_TALER_EXCHANGEDB_Data *item_saved;
- save_location = &cmd->details.save_array.data_saved[cmd->details.save_array.index];
+ save_location =
+ &cmd->details.save_array.data_saved[cmd->details.save_array.index];
item_saved = &save_ref->exposed;
data_copy (item_saved, save_location);
cmd->details.save_array.index++;
@@ -1039,13 +1043,14 @@ interpret_load_array (struct PERF_TALER_EXCHANGEDB_interpreter_state *state)
* 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++)
+ for (i = 0; i<=quotient; i++)
loop_iter = cmd->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[loop_iter];
+ loaded_data =
+ &state->cmd[save_index].details.save_array.data_saved[loop_iter];
data_copy (loaded_data,
&cmd->exposed);
}
@@ -1065,7 +1070,8 @@ interprete_load_random (struct PERF_TALER_EXCHANGEDB_interpreter_state *state)
save_index = cmd->details.load_random.index_save;
index = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
- state->cmd[save_index].details.save_array.nb_saved);
+ state->cmd[save_index].details.save_array.
+ nb_saved);
data_copy (&state->cmd[save_index].details.save_array.data_saved[index],
&cmd->exposed);
}
@@ -1102,428 +1108,449 @@ refresh_reveal_cb (void *cls,
static int
interpret (struct PERF_TALER_EXCHANGEDB_interpreter_state *state)
{
- for (state->i=0; PERF_TALER_EXCHANGEDB_CMD_END != state->cmd[state->i].command; state->i++)
+ for (state->i = 0; PERF_TALER_EXCHANGEDB_CMD_END !=
+ state->cmd[state->i].command; state->i++)
{
switch (state->cmd[state->i].command)
{
- case PERF_TALER_EXCHANGEDB_CMD_END:
- return GNUNET_YES;
-
- case PERF_TALER_EXCHANGEDB_CMD_DEBUG:
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "%s\n",
- state->cmd[state->i].label);
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_LOOP:
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_END_LOOP:
- interpret_end_loop (state);
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_GET_TIME:
- state->cmd[state->i].exposed.data.time =
- GNUNET_new (struct GNUNET_TIME_Absolute);
- *state->cmd[state->i].exposed.data.time =
- GNUNET_TIME_absolute_get ();
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_GAUGER:
- {
- unsigned int start_index;
- unsigned int stop_index;
- float ips;
- struct GNUNET_TIME_Absolute start;
- struct GNUNET_TIME_Absolute stop;
- struct GNUNET_TIME_Relative elapsed;
-
- start_index = state->cmd[state->i].details.gauger.index_start;
- stop_index = state->cmd[state->i].details.gauger.index_stop;
- start = *state->cmd[start_index].exposed.data.time;
- stop = *state->cmd[stop_index].exposed.data.time;
- elapsed = GNUNET_TIME_absolute_get_difference (start,
- stop);
- ips = (1.0 * state->cmd[state->i].details.gauger.divide) / (elapsed.rel_value_us/1000000.0);
- GAUGER (state->cmd[state->i].details.gauger.category,
- state->cmd[state->i].details.gauger.description,
- ips,
- state->cmd[state->i].details.gauger.unit);
- }
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_END:
+ return GNUNET_YES;
- case PERF_TALER_EXCHANGEDB_CMD_NEW_SESSION:
- state->session = state->plugin->get_session (state->plugin->cls);
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_DEBUG:
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "%s\n",
+ state->cmd[state->i].label);
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_START_TRANSACTION:
- GNUNET_break (GNUNET_OK ==
- state->plugin->start (state->plugin->cls,
- state->session,
- "perf-interpreter"));
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_COMMIT_TRANSACTION:
- GNUNET_break (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS ==
- state->plugin->commit (state->plugin->cls,
- state->session));
- break;
- case PERF_TALER_EXCHANGEDB_CMD_ABORT_TRANSACTION:
- state->plugin->rollback (state->plugin->cls,
- state->session);
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY:
- interpret_save_array (state);
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_LOAD_ARRAY:
- interpret_load_array (state);
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_LOAD_RANDOM:
- interprete_load_random (state);
- break;
-
- case PERF_TALER_EXCHANGEDB_CMD_CREATE_DEPOSIT:
- {
- int coin_index;
- struct TALER_EXCHANGEDB_Deposit *deposit;
+ case PERF_TALER_EXCHANGEDB_CMD_LOOP:
+ break;
- coin_index = state->cmd[state->i].details.create_deposit.index_coin;
- deposit = PERF_TALER_EXCHANGEDB_deposit_init (state->cmd[coin_index].exposed.data.coin);
- GNUNET_assert (NULL != deposit);
- state->cmd[state->i].exposed.data.deposit = deposit;
- }
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_END_LOOP:
+ interpret_end_loop (state);
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_INSERT_DEPOSIT:
- {
- int deposit_index;
- enum GNUNET_DB_QueryStatus qs;
- struct TALER_EXCHANGEDB_Deposit *deposit;
+ case PERF_TALER_EXCHANGEDB_CMD_GET_TIME:
+ state->cmd[state->i].exposed.data.time =
+ GNUNET_new (struct GNUNET_TIME_Absolute);
+ *state->cmd[state->i].exposed.data.time =
+ GNUNET_TIME_absolute_get ();
+ break;
- deposit_index = state->cmd[state->i].details.insert_deposit.index_deposit;
- deposit = state->cmd[deposit_index].exposed.data.deposit;
- qs = state->plugin->ensure_coin_known (state->plugin->cls,
- state->session,
- &deposit->coin);
- GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs);
- qs = state->plugin->insert_deposit (state->plugin->cls,
- state->session,
- deposit);
- GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs);
- state->cmd[state->i].exposed.data.deposit
- = PERF_TALER_EXCHANGEDB_deposit_copy (deposit);
- }
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_GAUGER:
+ {
+ unsigned int start_index;
+ unsigned int stop_index;
+ float ips;
+ struct GNUNET_TIME_Absolute start;
+ struct GNUNET_TIME_Absolute stop;
+ struct GNUNET_TIME_Relative elapsed;
+
+ start_index = state->cmd[state->i].details.gauger.index_start;
+ stop_index = state->cmd[state->i].details.gauger.index_stop;
+ start = *state->cmd[start_index].exposed.data.time;
+ stop = *state->cmd[stop_index].exposed.data.time;
+ elapsed = GNUNET_TIME_absolute_get_difference (start,
+ stop);
+ ips = (1.0 * state->cmd[state->i].details.gauger.divide)
+ / (elapsed.rel_value_us / 1000000.0);
+ GAUGER (state->cmd[state->i].details.gauger.category,
+ state->cmd[state->i].details.gauger.description,
+ ips,
+ state->cmd[state->i].details.gauger.unit);
+ }
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_GET_DEPOSIT:
- {
- unsigned int source_index;
- enum GNUNET_DB_QueryStatus ret;
- struct PERF_TALER_EXCHANGEDB_Data *data;
-
- source_index = state->cmd[state->i].details.get_deposit.index_deposit;
- data = &state->cmd[source_index].exposed;
- ret = state->plugin->have_deposit (state->plugin->cls,
- state->session,
- data->data.deposit,
- GNUNET_YES);
- GNUNET_assert (0 >= ret);
- }
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_NEW_SESSION:
+ state->session = state->plugin->get_session (state->plugin->cls);
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_CREATE_RESERVE:
- {
- struct PERF_TALER_EXCHANGEDB_Reserve *reserve;
+ case PERF_TALER_EXCHANGEDB_CMD_START_TRANSACTION:
+ GNUNET_break (GNUNET_OK ==
+ state->plugin->start (state->plugin->cls,
+ state->session,
+ "perf-interpreter"));
+ break;
- reserve = PERF_TALER_EXCHANGEDB_reserve_init ();
- state->cmd[state->i].exposed.data.reserve = reserve;
- }
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_COMMIT_TRANSACTION:
+ GNUNET_break (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS ==
+ state->plugin->commit (state->plugin->cls,
+ state->session));
+ break;
+ case PERF_TALER_EXCHANGEDB_CMD_ABORT_TRANSACTION:
+ state->plugin->rollback (state->plugin->cls,
+ state->session);
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_INSERT_RESERVE:
- {
- unsigned int reserve_index;
- int ret;
- struct PERF_TALER_EXCHANGEDB_Reserve *reserve;
- char *sndr;
- uint32_t uid;
- struct GNUNET_TIME_Absolute now;
-
- reserve_index = state->cmd[state->i].details.insert_reserve.index_reserve;
- reserve = state->cmd[reserve_index].exposed.data.reserve;
- GNUNET_asprintf (&sndr,
- "payto://x-taler-test/localhost:8080/%u",
- (unsigned int) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
- UINT32_MAX));
- uid = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
- UINT32_MAX);
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
- ret = state->plugin->reserves_in_insert (state->plugin->cls,
- state->session,
- &reserve->reserve.pub,
- &reserve->reserve.balance,
- now,
- sndr,
- "account-1",
- &uid,
- sizeof (uid));
- GNUNET_assert (GNUNET_SYSERR != ret);
- GNUNET_free (sndr);
- }
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY:
+ interpret_save_array (state);
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_GET_RESERVE:
- {
- unsigned int reserve_index;
- int ret;
- struct PERF_TALER_EXCHANGEDB_Data *data;
+ case PERF_TALER_EXCHANGEDB_CMD_LOAD_ARRAY:
+ interpret_load_array (state);
+ break;
+ case PERF_TALER_EXCHANGEDB_CMD_LOAD_RANDOM:
+ interprete_load_random (state);
+ break;
+
+ case PERF_TALER_EXCHANGEDB_CMD_CREATE_DEPOSIT:
+ {
+ int coin_index;
+ struct TALER_EXCHANGEDB_Deposit *deposit;
+
+ coin_index = state->cmd[state->i].details.create_deposit.index_coin;
+ deposit = PERF_TALER_EXCHANGEDB_deposit_init (
+ state->cmd[coin_index].exposed.data.coin);
+ GNUNET_assert (NULL != deposit);
+ state->cmd[state->i].exposed.data.deposit = deposit;
+ }
+ break;
- reserve_index = state->cmd[state->i].details.get_reserve.index_reserve;
- data = &state->cmd[reserve_index].exposed;
- ret = state->plugin->reserve_get (state->plugin->cls,
+ case PERF_TALER_EXCHANGEDB_CMD_INSERT_DEPOSIT:
+ {
+ int deposit_index;
+ enum GNUNET_DB_QueryStatus qs;
+ struct TALER_EXCHANGEDB_Deposit *deposit;
+
+ deposit_index =
+ state->cmd[state->i].details.insert_deposit.index_deposit;
+ deposit = state->cmd[deposit_index].exposed.data.deposit;
+ qs = state->plugin->ensure_coin_known (state->plugin->cls,
+ state->session,
+ &deposit->coin);
+ GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs);
+ qs = state->plugin->insert_deposit (state->plugin->cls,
state->session,
- &data->data.reserve->reserve);
- GNUNET_assert (GNUNET_OK == ret);
- }
- break;
+ deposit);
+ GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs);
+ state->cmd[state->i].exposed.data.deposit
+ = PERF_TALER_EXCHANGEDB_deposit_copy (deposit);
+ }
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_GET_RESERVE_HISTORY:
- {
- unsigned int reserve_index;
- struct TALER_EXCHANGEDB_ReserveHistory *history;
- struct PERF_TALER_EXCHANGEDB_Data *data;
- enum GNUNET_DB_QueryStatus qs;
-
- reserve_index = state->cmd[state->i].details.get_reserve_history.index_reserve;
- data = &state->cmd[reserve_index].exposed;
- qs = state->plugin->get_reserve_history (state->plugin->cls,
- state->session,
- &data->data.reserve->reserve.pub,
- &history);
- GNUNET_assert (0 >= qs);
- GNUNET_assert (NULL != history);
- state->plugin->free_reserve_history (state->plugin->cls,
- history);
- }
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_GET_DEPOSIT:
+ {
+ unsigned int source_index;
+ enum GNUNET_DB_QueryStatus ret;
+ struct PERF_TALER_EXCHANGEDB_Data *data;
+
+ source_index = state->cmd[state->i].details.get_deposit.index_deposit;
+ data = &state->cmd[source_index].exposed;
+ ret = state->plugin->have_deposit (state->plugin->cls,
+ state->session,
+ data->data.deposit,
+ GNUNET_YES);
+ GNUNET_assert (0 >= ret);
+ }
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_CREATE_DENOMINATION:
- {
- struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki =
- PERF_TALER_EXCHANGEDB_denomination_init ();
- GNUNET_assert (NULL != dki);
- state->cmd[state->i].exposed.data.dki = dki;
- }
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_CREATE_RESERVE:
+ {
+ struct PERF_TALER_EXCHANGEDB_Reserve *reserve;
- case PERF_TALER_EXCHANGEDB_CMD_INSERT_DENOMINATION:
- {
- unsigned int denom_index;
- enum GNUNET_DB_QueryStatus ret;
- struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki ;
+ reserve = PERF_TALER_EXCHANGEDB_reserve_init ();
+ state->cmd[state->i].exposed.data.reserve = reserve;
+ }
+ break;
- denom_index = state->cmd[state->i].details.insert_denomination.index_denom;
- dki = state->cmd[denom_index].exposed.data.dki;
- ret = state->plugin->insert_denomination_info (state->plugin->cls,
- state->session,
- &dki->denom_pub,
- &dki->issue);
- GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == ret);
- }
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_INSERT_RESERVE:
+ {
+ unsigned int reserve_index;
+ int ret;
+ struct PERF_TALER_EXCHANGEDB_Reserve *reserve;
+ char *sndr;
+ uint32_t uid;
+ struct GNUNET_TIME_Absolute now;
+
+ reserve_index =
+ state->cmd[state->i].details.insert_reserve.index_reserve;
+ reserve = state->cmd[reserve_index].exposed.data.reserve;
+ GNUNET_asprintf (&sndr,
+ "payto://x-taler-test/localhost:8080/%u",
+ (unsigned int) GNUNET_CRYPTO_random_u32 (
+ GNUNET_CRYPTO_QUALITY_WEAK,
+ UINT32_MAX));
+ uid = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
+ UINT32_MAX);
+ now = GNUNET_TIME_absolute_get ();
+ (void) GNUNET_TIME_round_abs (&now);
+ ret = state->plugin->reserves_in_insert (state->plugin->cls,
+ state->session,
+ &reserve->reserve.pub,
+ &reserve->reserve.balance,
+ now,
+ sndr,
+ "account-1",
+ &uid,
+ sizeof (uid));
+ GNUNET_assert (GNUNET_SYSERR != ret);
+ GNUNET_free (sndr);
+ }
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_GET_DENOMINATION:
- {
- unsigned int denom_index;
- enum GNUNET_DB_QueryStatus qs;
- struct PERF_TALER_EXCHANGEDB_Data *data;
- struct GNUNET_HashCode hc;
-
- denom_index = state->cmd[state->i].details.get_denomination.index_denom;
- data = &state->cmd[denom_index].exposed;
- GNUNET_CRYPTO_rsa_public_key_hash (data->data.dki->denom_pub.rsa_public_key,
- &hc);
- qs = state->plugin->get_denomination_info (state->plugin->cls,
- state->session,
- &hc,
- &data->data.dki->issue);
- GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs);
- }
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_GET_RESERVE:
+ {
+ unsigned int reserve_index;
+ int ret;
+ struct PERF_TALER_EXCHANGEDB_Data *data;
- case PERF_TALER_EXCHANGEDB_CMD_CREATE_WITHDRAW:
- {
- unsigned int dki_index;
- unsigned int reserve_index;
- struct PERF_TALER_EXCHANGEDB_Coin *coin;
-
- dki_index = state->cmd[state->i].details.create_withdraw.index_dki;
- reserve_index = state->cmd[state->i].details.create_withdraw.index_reserve;
- coin = PERF_TALER_EXCHANGEDB_coin_init (state->cmd[dki_index].exposed.data.dki,
- state->cmd[reserve_index].exposed.data.reserve);
- GNUNET_assert (NULL != coin);
- state->cmd[state->i].exposed.data.coin = coin;
- }
- break;
- case PERF_TALER_EXCHANGEDB_CMD_INSERT_WITHDRAW:
- {
- unsigned int coin_index;
- enum GNUNET_DB_QueryStatus qs;
- struct PERF_TALER_EXCHANGEDB_Coin *coin;
-
- coin_index = state->cmd[state->i].details.insert_withdraw.index_coin;
- coin = state->cmd[coin_index].exposed.data.coin;
- qs = state->plugin->insert_withdraw_info (state->plugin->cls,
- state->session,
- &coin->blind);
- GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs);
- }
- break;
+ reserve_index = state->cmd[state->i].details.get_reserve.index_reserve;
+ data = &state->cmd[reserve_index].exposed;
+ ret = state->plugin->reserve_get (state->plugin->cls,
+ state->session,
+ &data->data.reserve->reserve);
+ GNUNET_assert (GNUNET_OK == ret);
+ }
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_GET_WITHDRAW:
- {
- unsigned int source_index;
- enum GNUNET_DB_QueryStatus qs;
- struct PERF_TALER_EXCHANGEDB_Data *data;
-
- source_index = state->cmd[state->i].details.get_denomination.index_denom;
- data = &state->cmd[source_index].exposed;
- qs = state->plugin->get_withdraw_info (state->plugin->cls,
- state->session,
- &data->data.coin->blind.h_coin_envelope,
- &data->data.coin->blind);
- GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs);
- }
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_GET_RESERVE_HISTORY:
+ {
+ unsigned int reserve_index;
+ struct TALER_EXCHANGEDB_ReserveHistory *history;
+ struct PERF_TALER_EXCHANGEDB_Data *data;
+ enum GNUNET_DB_QueryStatus qs;
+
+ reserve_index =
+ state->cmd[state->i].details.get_reserve_history.index_reserve;
+ data = &state->cmd[reserve_index].exposed;
+ qs = state->plugin->get_reserve_history (state->plugin->cls,
+ state->session,
+ &data->data.reserve->reserve.
+ pub,
+ &history);
+ GNUNET_assert (0 >= qs);
+ GNUNET_assert (NULL != history);
+ state->plugin->free_reserve_history (state->plugin->cls,
+ history);
+ }
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_GET_COIN_TRANSACTION:
- {
- unsigned int coin_index;
- struct PERF_TALER_EXCHANGEDB_Coin *coin;
- struct TALER_EXCHANGEDB_TransactionList *transactions;
- enum GNUNET_DB_QueryStatus qs;
-
- coin_index = state->cmd[state->i].details.get_coin_transaction.index_coin;
- coin = state->cmd[coin_index].exposed.data.coin;
- qs = state->plugin->get_coin_transactions (state->plugin->cls,
- state->session,
- &coin->public_info.coin_pub,
- GNUNET_YES,
- &transactions);
- GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs);
- GNUNET_assert (transactions != NULL);
- state->plugin->free_coin_transaction_list (state->plugin->cls,
- transactions);
- }
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_CREATE_DENOMINATION:
+ {
+ struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki =
+ PERF_TALER_EXCHANGEDB_denomination_init ();
+ GNUNET_assert (NULL != dki);
+ state->cmd[state->i].exposed.data.dki = dki;
+ }
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_CREATE_REFRESH_SESSION:
- {
- struct TALER_EXCHANGEDB_RefreshSession refresh_session;
- unsigned int coin_index;
- struct PERF_TALER_EXCHANGEDB_Coin *coin;
-
- coin_index = state->cmd[state->i].details.create_refresh_session.index_coin;
- coin = state->cmd[coin_index].exposed.data.coin;
-
- refresh_session.coin = coin->public_info;
- GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
- &refresh_session.coin_sig,
- sizeof (refresh_session.coin_sig));
- GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
- &refresh_session.rc.session_hash);
- GNUNET_assert (GNUNET_OK ==
- TALER_string_to_amount (CURRENCY ":1.1",
- &refresh_session.amount_with_fee));
- refresh_session.noreveal_index = 1;
- GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT ==
- state->plugin->ensure_coin_known (state->plugin->cls,
- state->session,
- &refresh_session.coin));
- GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT ==
- state->plugin->insert_melt (state->plugin->cls,
- state->session,
- &refresh_session));
- state->cmd[state->i].exposed.data.rc = refresh_session.rc;
- }
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_INSERT_DENOMINATION:
+ {
+ unsigned int denom_index;
+ enum GNUNET_DB_QueryStatus ret;
+ struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki;
+
+ denom_index =
+ state->cmd[state->i].details.insert_denomination.index_denom;
+ dki = state->cmd[denom_index].exposed.data.dki;
+ ret = state->plugin->insert_denomination_info (state->plugin->cls,
+ state->session,
+ &dki->denom_pub,
+ &dki->issue);
+ GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == ret);
+ }
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_SESSION:
- {
- unsigned int hash_index;
- const struct TALER_RefreshCommitmentP *rc;
- struct TALER_EXCHANGEDB_RefreshMelt refresh;
-
- hash_index = state->cmd[state->i].details.get_refresh_session.index_hash;
- rc = &state->cmd[hash_index].exposed.data.rc;
- state->plugin->get_melt (state->plugin->cls,
- state->session,
- rc,
- &refresh);
- }
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_GET_DENOMINATION:
+ {
+ unsigned int denom_index;
+ enum GNUNET_DB_QueryStatus qs;
+ struct PERF_TALER_EXCHANGEDB_Data *data;
+ struct GNUNET_HashCode hc;
+
+ denom_index = state->cmd[state->i].details.get_denomination.index_denom;
+ data = &state->cmd[denom_index].exposed;
+ GNUNET_CRYPTO_rsa_public_key_hash (
+ data->data.dki->denom_pub.rsa_public_key,
+ &hc);
+ qs = state->plugin->get_denomination_info (state->plugin->cls,
+ state->session,
+ &hc,
+ &data->data.dki->issue);
+ GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs);
+ }
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_INSERT_REFRESH_REVEAL:
- {
- unsigned int hash_index;
- unsigned int denom_index;
- const struct TALER_RefreshCommitmentP *rc;
- struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *denom;
- struct TALER_TransferPublicKeyP tpub;
- struct TALER_TransferPrivateKeyP tprivs[2];
- struct TALER_EXCHANGEDB_RefreshRevealedCoin rrc;
-
- hash_index = state->cmd[state->i].details.insert_refresh_reveal.index_hash;
- denom_index = state->cmd[state->i].details.insert_refresh_reveal.index_denom;
- rc = &state->cmd[hash_index].exposed.data.rc;
- denom = state->cmd[denom_index].exposed.data.dki;
- rrc.denom_pub = denom->denom_pub;
- rrc.coin_ev = "coin_ev";
- rrc.coin_ev_size = strlen (rrc.coin_ev) + 1;
- GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
- &rrc.coin_sig,
- sizeof (struct TALER_CoinSpendSignatureP));
- GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
- tprivs,
- sizeof (struct TALER_TransferPrivateKeyP) * 2);
- GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
- &tpub,
- sizeof (struct TALER_TransferPublicKeyP));
- GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT ==
- state->plugin->insert_refresh_reveal (state->plugin->cls,
- state->session,
- rc,
- 1,
- &rrc,
- 2,
- tprivs,
- &tpub));
- }
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_CREATE_WITHDRAW:
+ {
+ unsigned int dki_index;
+ unsigned int reserve_index;
+ struct PERF_TALER_EXCHANGEDB_Coin *coin;
+
+ dki_index = state->cmd[state->i].details.create_withdraw.index_dki;
+ reserve_index =
+ state->cmd[state->i].details.create_withdraw.index_reserve;
+ coin = PERF_TALER_EXCHANGEDB_coin_init (
+ state->cmd[dki_index].exposed.data.dki,
+ state->cmd[reserve_index].
+ exposed.data.reserve);
+ GNUNET_assert (NULL != coin);
+ state->cmd[state->i].exposed.data.coin = coin;
+ }
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_REVEAL:
- {
- int hash_index;
- const struct TALER_RefreshCommitmentP *rc;
-
- hash_index = state->cmd[state->i].details.get_refresh_reveal.index_hash;
- rc = &state->cmd[hash_index].exposed.data.rc;
- state->plugin->get_refresh_reveal (state->plugin->cls,
- state->session,
- rc,
- &refresh_reveal_cb,
- state);
- }
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_INSERT_WITHDRAW:
+ {
+ unsigned int coin_index;
+ enum GNUNET_DB_QueryStatus qs;
+ struct PERF_TALER_EXCHANGEDB_Coin *coin;
+
+ coin_index = state->cmd[state->i].details.insert_withdraw.index_coin;
+ coin = state->cmd[coin_index].exposed.data.coin;
+ qs = state->plugin->insert_withdraw_info (state->plugin->cls,
+ state->session,
+ &coin->blind);
+ GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs);
+ }
+ break;
- case PERF_TALER_EXCHANGEDB_CMD_GET_LINK_DATA:
- break;
+ case PERF_TALER_EXCHANGEDB_CMD_GET_WITHDRAW:
+ {
+ unsigned int source_index;
+ enum GNUNET_DB_QueryStatus qs;
+ struct PERF_TALER_EXCHANGEDB_Data *data;
+
+ source_index =
+ state->cmd[state->i].details.get_denomination.index_denom;
+ data = &state->cmd[source_index].exposed;
+ qs = state->plugin->get_withdraw_info (state->plugin->cls,
+ state->session,
+ &data->data.coin->blind.
+ h_coin_envelope,
+ &data->data.coin->blind);
+ GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs);
+ }
+ break;
+
+ case PERF_TALER_EXCHANGEDB_CMD_GET_COIN_TRANSACTION:
+ {
+ unsigned int coin_index;
+ struct PERF_TALER_EXCHANGEDB_Coin *coin;
+ struct TALER_EXCHANGEDB_TransactionList *transactions;
+ enum GNUNET_DB_QueryStatus qs;
+
+ coin_index =
+ state->cmd[state->i].details.get_coin_transaction.index_coin;
+ coin = state->cmd[coin_index].exposed.data.coin;
+ qs = state->plugin->get_coin_transactions (state->plugin->cls,
+ state->session,
+ &coin->public_info.coin_pub,
+ GNUNET_YES,
+ &transactions);
+ GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs);
+ GNUNET_assert (transactions != NULL);
+ state->plugin->free_coin_transaction_list (state->plugin->cls,
+ transactions);
+ }
+ break;
+
+ case PERF_TALER_EXCHANGEDB_CMD_CREATE_REFRESH_SESSION:
+ {
+ struct TALER_EXCHANGEDB_RefreshSession refresh_session;
+ unsigned int coin_index;
+ struct PERF_TALER_EXCHANGEDB_Coin *coin;
+
+ coin_index =
+ state->cmd[state->i].details.create_refresh_session.index_coin;
+ coin = state->cmd[coin_index].exposed.data.coin;
+
+ refresh_session.coin = coin->public_info;
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+ &refresh_session.coin_sig,
+ sizeof (refresh_session.coin_sig));
+ GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
+ &refresh_session.rc.session_hash);
+ GNUNET_assert (GNUNET_OK ==
+ TALER_string_to_amount (CURRENCY ":1.1",
+ &refresh_session.amount_with_fee));
+ refresh_session.noreveal_index = 1;
+ GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT ==
+ state->plugin->ensure_coin_known (state->plugin->cls,
+ state->session,
+ &refresh_session.coin));
+ GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT ==
+ state->plugin->insert_melt (state->plugin->cls,
+ state->session,
+ &refresh_session));
+ state->cmd[state->i].exposed.data.rc = refresh_session.rc;
+ }
+ break;
+
+ case PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_SESSION:
+ {
+ unsigned int hash_index;
+ const struct TALER_RefreshCommitmentP *rc;
+ struct TALER_EXCHANGEDB_RefreshMelt refresh;
+
+ hash_index =
+ state->cmd[state->i].details.get_refresh_session.index_hash;
+ rc = &state->cmd[hash_index].exposed.data.rc;
+ state->plugin->get_melt (state->plugin->cls,
+ state->session,
+ rc,
+ &refresh);
+ }
+ break;
+
+ case PERF_TALER_EXCHANGEDB_CMD_INSERT_REFRESH_REVEAL:
+ {
+ unsigned int hash_index;
+ unsigned int denom_index;
+ const struct TALER_RefreshCommitmentP *rc;
+ struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *denom;
+ struct TALER_TransferPublicKeyP tpub;
+ struct TALER_TransferPrivateKeyP tprivs[2];
+ struct TALER_EXCHANGEDB_RefreshRevealedCoin rrc;
+
+ hash_index =
+ state->cmd[state->i].details.insert_refresh_reveal.index_hash;
+ denom_index =
+ state->cmd[state->i].details.insert_refresh_reveal.index_denom;
+ rc = &state->cmd[hash_index].exposed.data.rc;
+ denom = state->cmd[denom_index].exposed.data.dki;
+ rrc.denom_pub = denom->denom_pub;
+ rrc.coin_ev = "coin_ev";
+ rrc.coin_ev_size = strlen (rrc.coin_ev) + 1;
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+ &rrc.coin_sig,
+ sizeof (struct TALER_CoinSpendSignatureP));
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+ tprivs,
+ sizeof (struct TALER_TransferPrivateKeyP)
+ * 2);
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+ &tpub,
+ sizeof (struct TALER_TransferPublicKeyP));
+ GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT ==
+ state->plugin->insert_refresh_reveal (state->plugin->cls,
+ state->session,
+ rc,
+ 1,
+ &rrc,
+ 2,
+ tprivs,
+ &tpub));
+ }
+ break;
+
+ case PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_REVEAL:
+ {
+ int hash_index;
+ const struct TALER_RefreshCommitmentP *rc;
+
+ hash_index = state->cmd[state->i].details.get_refresh_reveal.index_hash;
+ rc = &state->cmd[hash_index].exposed.data.rc;
+ state->plugin->get_refresh_reveal (state->plugin->cls,
+ state->session,
+ rc,
+ &refresh_reveal_cb,
+ state);
+ }
+ break;
+
+ case PERF_TALER_EXCHANGEDB_CMD_GET_LINK_DATA:
+ break;
}
}
@@ -1579,80 +1606,80 @@ PERF_TALER_EXCHANGEDB_run_benchmark (const char *benchmark_name,
struct TALER_EXCHANGEDB_Plugin *plugin;
struct GNUNET_CONFIGURATION_Handle *config;
int ret = 0;
- struct PERF_TALER_EXCHANGEDB_Cmd init_def[] =
- {
+ struct PERF_TALER_EXCHANGEDB_Cmd init_def[] = {
// Denomination used to create coins
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("00 - Start of interpreter"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("01 - denomination loop",
- PERF_TALER_EXCHANGEDB_NB_DENOMINATION_INIT),
+ PERF_TALER_EXCHANGEDB_NB_DENOMINATION_INIT),
PERF_TALER_EXCHANGEDB_INIT_CMD_START_TRANSACTION (""),
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_DENOMINATION ("01 - denomination"),
PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_DENOMINATION ("01 - insert",
- "01 - denomination"),
+ "01 - denomination"),
PERF_TALER_EXCHANGEDB_INIT_CMD_COMMIT_TRANSACTION (""),
PERF_TALER_EXCHANGEDB_INIT_CMD_SAVE_ARRAY ("01 - save denomination",
- "01 - denomination loop",
- "01 - denomination",
- PERF_TALER_EXCHANGEDB_NB_DENOMINATION_SAVE),
+ "01 - denomination loop",
+ "01 - denomination",
+ PERF_TALER_EXCHANGEDB_NB_DENOMINATION_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("",
- "01 - denomination loop"),
+ "01 - denomination loop"),
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("01 - init denomination complete"),
// End of initialization
// Reserve initialization
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("02 - init reserve loop",
- PERF_TALER_EXCHANGEDB_NB_RESERVE_INIT),
+ PERF_TALER_EXCHANGEDB_NB_RESERVE_INIT),
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_RESERVE ("02 - reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_RESERVE ("02 - insert",
- "02 - reserve"),
+ "02 - reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_SAVE_ARRAY ("02 - save reserve",
- "02 - init reserve loop",
- "02 - reserve",
- PERF_TALER_EXCHANGEDB_NB_RESERVE_SAVE),
+ "02 - init reserve loop",
+ "02 - reserve",
+ PERF_TALER_EXCHANGEDB_NB_RESERVE_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("",
- "02 - init reserve loop"),
+ "02 - init reserve loop"),
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("02 - reserve init complete"),
// End reserve init
// Withdrawal initialization
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("03 - init withdraw loop",
- PERF_TALER_EXCHANGEDB_NB_WITHDRAW_INIT),
+ PERF_TALER_EXCHANGEDB_NB_WITHDRAW_INIT),
PERF_TALER_EXCHANGEDB_INIT_CMD_START_TRANSACTION (""),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("03 - denomination load",
- "03 - init withdraw loop",
- "01 - save denomination"),
+ "03 - init withdraw loop",
+ "01 - save denomination"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("03 - reserve load",
- "03 - init withdraw loop",
- "02 - save reserve"),
+ "03 - init withdraw loop",
+ "02 - save reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_WITHDRAW ("03 - withdraw",
- "03 - denomination load",
- "03 - reserve load"),
+ "03 - denomination load",
+ "03 - reserve load"),
PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_WITHDRAW ("03 - insert",
- "03 - withdraw"),
+ "03 - withdraw"),
PERF_TALER_EXCHANGEDB_INIT_CMD_COMMIT_TRANSACTION (""),
PERF_TALER_EXCHANGEDB_INIT_CMD_SAVE_ARRAY ("03 - save coin",
- "03 - init withdraw loop",
- "03 - withdraw",
- PERF_TALER_EXCHANGEDB_NB_WITHDRAW_SAVE),
+ "03 - init withdraw loop",
+ "03 - withdraw",
+ PERF_TALER_EXCHANGEDB_NB_WITHDRAW_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("",
- "03 - init withdraw loop"),
+ "03 - init withdraw loop"),
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("03 - withdraw init complete"),
- //End of withdrawal initialization
- //Deposit initialization
+ // End of withdrawal initialization
+ // Deposit initialization
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("04 - deposit init loop",
- PERF_TALER_EXCHANGEDB_NB_DEPOSIT_INIT),
+ PERF_TALER_EXCHANGEDB_NB_DEPOSIT_INIT),
PERF_TALER_EXCHANGEDB_INIT_CMD_START_TRANSACTION ("04 - start transaction"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("04 - denomination load",
- "04 - deposit init loop",
- "03 - save coin"),
+ "04 - deposit init loop",
+ "03 - save coin"),
PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_DEPOSIT ("04 - deposit",
- "04 - denomination load"),
- PERF_TALER_EXCHANGEDB_INIT_CMD_COMMIT_TRANSACTION ("04 - commit transaction"),
+ "04 - denomination load"),
+ PERF_TALER_EXCHANGEDB_INIT_CMD_COMMIT_TRANSACTION (
+ "04 - commit transaction"),
PERF_TALER_EXCHANGEDB_INIT_CMD_SAVE_ARRAY ("04 - deposit array",
- "04 - deposit init loop",
- "04 - deposit",
- PERF_TALER_EXCHANGEDB_NB_DEPOSIT_SAVE),
+ "04 - deposit init loop",
+ "04 - deposit",
+ PERF_TALER_EXCHANGEDB_NB_DEPOSIT_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("04 - deposit init loop end",
- "04 - deposit init loop"),
+ "04 - deposit init loop"),
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("04 - deposit init complete"),
// End of deposit initialization
PERF_TALER_EXCHANGEDB_INIT_CMD_END ("end")
@@ -1703,7 +1730,7 @@ PERF_TALER_EXCHANGEDB_run_benchmark (const char *benchmark_name,
* Running the benchmark
*/
ret = PERF_TALER_EXCHANGEDB_interpret (plugin,
- benchmark);
+ benchmark);
if (GNUNET_OK != ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/exchangedb/perf_taler_exchangedb_interpreter.h b/src/exchangedb/perf_taler_exchangedb_interpreter.h
index 60e676069..414e33fe0 100644
--- a/src/exchangedb/perf_taler_exchangedb_interpreter.h
+++ b/src/exchangedb/perf_taler_exchangedb_interpreter.h
@@ -53,11 +53,11 @@
* @param _label The label of the command
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_END(_label) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_END, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE \
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_END, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE \
+ }
/**
@@ -67,11 +67,11 @@
* will be logged each time the command runs
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG(_label) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_DEBUG, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE \
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_DEBUG, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE \
+ }
/**
* The begining of a loop
@@ -80,14 +80,14 @@
* @param _iter the number of iterations of the loop
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP(_label, _iter) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_LOOP , \
- .label = _label , \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE , \
- .details.loop = { \
- .max_iterations = _iter , \
- .curr_iteration = 0 } \
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_LOOP, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
+ .details.loop = { \
+ .max_iterations = _iter, \
+ .curr_iteration = 0 } \
+ }
/**
* Marks the end of the loop @_label_loop
@@ -96,12 +96,12 @@
* @param _label_loop the label of the loop closed by this command
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP(_label, _label_loop) \
-{\
- .command = PERF_TALER_EXCHANGEDB_CMD_END_LOOP , \
- .label = _label , \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE , \
- .details.end_loop.label_loop = _label_loop \
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_END_LOOP, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
+ .details.end_loop.label_loop = _label_loop \
+ }
/**
* Saves the time of execution to use for logging with Gauger
@@ -109,11 +109,11 @@
* @param _label the label of the command
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME(_label) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_GET_TIME, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_TIME \
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_GET_TIME, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_TIME \
+ }
/**
* Commits the duration between @a _label_start and @a _label_stop
@@ -126,20 +126,22 @@
* @param _unit the unit of the data measured, typicly something/sec
* @param _divide number of measurments in the interval
*/
-#define PERF_TALER_EXCHANGEDB_INIT_CMD_GAUGER(_label, _label_start, _label_stop, _category, _description, _unit, _divide) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_GAUGER, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
- .details.gauger = { \
- .label_start = _label_start, \
- .label_stop = _label_stop, \
- .category = _category, \
- .description = _description, \
- .unit = _unit, \
- .divide = _divide, \
- } \
-}
+#define PERF_TALER_EXCHANGEDB_INIT_CMD_GAUGER(_label, _label_start, _label_stop, \
+ _category, _description, _unit, \
+ _divide) \
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_GAUGER, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
+ .details.gauger = { \
+ .label_start = _label_start, \
+ .label_stop = _label_stop, \
+ .category = _category, \
+ .description = _description, \
+ .unit = _unit, \
+ .divide = _divide, \
+ } \
+ }
/**
* Initiate a database transaction
@@ -147,11 +149,11 @@
* @param _label the label of the command
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_START_TRANSACTION(_label) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_START_TRANSACTION, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_START_TRANSACTION, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
+ }
/**
* Commits a database transaction
@@ -159,11 +161,11 @@
* @param _label the label of the command
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_COMMIT_TRANSACTION(_label) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_COMMIT_TRANSACTION, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_COMMIT_TRANSACTION, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
+ }
/**
* Abort the current transaction
@@ -171,9 +173,9 @@
* @param _label the label of the command
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_ABORT_TRANSACTION(_label) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_ABORT_TRANSACTION, \
- .label = _label,
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_ABORT_TRANSACTION, \
+ .label = _label,
/**
* Saves randomly selected items from @a _label_save
@@ -184,17 +186,18 @@
* @param _label_save the label of the command which outout is saved by this command
* @param _nb_saved the total number of items to be saved
*/
-#define PERF_TALER_EXCHANGEDB_INIT_CMD_SAVE_ARRAY(_label, _label_loop, _label_save, _nb_saved) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
- .details.save_array = { \
- .label_loop = _label_loop, \
- .label_save = _label_save, \
- .nb_saved = _nb_saved, \
- } \
-}
+#define PERF_TALER_EXCHANGEDB_INIT_CMD_SAVE_ARRAY(_label, _label_loop, \
+ _label_save, _nb_saved) \
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
+ .details.save_array = { \
+ .label_loop = _label_loop, \
+ .label_save = _label_save, \
+ .nb_saved = _nb_saved, \
+ } \
+ }
/**
* Loads data from a #PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY to allow other
@@ -204,16 +207,17 @@
* @param _label_loop the label of the loop to iterate over
* @param _label_save the label of the #PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY providing data
*/
-#define PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY(_label, _label_loop, _label_save) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_LOAD_ARRAY, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
- .details.load_array = { \
- .label_loop = _label_loop, \
- .label_save = _label_save \
- } \
-}
+#define PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY(_label, _label_loop, \
+ _label_save) \
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_LOAD_ARRAY, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
+ .details.load_array = { \
+ .label_loop = _label_loop, \
+ .label_save = _label_save \
+ } \
+ }
/**
* Create a denomination key to use
@@ -223,11 +227,11 @@
* @param _label the label of this command
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_DENOMINATION(_label) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_CREATE_DENOMINATION, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_DENOMINATION_INFO, \
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_CREATE_DENOMINATION, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_DENOMINATION_INFO, \
+ }
/**
* Inserts informations about a denomination key in the database
@@ -236,12 +240,12 @@
* @param _label_denom the label of the denomination to insert
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_DENOMINATION(_label, _label_denom) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_INSERT_DENOMINATION, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
- .details.insert_denomination.label_denom = _label_denom, \
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_INSERT_DENOMINATION, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
+ .details.insert_denomination.label_denom = _label_denom, \
+ }
/**
* Polls the database about informations regarding a specific denomination key
@@ -250,12 +254,12 @@
* @param _label_denom the label of the command providing information about the denomination key
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_GET_DENOMINATION(_label, _label_denom) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_GET_DENOMINATION, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
- .details.get_denomination.label_denom = _label_denom \
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_GET_DENOMINATION, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
+ .details.get_denomination.label_denom = _label_denom \
+ }
/**
* Create a reserve to be used later
@@ -264,11 +268,11 @@
* @param _label the label of the command
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_RESERVE(_label) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_CREATE_RESERVE, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_RESERVE \
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_CREATE_RESERVE, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_RESERVE \
+ }
/**
* Insert a new reserve in the database containing 1000 Euros
@@ -277,12 +281,12 @@
* @param _label_reserve the label of the reserve to insert
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_RESERVE(_label, _label_reserve) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_INSERT_RESERVE, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
- .details.insert_reserve.label_reserve = _label_reserve \
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_INSERT_RESERVE, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
+ .details.insert_reserve.label_reserve = _label_reserve \
+ }
/**
* Polls the database for a secific reserve's details
@@ -291,12 +295,12 @@
* @param _label_reserve the reserve to poll
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_GET_RESERVE(_label, _label_reserve) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_GET_RESERVE, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
- .details.get_reserve.label_reserve = _label_reserve \
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_GET_RESERVE, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
+ .details.get_reserve.label_reserve = _label_reserve \
+ }
/**
* Polls the database for the history of a reserve
@@ -304,13 +308,14 @@
* @param _label the label of the command
* @param _label_reserve the reserve to examine
*/
-#define PERF_TALER_EXCHANGEDB_INIT_CMD_GET_RESERVE_HISTORY(_label, _label_reserve) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_GET_RESERVE_HISTORY, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
- .details.get_reserve_history.label_reserve = _label_reserve \
-}
+#define PERF_TALER_EXCHANGEDB_INIT_CMD_GET_RESERVE_HISTORY(_label, \
+ _label_reserve) \
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_GET_RESERVE_HISTORY, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
+ .details.get_reserve_history.label_reserve = _label_reserve \
+ }
/**
* Creates a coin to be used later
@@ -319,16 +324,17 @@
* @param _label_dki denomination key used to sign the coin
* @param _label_reserve reserve used to emmit the coin
*/
-#define PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_WITHDRAW(_label, _label_dki, _label_reserve) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_CREATE_WITHDRAW, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_COIN, \
- .details.create_withdraw = {\
- .label_dki = _label_dki, \
- .label_reserve = _label_reserve, \
- } \
-}
+#define PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_WITHDRAW(_label, _label_dki, \
+ _label_reserve) \
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_CREATE_WITHDRAW, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_COIN, \
+ .details.create_withdraw = { \
+ .label_dki = _label_dki, \
+ .label_reserve = _label_reserve, \
+ } \
+ }
/**
* Inserts information about a withdrawal into the database
@@ -339,12 +345,12 @@
* @param _label_coin the coin to insert
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_WITHDRAW(_label, _label_coin) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_INSERT_WITHDRAW, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
- .details.insert_withdraw.label_coin = _label_coin\
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_INSERT_WITHDRAW, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
+ .details.insert_withdraw.label_coin = _label_coin \
+ }
/**
@@ -354,12 +360,12 @@
* @param _label_coin the coin to check
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_GET_WITHDRAW(_label, _label_coin) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_GET_WITHDRAW, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
- .details.get_withdraw.label_coin = _label_coin, \
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_GET_WITHDRAW, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
+ .details.get_withdraw.label_coin = _label_coin, \
+ }
/**
@@ -371,16 +377,17 @@
* @param _label_dki the denomination of the created coin
* @param _label_reserve the reserve used to provide currency
*/
-#define PERF_TALER_EXCHANGEDB_INIT_CMD_WITHDRAW_SIGN(_label, _label_dki, _label_reserve) \
+#define PERF_TALER_EXCHANGEDB_INIT_CMD_WITHDRAW_SIGN(_label, _label_dki, \
+ _label_reserve) \
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_WITHDRAW (_label "withdraw", \
- _label_dki, \
- _label_reserve), \
- PERF_TALER_EXCHANGEDB_INIT_CMD_GET_DENOMINATION(_label "withdraw info", \
- _label_dki), \
- PERF_TALER_EXCHANGEDB_INIT_CMD_GET_RESERVE_HISTORY(_label "reserve_history", \
- _label_reserve), \
- PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_WITHDRAW(_label "insert withdraw", \
- _label "withdraw")
+ _label_dki, \
+ _label_reserve), \
+ PERF_TALER_EXCHANGEDB_INIT_CMD_GET_DENOMINATION (_label "withdraw info", \
+ _label_dki), \
+ PERF_TALER_EXCHANGEDB_INIT_CMD_GET_RESERVE_HISTORY (_label "reserve_history", \
+ _label_reserve), \
+ PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_WITHDRAW (_label "insert withdraw", \
+ _label "withdraw")
/**
* Create a deposit for use later
@@ -390,12 +397,12 @@
* @param _label_coin the coin used to pay
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_DEPOSIT(_label, _label_coin) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_CREATE_DEPOSIT, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_DEPOSIT, \
- .details.create_deposit.label_coin = _label_coin, \
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_CREATE_DEPOSIT, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_DEPOSIT, \
+ .details.create_deposit.label_coin = _label_coin, \
+ }
/**
* Insert a deposit into the database
@@ -404,12 +411,12 @@
* @param _label_deposit the deposit inseerted
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_DEPOSIT(_label, _label_deposit) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_INSERT_DEPOSIT,\
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
- .details.insert_deposit.label_deposit = _label_deposit, \
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_INSERT_DEPOSIT, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
+ .details.insert_deposit.label_deposit = _label_deposit, \
+ }
/**
* Check if a deposit is in the database
@@ -418,12 +425,12 @@
* @param _label_deposit the deposit to use
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_GET_DEPOSIT(_label, _label_deposit) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_GET_DEPOSIT, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
- .details.get_deposit.label_deposit = _label_deposit \
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_GET_DEPOSIT, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
+ .details.get_deposit.label_deposit = _label_deposit \
+ }
/**
* Access the transaction history of a coin
@@ -432,12 +439,12 @@
* @param _label_coin the coin which history is checked
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_GET_COIN_TRANSACTION(_label, _label_coin) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_GET_COIN_TRANSACTION, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
- .details.get_coin_transaction.label_coin = _label_coin \
-}
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_GET_COIN_TRANSACTION, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
+ .details.get_coin_transaction.label_coin = _label_coin \
+ }
/**
* The /deposit api call
@@ -447,11 +454,11 @@
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_DEPOSIT(_label, _label_coin) \
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_COIN_TRANSACTION (_label "coin history", \
- _label_coin), \
+ _label_coin), \
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_DEPOSIT (_label "deposit", \
- _label_coin), \
+ _label_coin), \
PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_DEPOSIT (_label "insert", \
- _label "deposit")
+ _label "deposit")
/**
* Insert informations about a refresh session
@@ -459,13 +466,14 @@
*
* @param _label the label of the command
*/
-#define PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_REFRESH_SESSION(_label, _label_coin) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_CREATE_REFRESH_SESSION, \
- .label = _label, \
- .details.create_refresh_session.label_coin = _label_coin, \
- .exposed.type = PERF_TALER_EXCHANGEDB_REFRESH_HASH \
-}
+#define PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_REFRESH_SESSION(_label, \
+ _label_coin) \
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_CREATE_REFRESH_SESSION, \
+ .label = _label, \
+ .details.create_refresh_session.label_coin = _label_coin, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_REFRESH_HASH \
+ }
/**
* Get informations about a refresh session
@@ -474,12 +482,12 @@
* @param _label_hash the label of the hash to search
*/
#define PERF_TALER_EXCHANGEDB_INIT_CMD_GET_REFRESH_SESSION(_label, \
- _label_hash) \
-{ \
- .command = PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_SESSION, \
- .label = _label, \
- .exposed.type = PERF_TALER_EXCHANGEDB_NONE \
-}
+ _label_hash) \
+ { \
+ .command = PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_SESSION, \
+ .label = _label, \
+ .exposed.type = PERF_TALER_EXCHANGEDB_NONE \
+ }
/**
@@ -995,9 +1003,9 @@ union PERF_TALER_EXCHANGEDB_CMD_Details
unsigned int index_deposit;
} get_deposit;
- /**
- * Data requiered for the #PERF_TALER_EXCHANGEDB_CMD_CREATE_REFRESH_SESSION command
- */
+ /**
+ * Data requiered for the #PERF_TALER_EXCHANGEDB_CMD_CREATE_REFRESH_SESSION command
+ */
struct PERF_TALER_EXCHANGEDB_CMD_createRefreshSessionDetails
{
/**
@@ -1007,9 +1015,9 @@ union PERF_TALER_EXCHANGEDB_CMD_Details
unsigned int index_coin;
} create_refresh_session;
- /**
- * Data requiered for the #PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_SESSION command
- */
+ /**
+ * Data requiered for the #PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_SESSION command
+ */
struct PERF_TALER_EXCHANGEDB_CMD_getRefreshSessionDetails
{
/**
@@ -1024,17 +1032,17 @@ union PERF_TALER_EXCHANGEDB_CMD_Details
*/
struct PERF_TALER_EXCHANGEDB_CMD_insertRefreshRevealDetails
{
- /**
- * The refresh session hash
- */
- const char *label_hash;
+ /**
+ * The refresh session hash
+ */
+ const char *label_hash;
unsigned int index_hash;
- /**
- * The new coin denomination
- */
- const char *label_denom;
- unsigned int index_denom;
+ /**
+ * The new coin denomination
+ */
+ const char *label_denom;
+ unsigned int index_denom;
} insert_refresh_reveal;
/**
@@ -1119,8 +1127,8 @@ PERF_TALER_EXCHANGEDB_run_benchmark (const char *benchmark_name,
* @param cmd the commands to run
*/
int
-PERF_TALER_EXCHANGEDB_interpret(struct TALER_EXCHANGEDB_Plugin *db_plugin,
- struct PERF_TALER_EXCHANGEDB_Cmd cmd[]);
+PERF_TALER_EXCHANGEDB_interpret (struct TALER_EXCHANGEDB_Plugin *db_plugin,
+ struct PERF_TALER_EXCHANGEDB_Cmd cmd[]);
/**
diff --git a/src/exchangedb/plugin_exchangedb_common.c b/src/exchangedb/plugin_exchangedb_common.c
index 4c381586b..271421795 100644
--- a/src/exchangedb/plugin_exchangedb_common.c
+++ b/src/exchangedb/plugin_exchangedb_common.c
@@ -38,7 +38,7 @@ common_free_reserve_history (void *cls,
while (NULL != rh)
{
- switch(rh->type)
+ switch (rh->type)
{
case TALER_EXCHANGEDB_RO_BANK_TO_EXCHANGE:
bt = rh->details.bank;
@@ -91,32 +91,38 @@ common_free_coin_transaction_list (void *cls,
if (NULL != list->details.deposit->receiver_wire_account)
json_decref (list->details.deposit->receiver_wire_account);
if (NULL != list->details.deposit->coin.denom_sig.rsa_signature)
- GNUNET_CRYPTO_rsa_signature_free (list->details.deposit->coin.denom_sig.rsa_signature);
+ GNUNET_CRYPTO_rsa_signature_free (
+ list->details.deposit->coin.denom_sig.rsa_signature);
GNUNET_free (list->details.deposit);
break;
case TALER_EXCHANGEDB_TT_REFRESH_MELT:
if (NULL != list->details.melt->session.coin.denom_sig.rsa_signature)
- GNUNET_CRYPTO_rsa_signature_free (list->details.melt->session.coin.denom_sig.rsa_signature);
+ GNUNET_CRYPTO_rsa_signature_free (
+ list->details.melt->session.coin.denom_sig.rsa_signature);
GNUNET_free (list->details.melt);
break;
case TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK:
if (NULL != list->details.payback_refresh->coin.denom_sig.rsa_signature)
- GNUNET_CRYPTO_rsa_signature_free (list->details.payback_refresh->coin.denom_sig.rsa_signature);
+ GNUNET_CRYPTO_rsa_signature_free (
+ list->details.payback_refresh->coin.denom_sig.rsa_signature);
GNUNET_free (list->details.old_coin_payback);
break;
case TALER_EXCHANGEDB_TT_REFUND:
if (NULL != list->details.refund->coin.denom_sig.rsa_signature)
- GNUNET_CRYPTO_rsa_signature_free (list->details.refund->coin.denom_sig.rsa_signature);
+ GNUNET_CRYPTO_rsa_signature_free (
+ list->details.refund->coin.denom_sig.rsa_signature);
GNUNET_free (list->details.refund);
break;
case TALER_EXCHANGEDB_TT_PAYBACK:
if (NULL != list->details.payback->coin.denom_sig.rsa_signature)
- GNUNET_CRYPTO_rsa_signature_free (list->details.payback->coin.denom_sig.rsa_signature);
+ GNUNET_CRYPTO_rsa_signature_free (
+ list->details.payback->coin.denom_sig.rsa_signature);
GNUNET_free (list->details.payback);
break;
case TALER_EXCHANGEDB_TT_PAYBACK_REFRESH:
if (NULL != list->details.payback_refresh->coin.denom_sig.rsa_signature)
- GNUNET_CRYPTO_rsa_signature_free (list->details.payback_refresh->coin.denom_sig.rsa_signature);
+ GNUNET_CRYPTO_rsa_signature_free (
+ list->details.payback_refresh->coin.denom_sig.rsa_signature);
GNUNET_free (list->details.payback_refresh);
break;
}
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 2d4e0889f..75d124ce1 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -45,7 +45,8 @@
* @param field name of the database field to fetch amount from
* @param amountp[out] pointer to amount to set
*/
-#define TALER_PQ_RESULT_SPEC_AMOUNT(field,amountp) TALER_PQ_result_spec_amount(field,pg->currency,amountp)
+#define TALER_PQ_RESULT_SPEC_AMOUNT(field,amountp) TALER_PQ_result_spec_amount ( \
+ field,pg->currency,amountp)
/**
* Wrapper macro to add the currency from the plugin's state
@@ -54,7 +55,9 @@
* @param field name of the database field to fetch amount from
* @param amountp[out] pointer to amount to set
*/
-#define TALER_PQ_RESULT_SPEC_AMOUNT_NBO(field,amountp) TALER_PQ_result_spec_amount_nbo(field,pg->currency,amountp)
+#define TALER_PQ_RESULT_SPEC_AMOUNT_NBO(field, \
+ amountp) TALER_PQ_result_spec_amount_nbo ( \
+ field,pg->currency,amountp)
/**
* Log a really unexpected PQ error with all the details we can get hold of.
@@ -71,7 +74,7 @@
PQresultErrorMessage (result), \
PQresStatus (PQresultStatus (result)), \
PQerrorMessage (conn)); \
- } while (0)
+} while (0)
/**
@@ -88,7 +91,7 @@ struct TALER_EXCHANGEDB_Session
* Name of the current transaction, for debugging.
*/
const char *transaction_name;
-
+
};
@@ -143,20 +146,25 @@ postgres_drop_tables (void *cls)
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS prewire CASCADE;"),
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS payback CASCADE;"),
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS payback_refresh CASCADE;"),
- GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS aggregation_tracking CASCADE;"),
+ GNUNET_PQ_make_execute (
+ "DROP TABLE IF EXISTS aggregation_tracking CASCADE;"),
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS wire_out CASCADE;"),
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS wire_fee CASCADE;"),
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS deposits CASCADE;"),
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS refunds CASCADE;"),
- GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS refresh_commitments CASCADE;"),
- GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS refresh_revealed_coins CASCADE;"),
- GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS refresh_transfer_keys CASCADE;"),
+ GNUNET_PQ_make_execute (
+ "DROP TABLE IF EXISTS refresh_commitments CASCADE;"),
+ GNUNET_PQ_make_execute (
+ "DROP TABLE IF EXISTS refresh_revealed_coins CASCADE;"),
+ GNUNET_PQ_make_execute (
+ "DROP TABLE IF EXISTS refresh_transfer_keys CASCADE;"),
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS known_coins CASCADE;"),
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS reserves_close CASCADE;"),
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS reserves_out CASCADE;"),
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS reserves_in CASCADE;"),
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS reserves CASCADE;"),
- GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS denomination_revocations CASCADE;"),
+ GNUNET_PQ_make_execute (
+ "DROP TABLE IF EXISTS denomination_revocations CASCADE;"),
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS denominations CASCADE;"),
GNUNET_PQ_EXECUTE_STATEMENT_END
};
@@ -211,15 +219,17 @@ postgres_create_tables (void *cls)
",fee_refund_frac INT4 NOT NULL"
")"),
/* index for gc_denominations */
- GNUNET_PQ_make_try_execute ("CREATE INDEX denominations_expire_legal_index ON "
- "denominations (expire_legal);"),
+ GNUNET_PQ_make_try_execute (
+ "CREATE INDEX denominations_expire_legal_index ON "
+ "denominations (expire_legal);"),
/* denomination_revocations table is for remembering which denomination keys have been revoked */
- GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS denomination_revocations"
- "(denom_revocations_serial_id BIGSERIAL UNIQUE"
- ",denom_pub_hash BYTEA PRIMARY KEY REFERENCES denominations (denom_pub_hash) ON DELETE CASCADE"
- ",master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)"
- ");"),
+ GNUNET_PQ_make_execute (
+ "CREATE TABLE IF NOT EXISTS denomination_revocations"
+ "(denom_revocations_serial_id BIGSERIAL UNIQUE"
+ ",denom_pub_hash BYTEA PRIMARY KEY REFERENCES denominations (denom_pub_hash) ON DELETE CASCADE"
+ ",master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)"
+ ");"),
/* reserves table is for summarization of a reserve. It is updated when new
funds are added and existing funds are withdrawn. The 'expiration_date'
can be used to eventually get rid of reserves that have not been used
@@ -245,17 +255,17 @@ postgres_create_tables (void *cls)
/* reserves_in table collects the transactions which transfer funds
into the reserve. The rows of this table correspond to each
incoming transaction. */
- GNUNET_PQ_make_execute("CREATE TABLE IF NOT EXISTS reserves_in"
- "(reserve_in_serial_id BIGSERIAL UNIQUE"
- ",reserve_pub BYTEA NOT NULL REFERENCES reserves (reserve_pub) ON DELETE CASCADE"
- ",wire_reference BYTEA NOT NULL"
- ",credit_val INT8 NOT NULL"
- ",credit_frac INT4 NOT NULL"
- ",sender_account_details TEXT NOT NULL"
- ",exchange_account_section TEXT NOT NULL"
- ",execution_date INT8 NOT NULL"
- ",PRIMARY KEY (reserve_pub, wire_reference)"
- ");"),
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS reserves_in"
+ "(reserve_in_serial_id BIGSERIAL UNIQUE"
+ ",reserve_pub BYTEA NOT NULL REFERENCES reserves (reserve_pub) ON DELETE CASCADE"
+ ",wire_reference BYTEA NOT NULL"
+ ",credit_val INT8 NOT NULL"
+ ",credit_frac INT4 NOT NULL"
+ ",sender_account_details TEXT NOT NULL"
+ ",exchange_account_section TEXT NOT NULL"
+ ",execution_date INT8 NOT NULL"
+ ",PRIMARY KEY (reserve_pub, wire_reference)"
+ ");"),
/* Create indices on reserves_in */
GNUNET_PQ_make_try_execute ("CREATE INDEX reserves_in_execution_index"
" ON reserves_in (exchange_account_section,execution_date);"),
@@ -263,24 +273,25 @@ postgres_create_tables (void *cls)
reserve_pub as the first dimension! */
GNUNET_PQ_make_try_execute ("CREATE INDEX reserves_in_reserve_pub"
" ON reserves_in (reserve_pub);"),
- GNUNET_PQ_make_try_execute ("CREATE INDEX reserves_in_exchange_account_serial"
- " ON reserves_in (exchange_account_section,reserve_in_serial_id DESC);"),
+ GNUNET_PQ_make_try_execute (
+ "CREATE INDEX reserves_in_exchange_account_serial"
+ " ON reserves_in (exchange_account_section,reserve_in_serial_id DESC);"),
/* This table contains the data for wire transfers the exchange has
executed to close a reserve. */
- GNUNET_PQ_make_execute("CREATE TABLE IF NOT EXISTS reserves_close "
- "(close_uuid BIGSERIAL PRIMARY KEY"
- ",reserve_pub BYTEA NOT NULL REFERENCES reserves (reserve_pub) ON DELETE CASCADE"
- ",execution_date INT8 NOT NULL"
- ",wtid BYTEA NOT NULL CHECK (LENGTH(wtid)=32)"
- ",receiver_account TEXT NOT NULL"
- ",amount_val INT8 NOT NULL"
- ",amount_frac INT4 NOT NULL"
- ",closing_fee_val INT8 NOT NULL"
- ",closing_fee_frac INT4 NOT NULL"
- ");"),
- GNUNET_PQ_make_try_execute("CREATE INDEX reserves_close_by_reserve "
- "ON reserves_close(reserve_pub)"),
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS reserves_close "
+ "(close_uuid BIGSERIAL PRIMARY KEY"
+ ",reserve_pub BYTEA NOT NULL REFERENCES reserves (reserve_pub) ON DELETE CASCADE"
+ ",execution_date INT8 NOT NULL"
+ ",wtid BYTEA NOT NULL CHECK (LENGTH(wtid)=32)"
+ ",receiver_account TEXT NOT NULL"
+ ",amount_val INT8 NOT NULL"
+ ",amount_frac INT4 NOT NULL"
+ ",closing_fee_val INT8 NOT NULL"
+ ",closing_fee_frac INT4 NOT NULL"
+ ");"),
+ GNUNET_PQ_make_try_execute ("CREATE INDEX reserves_close_by_reserve "
+ "ON reserves_close(reserve_pub)"),
/* Table with the withdraw operations that have been performed on a reserve.
The 'h_blind_ev' is the hash of the blinded coin. It serves as a primary
key, as (broken) clients that use a non-random coin and blinding factor
@@ -302,30 +313,32 @@ postgres_create_tables (void *cls)
" reserves_out (reserve_pub)"),
GNUNET_PQ_make_try_execute ("CREATE INDEX reserves_out_execution_date ON "
"reserves_out (execution_date)"),
- GNUNET_PQ_make_try_execute ("CREATE INDEX reserves_out_for_get_withdraw_info ON "
- "reserves_out (denom_pub_hash,h_blind_ev)"),
+ GNUNET_PQ_make_try_execute (
+ "CREATE INDEX reserves_out_for_get_withdraw_info ON "
+ "reserves_out (denom_pub_hash,h_blind_ev)"),
/* Table with coins that have been (partially) spent, used to track
coin information only once. */
- GNUNET_PQ_make_execute("CREATE TABLE IF NOT EXISTS known_coins "
- "(coin_pub BYTEA NOT NULL PRIMARY KEY CHECK (LENGTH(coin_pub)=32)"
- ",denom_pub_hash BYTEA NOT NULL REFERENCES denominations (denom_pub_hash) ON DELETE CASCADE"
- ",denom_sig BYTEA NOT NULL"
- ");"),
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS known_coins "
+ "(coin_pub BYTEA NOT NULL PRIMARY KEY CHECK (LENGTH(coin_pub)=32)"
+ ",denom_pub_hash BYTEA NOT NULL REFERENCES denominations (denom_pub_hash) ON DELETE CASCADE"
+ ",denom_sig BYTEA NOT NULL"
+ ");"),
GNUNET_PQ_make_try_execute ("CREATE INDEX known_coins_by_denomination ON "
"known_coins (denom_pub_hash)"),
/* Table with the commitments made when melting a coin. */
- GNUNET_PQ_make_execute("CREATE TABLE IF NOT EXISTS refresh_commitments "
- "(melt_serial_id BIGSERIAL UNIQUE"
- ",rc BYTEA PRIMARY KEY CHECK (LENGTH(rc)=64)"
- ",old_coin_pub BYTEA NOT NULL REFERENCES known_coins (coin_pub) ON DELETE CASCADE"
- ",old_coin_sig BYTEA NOT NULL CHECK(LENGTH(old_coin_sig)=64)"
- ",amount_with_fee_val INT8 NOT NULL"
- ",amount_with_fee_frac INT4 NOT NULL"
- ",noreveal_index INT4 NOT NULL"
- ");"),
- GNUNET_PQ_make_try_execute ("CREATE INDEX refresh_commitments_old_coin_pub_index ON "
- "refresh_commitments (old_coin_pub);"),
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS refresh_commitments "
+ "(melt_serial_id BIGSERIAL UNIQUE"
+ ",rc BYTEA PRIMARY KEY CHECK (LENGTH(rc)=64)"
+ ",old_coin_pub BYTEA NOT NULL REFERENCES known_coins (coin_pub) ON DELETE CASCADE"
+ ",old_coin_sig BYTEA NOT NULL CHECK(LENGTH(old_coin_sig)=64)"
+ ",amount_with_fee_val INT8 NOT NULL"
+ ",amount_with_fee_frac INT4 NOT NULL"
+ ",noreveal_index INT4 NOT NULL"
+ ");"),
+ GNUNET_PQ_make_try_execute (
+ "CREATE INDEX refresh_commitments_old_coin_pub_index ON "
+ "refresh_commitments (old_coin_pub);"),
/* Table with the revelations about the new coins that are to be created
during a melting session. Includes the session, the cut-and-choose
@@ -333,172 +346,176 @@ postgres_create_tables (void *cls)
coin to be signed, as well as the encrypted information about the
private key and the blinding factor for the coin (for verification
in case this newcoin_index is chosen to be revealed) */
- GNUNET_PQ_make_execute("CREATE TABLE IF NOT EXISTS refresh_revealed_coins "
- "(rc BYTEA NOT NULL REFERENCES refresh_commitments (rc) ON DELETE CASCADE"
- ",newcoin_index INT4 NOT NULL"
- ",link_sig BYTEA NOT NULL CHECK(LENGTH(link_sig)=64)"
- ",denom_pub_hash BYTEA NOT NULL REFERENCES denominations (denom_pub_hash) ON DELETE CASCADE"
- ",coin_ev BYTEA UNIQUE NOT NULL"
- ",h_coin_ev BYTEA NOT NULL CHECK(LENGTH(h_coin_ev)=64)"
- ",ev_sig BYTEA NOT NULL"
- ",PRIMARY KEY (rc, newcoin_index)"
- ",UNIQUE (h_coin_ev)"
- ");"),
- GNUNET_PQ_make_try_execute ("CREATE INDEX refresh_revealed_coins_coin_pub_index ON "
- "refresh_revealed_coins (denom_pub_hash);"),
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS refresh_revealed_coins "
+ "(rc BYTEA NOT NULL REFERENCES refresh_commitments (rc) ON DELETE CASCADE"
+ ",newcoin_index INT4 NOT NULL"
+ ",link_sig BYTEA NOT NULL CHECK(LENGTH(link_sig)=64)"
+ ",denom_pub_hash BYTEA NOT NULL REFERENCES denominations (denom_pub_hash) ON DELETE CASCADE"
+ ",coin_ev BYTEA UNIQUE NOT NULL"
+ ",h_coin_ev BYTEA NOT NULL CHECK(LENGTH(h_coin_ev)=64)"
+ ",ev_sig BYTEA NOT NULL"
+ ",PRIMARY KEY (rc, newcoin_index)"
+ ",UNIQUE (h_coin_ev)"
+ ");"),
+ GNUNET_PQ_make_try_execute (
+ "CREATE INDEX refresh_revealed_coins_coin_pub_index ON "
+ "refresh_revealed_coins (denom_pub_hash);"),
/* Table with the transfer keys of a refresh operation; includes
the rc for which this is the link information, the
transfer public key (for gamma) and the revealed transfer private
keys (array of TALER_CNC_KAPPA - 1 entries, with gamma being skipped) */
- GNUNET_PQ_make_execute("CREATE TABLE IF NOT EXISTS refresh_transfer_keys "
- "(rc BYTEA NOT NULL PRIMARY KEY REFERENCES refresh_commitments (rc) ON DELETE CASCADE"
- ",transfer_pub BYTEA NOT NULL CHECK(LENGTH(transfer_pub)=32)"
- ",transfer_privs BYTEA NOT NULL"
- ");"),
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS refresh_transfer_keys "
+ "(rc BYTEA NOT NULL PRIMARY KEY REFERENCES refresh_commitments (rc) ON DELETE CASCADE"
+ ",transfer_pub BYTEA NOT NULL CHECK(LENGTH(transfer_pub)=32)"
+ ",transfer_privs BYTEA NOT NULL"
+ ");"),
/* for "get_link" (not sure if this helps, as there should be very few
transfer_pubs per rc, but at least in theory this helps the ORDER BY
clause. */
- GNUNET_PQ_make_try_execute ("CREATE INDEX refresh_transfer_keys_coin_tpub ON "
- "refresh_transfer_keys (rc,transfer_pub);"),
+ GNUNET_PQ_make_try_execute (
+ "CREATE INDEX refresh_transfer_keys_coin_tpub ON "
+ "refresh_transfer_keys (rc,transfer_pub);"),
/* This table contains the wire transfers the exchange is supposed to
execute to transmit funds to the merchants (and manage refunds). */
- GNUNET_PQ_make_execute("CREATE TABLE IF NOT EXISTS deposits "
- "(deposit_serial_id BIGSERIAL PRIMARY KEY"
- ",coin_pub BYTEA NOT NULL REFERENCES known_coins (coin_pub) ON DELETE CASCADE"
- ",amount_with_fee_val INT8 NOT NULL"
- ",amount_with_fee_frac INT4 NOT NULL"
- ",timestamp INT8 NOT NULL"
- ",refund_deadline INT8 NOT NULL"
- ",wire_deadline INT8 NOT NULL"
- ",merchant_pub BYTEA NOT NULL CHECK (LENGTH(merchant_pub)=32)"
- ",h_contract_terms BYTEA NOT NULL CHECK (LENGTH(h_contract_terms)=64)"
- ",h_wire BYTEA NOT NULL CHECK (LENGTH(h_wire)=64)"
- ",coin_sig BYTEA NOT NULL CHECK (LENGTH(coin_sig)=64)"
- ",wire TEXT NOT NULL"
- ",tiny BOOLEAN NOT NULL DEFAULT FALSE"
- ",done BOOLEAN NOT NULL DEFAULT FALSE"
- ",UNIQUE (coin_pub, merchant_pub, h_contract_terms)"
- ");"),
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS deposits "
+ "(deposit_serial_id BIGSERIAL PRIMARY KEY"
+ ",coin_pub BYTEA NOT NULL REFERENCES known_coins (coin_pub) ON DELETE CASCADE"
+ ",amount_with_fee_val INT8 NOT NULL"
+ ",amount_with_fee_frac INT4 NOT NULL"
+ ",timestamp INT8 NOT NULL"
+ ",refund_deadline INT8 NOT NULL"
+ ",wire_deadline INT8 NOT NULL"
+ ",merchant_pub BYTEA NOT NULL CHECK (LENGTH(merchant_pub)=32)"
+ ",h_contract_terms BYTEA NOT NULL CHECK (LENGTH(h_contract_terms)=64)"
+ ",h_wire BYTEA NOT NULL CHECK (LENGTH(h_wire)=64)"
+ ",coin_sig BYTEA NOT NULL CHECK (LENGTH(coin_sig)=64)"
+ ",wire TEXT NOT NULL"
+ ",tiny BOOLEAN NOT NULL DEFAULT FALSE"
+ ",done BOOLEAN NOT NULL DEFAULT FALSE"
+ ",UNIQUE (coin_pub, merchant_pub, h_contract_terms)"
+ ");"),
/* Index for get_deposit_for_wtid and get_deposit_statement */
- GNUNET_PQ_make_try_execute("CREATE INDEX deposits_coin_pub_merchant_contract_index "
- "ON deposits(coin_pub, merchant_pub, h_contract_terms)"),
+ GNUNET_PQ_make_try_execute (
+ "CREATE INDEX deposits_coin_pub_merchant_contract_index "
+ "ON deposits(coin_pub, merchant_pub, h_contract_terms)"),
/* Index for deposits_get_ready */
- GNUNET_PQ_make_try_execute("CREATE INDEX deposits_get_ready_index "
- "ON deposits(tiny,done,wire_deadline,refund_deadline)"),
+ GNUNET_PQ_make_try_execute ("CREATE INDEX deposits_get_ready_index "
+ "ON deposits(tiny,done,wire_deadline,refund_deadline)"),
/* Index for deposits_iterate_matching */
- GNUNET_PQ_make_try_execute("CREATE INDEX deposits_iterate_matching "
- "ON deposits(merchant_pub,h_wire,done,wire_deadline)"),
+ GNUNET_PQ_make_try_execute ("CREATE INDEX deposits_iterate_matching "
+ "ON deposits(merchant_pub,h_wire,done,wire_deadline)"),
/* Table with information about coins that have been refunded. (Technically
one of the deposit operations that a coin was involved with is refunded.)*/
- GNUNET_PQ_make_execute("CREATE TABLE IF NOT EXISTS refunds "
- "(refund_serial_id BIGSERIAL UNIQUE"
- ",coin_pub BYTEA NOT NULL REFERENCES known_coins (coin_pub) ON DELETE CASCADE"
- ",merchant_pub BYTEA NOT NULL CHECK(LENGTH(merchant_pub)=32)"
- ",merchant_sig BYTEA NOT NULL CHECK(LENGTH(merchant_sig)=64)"
- ",h_contract_terms BYTEA NOT NULL CHECK(LENGTH(h_contract_terms)=64)"
- ",rtransaction_id INT8 NOT NULL"
- ",amount_with_fee_val INT8 NOT NULL"
- ",amount_with_fee_frac INT4 NOT NULL"
- ",PRIMARY KEY (coin_pub, merchant_pub, h_contract_terms, rtransaction_id)" /* this combo must be unique, and we usually select by coin_pub */
- ");"),
- GNUNET_PQ_make_try_execute("CREATE INDEX refunds_coin_pub_index "
- "ON refunds(coin_pub)"),
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS refunds "
+ "(refund_serial_id BIGSERIAL UNIQUE"
+ ",coin_pub BYTEA NOT NULL REFERENCES known_coins (coin_pub) ON DELETE CASCADE"
+ ",merchant_pub BYTEA NOT NULL CHECK(LENGTH(merchant_pub)=32)"
+ ",merchant_sig BYTEA NOT NULL CHECK(LENGTH(merchant_sig)=64)"
+ ",h_contract_terms BYTEA NOT NULL CHECK(LENGTH(h_contract_terms)=64)"
+ ",rtransaction_id INT8 NOT NULL"
+ ",amount_with_fee_val INT8 NOT NULL"
+ ",amount_with_fee_frac INT4 NOT NULL"
+ ",PRIMARY KEY (coin_pub, merchant_pub, h_contract_terms, rtransaction_id)" /* this combo must be unique, and we usually select by coin_pub */
+ ");"),
+ GNUNET_PQ_make_try_execute ("CREATE INDEX refunds_coin_pub_index "
+ "ON refunds(coin_pub)"),
/* This table contains the data for
wire transfers the exchange has executed. */
- GNUNET_PQ_make_execute("CREATE TABLE IF NOT EXISTS wire_out "
- "(wireout_uuid BIGSERIAL PRIMARY KEY"
- ",execution_date INT8 NOT NULL"
- ",wtid_raw BYTEA UNIQUE NOT NULL CHECK (LENGTH(wtid_raw)=" TALER_WIRE_TRANSFER_IDENTIFIER_LEN_STR ")"
- ",wire_target TEXT NOT NULL"
- ",exchange_account_section TEXT NOT NULL"
- ",amount_val INT8 NOT NULL"
- ",amount_frac INT4 NOT NULL"
- ");"),
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS wire_out "
+ "(wireout_uuid BIGSERIAL PRIMARY KEY"
+ ",execution_date INT8 NOT NULL"
+ ",wtid_raw BYTEA UNIQUE NOT NULL CHECK (LENGTH(wtid_raw)="
+ TALER_WIRE_TRANSFER_IDENTIFIER_LEN_STR ")"
+ ",wire_target TEXT NOT NULL"
+ ",exchange_account_section TEXT NOT NULL"
+ ",amount_val INT8 NOT NULL"
+ ",amount_frac INT4 NOT NULL"
+ ");"),
/* Table for the tracking API, mapping from wire transfer identifiers
to transactions and back */
- GNUNET_PQ_make_execute("CREATE TABLE IF NOT EXISTS aggregation_tracking "
- "(aggregation_serial_id BIGSERIAL UNIQUE"
- ",deposit_serial_id INT8 PRIMARY KEY REFERENCES deposits (deposit_serial_id) ON DELETE CASCADE"
- ",wtid_raw BYTEA CONSTRAINT wire_out_ref REFERENCES wire_out(wtid_raw) ON DELETE CASCADE DEFERRABLE"
- ");"),
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS aggregation_tracking "
+ "(aggregation_serial_id BIGSERIAL UNIQUE"
+ ",deposit_serial_id INT8 PRIMARY KEY REFERENCES deposits (deposit_serial_id) ON DELETE CASCADE"
+ ",wtid_raw BYTEA CONSTRAINT wire_out_ref REFERENCES wire_out(wtid_raw) ON DELETE CASCADE DEFERRABLE"
+ ");"),
/* Index for lookup_transactions statement on wtid */
- GNUNET_PQ_make_try_execute("CREATE INDEX aggregation_tracking_wtid_index "
- "ON aggregation_tracking(wtid_raw)"),
+ GNUNET_PQ_make_try_execute ("CREATE INDEX aggregation_tracking_wtid_index "
+ "ON aggregation_tracking(wtid_raw)"),
/* Table for the wire fees. */
- GNUNET_PQ_make_execute("CREATE TABLE IF NOT EXISTS wire_fee "
- "(wire_method VARCHAR NOT NULL"
- ",start_date INT8 NOT NULL"
- ",end_date INT8 NOT NULL"
- ",wire_fee_val INT8 NOT NULL"
- ",wire_fee_frac INT4 NOT NULL"
- ",closing_fee_val INT8 NOT NULL"
- ",closing_fee_frac INT4 NOT NULL"
- ",master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)"
- ",PRIMARY KEY (wire_method, start_date)" /* this combo must be unique */
- ");"),
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS wire_fee "
+ "(wire_method VARCHAR NOT NULL"
+ ",start_date INT8 NOT NULL"
+ ",end_date INT8 NOT NULL"
+ ",wire_fee_val INT8 NOT NULL"
+ ",wire_fee_frac INT4 NOT NULL"
+ ",closing_fee_val INT8 NOT NULL"
+ ",closing_fee_frac INT4 NOT NULL"
+ ",master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)"
+ ",PRIMARY KEY (wire_method, start_date)" /* this combo must be unique */
+ ");"),
/* Index for lookup_transactions statement on wtid */
- GNUNET_PQ_make_try_execute("CREATE INDEX aggregation_tracking_wtid_index "
- "ON aggregation_tracking(wtid_raw);"),
+ GNUNET_PQ_make_try_execute ("CREATE INDEX aggregation_tracking_wtid_index "
+ "ON aggregation_tracking(wtid_raw);"),
/* Index for gc_wire_fee */
- GNUNET_PQ_make_try_execute("CREATE INDEX wire_fee_gc_index "
- "ON wire_fee(end_date);"),
+ GNUNET_PQ_make_try_execute ("CREATE INDEX wire_fee_gc_index "
+ "ON wire_fee(end_date);"),
/* Table for /payback information */
- GNUNET_PQ_make_execute("CREATE TABLE IF NOT EXISTS payback "
- "(payback_uuid BIGSERIAL UNIQUE"
- ",coin_pub BYTEA NOT NULL REFERENCES known_coins (coin_pub)" /* do NOT CASCADE on delete, we may keep the coin alive! */
- ",coin_sig BYTEA NOT NULL CHECK(LENGTH(coin_sig)=64)"
- ",coin_blind BYTEA NOT NULL CHECK(LENGTH(coin_blind)=32)"
- ",amount_val INT8 NOT NULL"
- ",amount_frac INT4 NOT NULL"
- ",timestamp INT8 NOT NULL"
- ",h_blind_ev BYTEA NOT NULL REFERENCES reserves_out (h_blind_ev) ON DELETE CASCADE"
- ");"),
- GNUNET_PQ_make_try_execute("CREATE INDEX payback_by_coin_index "
- "ON payback(coin_pub);"),
- GNUNET_PQ_make_try_execute("CREATE INDEX payback_by_h_blind_ev "
- "ON payback(h_blind_ev);"),
- GNUNET_PQ_make_try_execute("CREATE INDEX payback_by_reserve_index "
- "ON payback(reserve_pub);"),
- GNUNET_PQ_make_try_execute("CREATE INDEX payback_for_by_reserve "
- "ON payback(coin_pub,denom_pub_hash,h_blind_ev);"),
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS payback "
+ "(payback_uuid BIGSERIAL UNIQUE"
+ ",coin_pub BYTEA NOT NULL REFERENCES known_coins (coin_pub)" /* do NOT CASCADE on delete, we may keep the coin alive! */
+ ",coin_sig BYTEA NOT NULL CHECK(LENGTH(coin_sig)=64)"
+ ",coin_blind BYTEA NOT NULL CHECK(LENGTH(coin_blind)=32)"
+ ",amount_val INT8 NOT NULL"
+ ",amount_frac INT4 NOT NULL"
+ ",timestamp INT8 NOT NULL"
+ ",h_blind_ev BYTEA NOT NULL REFERENCES reserves_out (h_blind_ev) ON DELETE CASCADE"
+ ");"),
+ GNUNET_PQ_make_try_execute ("CREATE INDEX payback_by_coin_index "
+ "ON payback(coin_pub);"),
+ GNUNET_PQ_make_try_execute ("CREATE INDEX payback_by_h_blind_ev "
+ "ON payback(h_blind_ev);"),
+ GNUNET_PQ_make_try_execute ("CREATE INDEX payback_by_reserve_index "
+ "ON payback(reserve_pub);"),
+ GNUNET_PQ_make_try_execute ("CREATE INDEX payback_for_by_reserve "
+ "ON payback(coin_pub,denom_pub_hash,h_blind_ev);"),
/* Table for /payback-refresh information */
- GNUNET_PQ_make_execute("CREATE TABLE IF NOT EXISTS payback_refresh "
- "(payback_refresh_uuid BIGSERIAL UNIQUE"
- ",coin_pub BYTEA NOT NULL REFERENCES known_coins (coin_pub)" /* do NOT CASCADE on delete, we may keep the coin alive! */
- ",coin_sig BYTEA NOT NULL CHECK(LENGTH(coin_sig)=64)"
- ",coin_blind BYTEA NOT NULL CHECK(LENGTH(coin_blind)=32)"
- ",amount_val INT8 NOT NULL"
- ",amount_frac INT4 NOT NULL"
- ",timestamp INT8 NOT NULL"
- ",h_blind_ev BYTEA NOT NULL REFERENCES refresh_revealed_coins (h_coin_ev) ON DELETE CASCADE"
- ");"),
- GNUNET_PQ_make_try_execute("CREATE INDEX payback_refresh_by_coin_index "
- "ON payback_refresh(coin_pub);"),
- GNUNET_PQ_make_try_execute("CREATE INDEX payback_refresh_by_h_blind_ev "
- "ON payback_refresh(h_blind_ev);"),
- GNUNET_PQ_make_try_execute("CREATE INDEX payback_refresh_by_reserve_index "
- "ON payback_refresh(reserve_pub);"),
- GNUNET_PQ_make_try_execute("CREATE INDEX payback_refresh_for_by_reserve "
- "ON payback_refresh(coin_pub,denom_pub_hash,h_blind_ev);"),
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS payback_refresh "
+ "(payback_refresh_uuid BIGSERIAL UNIQUE"
+ ",coin_pub BYTEA NOT NULL REFERENCES known_coins (coin_pub)" /* do NOT CASCADE on delete, we may keep the coin alive! */
+ ",coin_sig BYTEA NOT NULL CHECK(LENGTH(coin_sig)=64)"
+ ",coin_blind BYTEA NOT NULL CHECK(LENGTH(coin_blind)=32)"
+ ",amount_val INT8 NOT NULL"
+ ",amount_frac INT4 NOT NULL"
+ ",timestamp INT8 NOT NULL"
+ ",h_blind_ev BYTEA NOT NULL REFERENCES refresh_revealed_coins (h_coin_ev) ON DELETE CASCADE"
+ ");"),
+ GNUNET_PQ_make_try_execute ("CREATE INDEX payback_refresh_by_coin_index "
+ "ON payback_refresh(coin_pub);"),
+ GNUNET_PQ_make_try_execute ("CREATE INDEX payback_refresh_by_h_blind_ev "
+ "ON payback_refresh(h_blind_ev);"),
+ GNUNET_PQ_make_try_execute ("CREATE INDEX payback_refresh_by_reserve_index "
+ "ON payback_refresh(reserve_pub);"),
+ GNUNET_PQ_make_try_execute ("CREATE INDEX payback_refresh_for_by_reserve "
+ "ON payback_refresh(coin_pub,denom_pub_hash,h_blind_ev);"),
/* This table contains the pre-commit data for
wire transfers the exchange is about to execute. */
- GNUNET_PQ_make_execute("CREATE TABLE IF NOT EXISTS prewire "
- "(prewire_uuid BIGSERIAL PRIMARY KEY"
- ",type TEXT NOT NULL"
- ",finished BOOLEAN NOT NULL DEFAULT false"
- ",buf BYTEA NOT NULL"
- ");"),
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS prewire "
+ "(prewire_uuid BIGSERIAL PRIMARY KEY"
+ ",type TEXT NOT NULL"
+ ",finished BOOLEAN NOT NULL DEFAULT false"
+ ",buf BYTEA NOT NULL"
+ ");"),
/* Index for wire_prepare_data_get and gc_prewire statement */
- GNUNET_PQ_make_try_execute("CREATE INDEX prepare_iteration_index "
- "ON prewire(finished);"),
+ GNUNET_PQ_make_try_execute ("CREATE INDEX prepare_iteration_index "
+ "ON prewire(finished);"),
GNUNET_PQ_EXECUTE_STATEMENT_END
};
PGconn *conn;
@@ -700,19 +717,20 @@ postgres_prepare (PGconn *db_conn)
1),
/* Used in postgres_select_reserves_in_above_serial_id() to obtain inbound
transactions for reserves with serial id '\geq' the given parameter */
- GNUNET_PQ_make_prepare ("audit_reserves_in_get_transactions_incr_by_account",
- "SELECT"
- " reserve_pub"
- ",wire_reference"
- ",credit_val"
- ",credit_frac"
- ",execution_date"
- ",sender_account_details"
- ",reserve_in_serial_id"
- " FROM reserves_in"
- " WHERE reserve_in_serial_id>=$1 AND exchange_account_section=$2"
- " ORDER BY reserve_in_serial_id;",
- 2),
+ GNUNET_PQ_make_prepare (
+ "audit_reserves_in_get_transactions_incr_by_account",
+ "SELECT"
+ " reserve_pub"
+ ",wire_reference"
+ ",credit_val"
+ ",credit_frac"
+ ",execution_date"
+ ",sender_account_details"
+ ",reserve_in_serial_id"
+ " FROM reserves_in"
+ " WHERE reserve_in_serial_id>=$1 AND exchange_account_section=$2"
+ " ORDER BY reserve_in_serial_id;",
+ 2),
/* Used in #postgres_get_reserve_history() to obtain inbound transactions
for a reserve */
GNUNET_PQ_make_prepare ("reserves_in_get_transactions",
@@ -1148,7 +1166,8 @@ postgres_prepare (PGconn *db_conn)
" h_wire=$2 AND"
" done=FALSE"
" ORDER BY wire_deadline ASC"
- " LIMIT " TALER_EXCHANGEDB_MATCHING_DEPOSITS_LIMIT_STR ";",
+ " LIMIT "
+ TALER_EXCHANGEDB_MATCHING_DEPOSITS_LIMIT_STR ";",
2),
/* Used in #postgres_mark_deposit_tiny() */
GNUNET_PQ_make_prepare ("mark_deposit_tiny",
@@ -1359,7 +1378,7 @@ postgres_prepare (PGconn *db_conn)
" FROM aggregation_tracking"
" WHERE (aggregation_tracking.deposit_serial_id = deposits.deposit_serial_id)))"
" ORDER BY wire_deadline ASC",
- 2),
+ 2),
/* Used in #postgres_gc() */
GNUNET_PQ_make_prepare ("gc_prewire",
"DELETE"
@@ -1888,8 +1907,11 @@ postgres_preflight (void *cls,
static enum GNUNET_DB_QueryStatus
postgres_insert_denomination_info (void *cls,
struct TALER_EXCHANGEDB_Session *session,
- const struct TALER_DenominationPublicKey *denom_pub,
- const struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue)
+ const struct
+ TALER_DenominationPublicKey *denom_pub,
+ const struct
+ TALER_EXCHANGEDB_DenominationKeyInformationP
+ *issue)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&issue->properties.denom_hash),
@@ -1920,7 +1942,7 @@ postgres_insert_denomination_info (void *cls,
&issue->properties.fee_refresh));
GNUNET_assert (GNUNET_YES ==
TALER_amount_cmp_currency_nbo (&issue->properties.value,
- &issue->properties.fee_refund));
+ &issue->properties.fee_refund));
return GNUNET_PQ_eval_prepared_non_select (session->conn,
"denomination_insert",
@@ -1941,7 +1963,9 @@ static enum GNUNET_DB_QueryStatus
postgres_get_denomination_info (void *cls,
struct TALER_EXCHANGEDB_Session *session,
const struct GNUNET_HashCode *denom_pub_hash,
- struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue)
+ struct
+ TALER_EXCHANGEDB_DenominationKeyInformationP *
+ issue)
{
struct PostgresClosure *pg = cls;
enum GNUNET_DB_QueryStatus qs;
@@ -1981,8 +2005,10 @@ postgres_get_denomination_info (void *cls,
rs);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
return qs;
- issue->properties.purpose.size = htonl (sizeof (struct TALER_DenominationKeyValidityPS));
- issue->properties.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY);
+ issue->properties.purpose.size = htonl (sizeof (struct
+ TALER_DenominationKeyValidityPS));
+ issue->properties.purpose.purpose = htonl (
+ TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY);
issue->properties.denom_hash = *denom_pub_hash;
return qs;
}
@@ -2025,37 +2051,37 @@ domination_cb_helper (void *cls,
{
struct DenomIteratorContext *dic = cls;
struct PostgresClosure *pg = dic->pg;
-
- for (unsigned int i=0;i<num_results;i++)
+
+ for (unsigned int i = 0; i<num_results; i++)
{
struct TALER_EXCHANGEDB_DenominationKeyInformationP issue;
struct TALER_DenominationPublicKey denom_pub;
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_auto_from_type ("master_pub",
- &issue.properties.master),
- GNUNET_PQ_result_spec_auto_from_type ("master_sig",
- &issue.signature),
- TALER_PQ_result_spec_absolute_time_nbo ("valid_from",
- &issue.properties.start),
- TALER_PQ_result_spec_absolute_time_nbo ("expire_withdraw",
- &issue.properties.expire_withdraw),
- TALER_PQ_result_spec_absolute_time_nbo ("expire_deposit",
- &issue.properties.expire_deposit),
- TALER_PQ_result_spec_absolute_time_nbo ("expire_legal",
- &issue.properties.expire_legal),
- TALER_PQ_RESULT_SPEC_AMOUNT_NBO ("coin",
- &issue.properties.value),
- TALER_PQ_RESULT_SPEC_AMOUNT_NBO ("fee_withdraw",
- &issue.properties.fee_withdraw),
- TALER_PQ_RESULT_SPEC_AMOUNT_NBO ("fee_deposit",
- &issue.properties.fee_deposit),
- TALER_PQ_RESULT_SPEC_AMOUNT_NBO ("fee_refresh",
- &issue.properties.fee_refresh),
- TALER_PQ_RESULT_SPEC_AMOUNT_NBO ("fee_refund",
- &issue.properties.fee_refund),
- GNUNET_PQ_result_spec_rsa_public_key ("denom_pub",
- &denom_pub.rsa_public_key),
- GNUNET_PQ_result_spec_end
+ GNUNET_PQ_result_spec_auto_from_type ("master_pub",
+ &issue.properties.master),
+ GNUNET_PQ_result_spec_auto_from_type ("master_sig",
+ &issue.signature),
+ TALER_PQ_result_spec_absolute_time_nbo ("valid_from",
+ &issue.properties.start),
+ TALER_PQ_result_spec_absolute_time_nbo ("expire_withdraw",
+ &issue.properties.expire_withdraw),
+ TALER_PQ_result_spec_absolute_time_nbo ("expire_deposit",
+ &issue.properties.expire_deposit),
+ TALER_PQ_result_spec_absolute_time_nbo ("expire_legal",
+ &issue.properties.expire_legal),
+ TALER_PQ_RESULT_SPEC_AMOUNT_NBO ("coin",
+ &issue.properties.value),
+ TALER_PQ_RESULT_SPEC_AMOUNT_NBO ("fee_withdraw",
+ &issue.properties.fee_withdraw),
+ TALER_PQ_RESULT_SPEC_AMOUNT_NBO ("fee_deposit",
+ &issue.properties.fee_deposit),
+ TALER_PQ_RESULT_SPEC_AMOUNT_NBO ("fee_refresh",
+ &issue.properties.fee_refresh),
+ TALER_PQ_RESULT_SPEC_AMOUNT_NBO ("fee_refund",
+ &issue.properties.fee_refund),
+ GNUNET_PQ_result_spec_rsa_public_key ("denom_pub",
+ &denom_pub.rsa_public_key),
+ GNUNET_PQ_result_spec_end
};
if (GNUNET_OK !=
@@ -2128,13 +2154,13 @@ postgres_reserve_get (void *cls,
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type(&reserve->pub),
+ GNUNET_PQ_query_param_auto_from_type (&reserve->pub),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_RESULT_SPEC_AMOUNT("current_balance", &reserve->balance),
- TALER_PQ_result_spec_absolute_time("expiration_date", &reserve->expiry),
- TALER_PQ_result_spec_absolute_time("gc_date", &reserve->gc),
+ TALER_PQ_RESULT_SPEC_AMOUNT ("current_balance", &reserve->balance),
+ TALER_PQ_result_spec_absolute_time ("expiration_date", &reserve->expiry),
+ TALER_PQ_result_spec_absolute_time ("gc_date", &reserve->gc),
GNUNET_PQ_result_spec_end
};
@@ -2237,8 +2263,9 @@ postgres_reserves_in_insert (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Creating reserve %s with expiration in %s\n",
TALER_B2S (reserve_pub),
- GNUNET_STRINGS_relative_time_to_string (pg->idle_reserve_expiration_time,
- GNUNET_NO));
+ GNUNET_STRINGS_relative_time_to_string (
+ pg->idle_reserve_expiration_time,
+ GNUNET_NO));
expiry = GNUNET_TIME_absolute_add (execution_time,
pg->idle_reserve_expiration_time);
(void) GNUNET_TIME_round_abs (&expiry);
@@ -2347,7 +2374,8 @@ postgres_reserves_in_insert (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_get_latest_reserve_in_reference (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
+ struct TALER_EXCHANGEDB_Session *
+ session,
const char *exchange_account_name,
void **wire_reference,
size_t *wire_reference_size)
@@ -2386,7 +2414,8 @@ static enum GNUNET_DB_QueryStatus
postgres_get_withdraw_info (void *cls,
struct TALER_EXCHANGEDB_Session *session,
const struct GNUNET_HashCode *h_blind,
- struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable)
+ struct TALER_EXCHANGEDB_CollectableBlindcoin *
+ collectable)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam no_params[] = {
@@ -2438,7 +2467,9 @@ postgres_get_withdraw_info (void *cls,
static enum GNUNET_DB_QueryStatus
postgres_insert_withdraw_info (void *cls,
struct TALER_EXCHANGEDB_Session *session,
- const struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable)
+ const struct
+ TALER_EXCHANGEDB_CollectableBlindcoin *
+ collectable)
{
struct PostgresClosure *pg = cls;
struct TALER_EXCHANGEDB_Reserve reserve;
@@ -2649,7 +2680,7 @@ add_withdraw_coin (void *cls,
cbc = GNUNET_new (struct TALER_EXCHANGEDB_CollectableBlindcoin);
{
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_auto_from_type ("h_blind_ev",
+ GNUNET_PQ_result_spec_auto_from_type ("h_blind_ev",
&cbc->h_coin_envelope),
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&cbc->denom_pub_hash),
@@ -2719,7 +2750,8 @@ add_payback (void *cls,
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&payback->coin.denom_pub_hash),
GNUNET_PQ_result_spec_rsa_signature ("denom_sig",
- &payback->coin.denom_sig.rsa_signature),
+ &payback->coin.denom_sig.
+ rsa_signature),
GNUNET_PQ_result_spec_end
};
@@ -2757,7 +2789,7 @@ add_exchange_to_bank (void *cls,
{
struct ReserveHistoryContext *rhc = cls;
struct PostgresClosure *pg = rhc->pg;
-
+
while (0 < num_results)
{
struct TALER_EXCHANGEDB_ClosingTransfer *closing;
@@ -2766,28 +2798,28 @@ add_exchange_to_bank (void *cls,
closing = GNUNET_new (struct TALER_EXCHANGEDB_ClosingTransfer);
{
struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
- &closing->amount),
- TALER_PQ_RESULT_SPEC_AMOUNT ("closing_fee",
- &closing->closing_fee),
- TALER_PQ_result_spec_absolute_time ("execution_date",
- &closing->execution_date),
- GNUNET_PQ_result_spec_string ("receiver_account",
+ TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
+ &closing->amount),
+ TALER_PQ_RESULT_SPEC_AMOUNT ("closing_fee",
+ &closing->closing_fee),
+ TALER_PQ_result_spec_absolute_time ("execution_date",
+ &closing->execution_date),
+ GNUNET_PQ_result_spec_string ("receiver_account",
&closing->receiver_account_details),
- GNUNET_PQ_result_spec_auto_from_type ("wtid",
- &closing->wtid),
- GNUNET_PQ_result_spec_end
+ GNUNET_PQ_result_spec_auto_from_type ("wtid",
+ &closing->wtid),
+ GNUNET_PQ_result_spec_end
};
if (GNUNET_OK !=
- GNUNET_PQ_extract_result (result,
- rs,
- --num_results))
+ GNUNET_PQ_extract_result (result,
+ rs,
+ --num_results))
{
- GNUNET_break (0);
- GNUNET_free (closing);
- rhc->status = GNUNET_SYSERR;
- return;
+ GNUNET_break (0);
+ GNUNET_free (closing);
+ rhc->status = GNUNET_SYSERR;
+ return;
}
}
closing->reserve_pub = *rhc->reserve_pub;
@@ -2816,7 +2848,8 @@ postgres_get_reserve_history (void *cls,
{
struct PostgresClosure *pg = cls;
struct ReserveHistoryContext rhc;
- struct {
+ struct
+ {
/**
* Name of the prepared statement to run.
*/
@@ -2854,15 +2887,15 @@ postgres_get_reserve_history (void *cls,
rhc.pg = pg;
rhc.status = GNUNET_OK;
qs = GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; /* make static analysis happy */
- for (unsigned int i=0;NULL != work[i].cb;i++)
+ for (unsigned int i = 0; NULL != work[i].cb; i++)
{
qs = GNUNET_PQ_eval_prepared_multi_select (session->conn,
- work[i].statement,
- params,
- work[i].cb,
- &rhc);
+ work[i].statement,
+ params,
+ work[i].cb,
+ &rhc);
if ( (0 > qs) ||
- (GNUNET_OK != rhc.status) )
+ (GNUNET_OK != rhc.status) )
break;
}
if ( (qs < 0) ||
@@ -3026,8 +3059,8 @@ postgres_test_deposit_done (void *cls,
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
return GNUNET_DB_STATUS_HARD_ERROR; /* deposit MUST exist */
return (done
- ? GNUNET_DB_STATUS_SUCCESS_ONE_RESULT
- : GNUNET_DB_STATUS_SUCCESS_NO_RESULTS);
+ ? GNUNET_DB_STATUS_SUCCESS_ONE_RESULT
+ : GNUNET_DB_STATUS_SUCCESS_NO_RESULTS);
}
@@ -3160,7 +3193,7 @@ struct MatchingDepositContext
* Plugin context.
*/
struct PostgresClosure *pg;
-
+
/**
* Maximum number of results to return.
*/
@@ -3201,7 +3234,7 @@ match_deposit_cb (void *cls,
mdc->limit);
num_results = GNUNET_MIN (num_results,
mdc->limit);
- for (mdc->i=0;mdc->i<num_results;mdc->i++)
+ for (mdc->i = 0; mdc->i<num_results; mdc->i++)
{
struct TALER_Amount amount_with_fee;
struct TALER_Amount deposit_fee;
@@ -3218,7 +3251,7 @@ match_deposit_cb (void *cls,
TALER_PQ_RESULT_SPEC_AMOUNT ("fee_deposit",
&deposit_fee),
TALER_PQ_result_spec_absolute_time ("wire_deadline",
- &wire_deadline),
+ &wire_deadline),
GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms",
&h_contract_terms),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
@@ -3269,7 +3302,8 @@ static enum GNUNET_DB_QueryStatus
postgres_iterate_matching_deposits (void *cls,
struct TALER_EXCHANGEDB_Session *session,
const struct GNUNET_HashCode *h_wire,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
+ const struct
+ TALER_MerchantPublicKeyP *merchant_pub,
TALER_EXCHANGEDB_DepositIterator deposit_cb,
void *deposit_cb_cls,
uint32_t limit)
@@ -3372,8 +3406,8 @@ insert_known_coin (void *cls,
"Creating known coin %s\n",
TALER_B2S (&coin_info->coin_pub));
return GNUNET_PQ_eval_prepared_non_select (session->conn,
- "insert_known_coin",
- params);
+ "insert_known_coin",
+ params);
}
@@ -3447,8 +3481,8 @@ postgres_ensure_coin_known (void *cls,
GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs);
/* if not known, insert it */
qs = insert_known_coin (pc,
- session,
- coin);
+ session,
+ coin);
if (0 >= qs)
{
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
@@ -3496,13 +3530,13 @@ postgres_insert_deposit (void *cls,
return qs;
#endif
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Inserting deposit to be executed at %s (%llu/%llu)\n",
- GNUNET_STRINGS_absolute_time_to_string (deposit->wire_deadline),
- (unsigned long long) deposit->wire_deadline.abs_value_us,
- (unsigned long long) deposit->refund_deadline.abs_value_us);
+ "Inserting deposit to be executed at %s (%llu/%llu)\n",
+ GNUNET_STRINGS_absolute_time_to_string (deposit->wire_deadline),
+ (unsigned long long) deposit->wire_deadline.abs_value_us,
+ (unsigned long long) deposit->refund_deadline.abs_value_us);
return GNUNET_PQ_eval_prepared_non_select (session->conn,
- "insert_deposit",
- params);
+ "insert_deposit",
+ params);
}
@@ -3575,13 +3609,13 @@ struct SelectRefundContext
*/
static void
get_refunds_cb (void *cls,
- PGresult *result,
- unsigned int num_results)
+ PGresult *result,
+ unsigned int num_results)
{
struct SelectRefundContext *srctx = cls;
struct PostgresClosure *pg = srctx->pg;
- for (unsigned int i=0;i<num_results;i++)
+ for (unsigned int i = 0; i<num_results; i++)
{
struct TALER_MerchantPublicKeyP merchant_pub;
struct TALER_MerchantSignatureP merchant_sig;
@@ -3640,7 +3674,8 @@ get_refunds_cb (void *cls,
static enum GNUNET_DB_QueryStatus
postgres_select_refunds_by_coin (void *cls,
struct TALER_EXCHANGEDB_Session *session,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct
+ TALER_CoinSpendPublicKeyP *coin_pub,
TALER_EXCHANGEDB_RefundCoinCallback cb,
void *cb_cls)
{
@@ -3690,11 +3725,13 @@ postgres_get_melt (void *cls,
};
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
- &refresh_melt->session.coin.denom_pub_hash),
+ &refresh_melt->session.coin.
+ denom_pub_hash),
TALER_PQ_RESULT_SPEC_AMOUNT ("fee_refresh",
&refresh_melt->melt_fee),
GNUNET_PQ_result_spec_rsa_signature ("denom_sig",
- &refresh_melt->session.coin.denom_sig.rsa_signature),
+ &refresh_melt->session.coin.denom_sig.
+ rsa_signature),
GNUNET_PQ_result_spec_uint32 ("noreveal_index",
&refresh_melt->session.noreveal_index),
GNUNET_PQ_result_spec_auto_from_type ("old_coin_pub",
@@ -3710,9 +3747,9 @@ postgres_get_melt (void *cls,
if (NULL == session)
session = postgres_get_session (pg);
qs = GNUNET_PQ_eval_prepared_singleton_select (session->conn,
- "get_melt",
- params,
- rs);
+ "get_melt",
+ params,
+ rs);
refresh_melt->session.rc = *rc;
return qs;
}
@@ -3762,7 +3799,8 @@ postgres_get_melt_index (void *cls,
static enum GNUNET_DB_QueryStatus
postgres_insert_melt (void *cls,
struct TALER_EXCHANGEDB_Session *session,
- const struct TALER_EXCHANGEDB_RefreshSession *refresh_session)
+ const struct
+ TALER_EXCHANGEDB_RefreshSession *refresh_session)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&refresh_session->rc),
@@ -3781,8 +3819,8 @@ postgres_insert_melt (void *cls,
return qs;
#endif
return GNUNET_PQ_eval_prepared_non_select (session->conn,
- "insert_melt",
- params);
+ "insert_melt",
+ params);
}
@@ -3807,7 +3845,8 @@ postgres_insert_refresh_reveal (void *cls,
struct TALER_EXCHANGEDB_Session *session,
const struct TALER_RefreshCommitmentP *rc,
uint32_t num_rrcs,
- const struct TALER_EXCHANGEDB_RefreshRevealedCoin *rrcs,
+ const struct
+ TALER_EXCHANGEDB_RefreshRevealedCoin *rrcs,
unsigned int num_tprivs,
const struct TALER_TransferPrivateKeyP *tprivs,
const struct TALER_TransferPublicKeyP *tp)
@@ -3817,7 +3856,7 @@ postgres_insert_refresh_reveal (void *cls,
GNUNET_break (0);
return GNUNET_DB_STATUS_HARD_ERROR;
}
- for (uint32_t i=0;i<num_rrcs;i++)
+ for (uint32_t i = 0; i<num_rrcs; i++)
{
const struct TALER_EXCHANGEDB_RefreshRevealedCoin *rrc = &rrcs[i];
struct GNUNET_HashCode denom_pub_hash;
@@ -3852,7 +3891,8 @@ postgres_insert_refresh_reveal (void *cls,
GNUNET_PQ_query_param_auto_from_type (rc),
GNUNET_PQ_query_param_auto_from_type (tp),
GNUNET_PQ_query_param_fixed_size (tprivs,
- num_tprivs * sizeof (struct TALER_TransferPrivateKeyP)),
+ num_tprivs * sizeof (struct
+ TALER_TransferPrivateKeyP)),
GNUNET_PQ_query_param_end
};
@@ -4026,7 +4066,8 @@ postgres_get_refresh_reveal (void *cls,
GNUNET_assert (0);
}
if ( (0 != tpriv_size % sizeof (struct TALER_TransferPrivateKeyP)) ||
- (TALER_CNC_KAPPA - 1 != tpriv_size / sizeof (struct TALER_TransferPrivateKeyP)) )
+ (TALER_CNC_KAPPA - 1 != tpriv_size / sizeof (struct
+ TALER_TransferPrivateKeyP)) )
{
GNUNET_break (0);
qs = GNUNET_DB_STATUS_HARD_ERROR;
@@ -4043,7 +4084,7 @@ postgres_get_refresh_reveal (void *cls,
&tp);
GNUNET_PQ_cleanup_result (rs);
- cleanup:
+ cleanup:
for (unsigned int i = 0; i < grctx.rrcs_len; i++)
{
struct TALER_EXCHANGEDB_RefreshRevealedCoin *rrc = &grctx.rrcs[i];
@@ -4109,9 +4150,9 @@ free_link_data_list (void *cls,
{
next = ldl->next;
if (NULL != ldl->denom_pub.rsa_public_key)
- GNUNET_CRYPTO_rsa_public_key_free (ldl->denom_pub.rsa_public_key);
- if (NULL != ldl->ev_sig.rsa_signature)
- GNUNET_CRYPTO_rsa_signature_free (ldl->ev_sig.rsa_signature);
+ GNUNET_CRYPTO_rsa_public_key_free (ldl->denom_pub.rsa_public_key);
+ if (NULL != ldl->ev_sig.rsa_signature)
+ GNUNET_CRYPTO_rsa_signature_free (ldl->ev_sig.rsa_signature);
GNUNET_free (ldl);
ldl = next;
}
@@ -4291,7 +4332,7 @@ add_coin_deposit (void *cls,
{
struct CoinHistoryContext *chc = cls;
struct PostgresClosure *pg = chc->pg;
-
+
for (unsigned int i = 0; i < num_results; i++)
{
struct TALER_EXCHANGEDB_Deposit *deposit;
@@ -4372,7 +4413,7 @@ add_coin_melt (void *cls,
struct CoinHistoryContext *chc = cls;
struct PostgresClosure *pg = chc->pg;
- for (unsigned int i=0;i<num_results;i++)
+ for (unsigned int i = 0; i<num_results; i++)
{
struct TALER_EXCHANGEDB_RefreshMelt *melt;
struct TALER_EXCHANGEDB_TransactionList *tl;
@@ -4381,7 +4422,7 @@ add_coin_melt (void *cls,
melt = GNUNET_new (struct TALER_EXCHANGEDB_RefreshMelt);
{
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_auto_from_type ("rc",
+ GNUNET_PQ_result_spec_auto_from_type ("rc",
&melt->session.rc),
/* oldcoin_index not needed */
GNUNET_PQ_result_spec_auto_from_type ("old_coin_sig",
@@ -4442,7 +4483,7 @@ add_coin_refund (void *cls,
struct CoinHistoryContext *chc = cls;
struct PostgresClosure *pg = chc->pg;
- for (unsigned int i=0;i<num_results;i++)
+ for (unsigned int i = 0; i<num_results; i++)
{
struct TALER_EXCHANGEDB_Refund *refund;
struct TALER_EXCHANGEDB_TransactionList *tl;
@@ -4514,7 +4555,7 @@ add_old_coin_payback (void *cls,
struct CoinHistoryContext *chc = cls;
struct PostgresClosure *pg = chc->pg;
- for (unsigned int i=0;i<num_results;i++)
+ for (unsigned int i = 0; i<num_results; i++)
{
struct TALER_EXCHANGEDB_PaybackRefresh *payback;
struct TALER_EXCHANGEDB_TransactionList *tl;
@@ -4535,7 +4576,8 @@ add_old_coin_payback (void *cls,
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&payback->coin.denom_pub_hash),
GNUNET_PQ_result_spec_rsa_signature ("denom_sig",
- &payback->coin.denom_sig.rsa_signature),
+ &payback->coin.denom_sig.
+ rsa_signature),
GNUNET_PQ_result_spec_end
};
@@ -4576,7 +4618,7 @@ add_coin_payback (void *cls,
struct CoinHistoryContext *chc = cls;
struct PostgresClosure *pg = chc->pg;
- for (unsigned int i=0;i<num_results;i++)
+ for (unsigned int i = 0; i<num_results; i++)
{
struct TALER_EXCHANGEDB_Payback *payback;
struct TALER_EXCHANGEDB_TransactionList *tl;
@@ -4597,7 +4639,8 @@ add_coin_payback (void *cls,
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&payback->coin.denom_pub_hash),
GNUNET_PQ_result_spec_rsa_signature ("denom_sig",
- &payback->coin.denom_sig.rsa_signature),
+ &payback->coin.denom_sig.
+ rsa_signature),
GNUNET_PQ_result_spec_end
};
@@ -4638,7 +4681,7 @@ add_coin_payback_refresh (void *cls,
struct CoinHistoryContext *chc = cls;
struct PostgresClosure *pg = chc->pg;
- for (unsigned int i=0;i<num_results;i++)
+ for (unsigned int i = 0; i<num_results; i++)
{
struct TALER_EXCHANGEDB_PaybackRefresh *payback;
struct TALER_EXCHANGEDB_TransactionList *tl;
@@ -4659,7 +4702,8 @@ add_coin_payback_refresh (void *cls,
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&payback->coin.denom_pub_hash),
GNUNET_PQ_result_spec_rsa_signature ("denom_sig",
- &payback->coin.denom_sig.rsa_signature),
+ &payback->coin.denom_sig.
+ rsa_signature),
GNUNET_PQ_result_spec_end
};
@@ -4714,7 +4758,8 @@ struct Work
static enum GNUNET_DB_QueryStatus
postgres_get_coin_transactions (void *cls,
struct TALER_EXCHANGEDB_Session *session,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct
+ TALER_CoinSpendPublicKeyP *coin_pub,
int include_payback,
struct TALER_EXCHANGEDB_TransactionList **tlp)
{
@@ -4758,7 +4803,7 @@ postgres_get_coin_transactions (void *cls,
GNUNET_PQ_query_param_end
};
enum GNUNET_DB_QueryStatus qs;
- const struct Work * work;
+ const struct Work *work;
work = (GNUNET_YES == include_payback) ? work_wp : work_op;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -4770,7 +4815,7 @@ postgres_get_coin_transactions (void *cls,
chc.session = session;
chc.pg = pg;
chc.db_cls = cls;
- for (unsigned int i=0;NULL != work[i].statement; i++)
+ for (unsigned int i = 0; NULL != work[i].statement; i++)
{
qs = GNUNET_PQ_eval_prepared_multi_select (session->conn,
work[i].statement,
@@ -4778,7 +4823,7 @@ postgres_get_coin_transactions (void *cls,
work[i].cb,
&chc);
if ( (0 > qs) ||
- (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != chc.status) )
+ (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != chc.status) )
{
if (NULL != chc.head)
common_free_coin_transaction_list (cls,
@@ -4840,7 +4885,7 @@ handle_wt_result (void *cls,
struct WireTransferResultContext *ctx = cls;
struct PostgresClosure *pg = ctx->pg;
- for (unsigned int i=0;i<num_results;i++)
+ for (unsigned int i = 0; i<num_results; i++)
{
uint64_t rowid;
struct GNUNET_HashCode h_contract_terms;
@@ -4854,10 +4899,12 @@ handle_wt_result (void *cls,
json_t *wire;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("aggregation_serial_id", &rowid),
- GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms", &h_contract_terms),
+ GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms",
+ &h_contract_terms),
TALER_PQ_result_spec_json ("wire", &wire),
GNUNET_PQ_result_spec_auto_from_type ("h_wire", &h_wire),
- GNUNET_PQ_result_spec_rsa_public_key ("denom_pub", &denom_pub.rsa_public_key),
+ GNUNET_PQ_result_spec_rsa_public_key ("denom_pub",
+ &denom_pub.rsa_public_key),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub", &coin_pub),
GNUNET_PQ_result_spec_auto_from_type ("merchant_pub", &merchant_pub),
TALER_PQ_result_spec_absolute_time ("execution_date", &exec_time),
@@ -4905,7 +4952,8 @@ handle_wt_result (void *cls,
static enum GNUNET_DB_QueryStatus
postgres_lookup_wire_transfer (void *cls,
struct TALER_EXCHANGEDB_Session *session,
- const struct TALER_WireTransferIdentifierRawP *wtid,
+ const struct
+ TALER_WireTransferIdentifierRawP *wtid,
TALER_EXCHANGEDB_WireTransferDataCallback cb,
void *cb_cls)
{
@@ -4951,10 +4999,13 @@ postgres_lookup_wire_transfer (void *cls,
static enum GNUNET_DB_QueryStatus
postgres_wire_lookup_deposit_wtid (void *cls,
struct TALER_EXCHANGEDB_Session *session,
- const struct GNUNET_HashCode *h_contract_terms,
+ const struct
+ GNUNET_HashCode *h_contract_terms,
const struct GNUNET_HashCode *h_wire,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
+ const struct
+ TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct
+ TALER_MerchantPublicKeyP *merchant_pub,
TALER_EXCHANGEDB_TrackTransactionCallback cb,
void *cb_cls)
{
@@ -4981,9 +5032,9 @@ postgres_wire_lookup_deposit_wtid (void *cls,
/* check if the melt record exists and get it */
qs = GNUNET_PQ_eval_prepared_singleton_select (session->conn,
- "lookup_deposit_wtid",
- params,
- rs);
+ "lookup_deposit_wtid",
+ params,
+ rs);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
{
cb (cb_cls,
@@ -5027,7 +5078,7 @@ postgres_wire_lookup_deposit_wtid (void *cls,
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
{
/* Ok, we're aware of the transaction, but it has not yet been
- executed */
+ executed */
cb (cb_cls,
NULL,
&amount_with_fee,
@@ -5052,7 +5103,8 @@ postgres_wire_lookup_deposit_wtid (void *cls,
static enum GNUNET_DB_QueryStatus
postgres_insert_aggregation_tracking (void *cls,
struct TALER_EXCHANGEDB_Session *session,
- const struct TALER_WireTransferIdentifierRawP *wtid,
+ const struct
+ TALER_WireTransferIdentifierRawP *wtid,
unsigned long long deposit_serial_id)
{
uint64_t rid = deposit_serial_id;
@@ -5182,7 +5234,7 @@ postgres_insert_wire_fee (void *cls,
}
if (0 != TALER_amount_cmp (closing_fee,
&cf))
- {
+ {
GNUNET_break (0);
return GNUNET_DB_STATUS_HARD_ERROR;
}
@@ -5247,7 +5299,7 @@ reserve_expired_cb (void *cls,
int ret;
ret = GNUNET_OK;
- for (unsigned int i=0;i<num_results;i++)
+ for (unsigned int i = 0; i<num_results; i++)
{
struct GNUNET_TIME_Absolute exp_date;
char *account_details;
@@ -5344,10 +5396,12 @@ postgres_get_expired_reserves (void *cls,
static enum GNUNET_DB_QueryStatus
postgres_insert_reserve_closed (void *cls,
struct TALER_EXCHANGEDB_Session *session,
- const struct TALER_ReservePublicKeyP *reserve_pub,
+ const struct
+ TALER_ReservePublicKeyP *reserve_pub,
struct GNUNET_TIME_Absolute execution_date,
const char *receiver_account,
- const struct TALER_WireTransferIdentifierRawP *wtid,
+ const struct
+ TALER_WireTransferIdentifierRawP *wtid,
const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *closing_fee)
{
@@ -5442,7 +5496,8 @@ postgres_wire_prepare_data_insert (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_wire_prepare_data_mark_finished (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
+ struct TALER_EXCHANGEDB_Session *
+ session,
uint64_t rowid)
{
struct GNUNET_PQ_QueryParam params[] = {
@@ -5535,9 +5590,10 @@ postgres_start_deferred_wire_out (void *cls,
if (PGRES_COMMAND_OK !=
(ex = PQresultStatus (result)))
{
- TALER_LOG_ERROR ("Failed to defer wire_out_ref constraint on transaction (%s): %s\n",
- PQresStatus (ex),
- PQerrorMessage (session->conn));
+ TALER_LOG_ERROR (
+ "Failed to defer wire_out_ref constraint on transaction (%s): %s\n",
+ PQresStatus (ex),
+ PQerrorMessage (session->conn));
GNUNET_break (0);
PQclear (result);
postgres_rollback (cls,
@@ -5566,7 +5622,8 @@ static enum GNUNET_DB_QueryStatus
postgres_store_wire_transfer_out (void *cls,
struct TALER_EXCHANGEDB_Session *session,
struct GNUNET_TIME_Absolute date,
- const struct TALER_WireTransferIdentifierRawP *wtid,
+ const struct
+ TALER_WireTransferIdentifierRawP *wtid,
const json_t *wire_account,
const char *exchange_account_section,
const struct TALER_Amount *amount)
@@ -5620,8 +5677,9 @@ postgres_gc (void *cls)
be enough _and_ they are tiny so it does not
matter to make this tight */
long_ago = GNUNET_TIME_absolute_subtract (now,
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS,
- 10));
+ GNUNET_TIME_relative_multiply (
+ GNUNET_TIME_UNIT_YEARS,
+ 10));
/* FIXME: use GNUNET_PQ_connect_with_cfg instead? */
conn = GNUNET_PQ_connect (pg->connection_cfg_str);
if (NULL == conn)
@@ -5630,16 +5688,16 @@ postgres_gc (void *cls)
if (GNUNET_OK == ret)
{
if (
- (0 > GNUNET_PQ_eval_prepared_non_select (conn,
- "gc_reserves",
- params_time)) ||
- (0 > GNUNET_PQ_eval_prepared_non_select (conn,
- "gc_prewire",
- params_none)) ||
- (0 > GNUNET_PQ_eval_prepared_non_select (conn,
- "gc_wire_fee",
- params_ancient_time))
- )
+ (0 > GNUNET_PQ_eval_prepared_non_select (conn,
+ "gc_reserves",
+ params_time)) ||
+ (0 > GNUNET_PQ_eval_prepared_non_select (conn,
+ "gc_prewire",
+ params_none)) ||
+ (0 > GNUNET_PQ_eval_prepared_non_select (conn,
+ "gc_wire_fee",
+ params_ancient_time))
+ )
ret = GNUNET_SYSERR;
/* This one may fail due to foreign key constraints from
payback and reserves_out tables to known_coins; these
@@ -5647,8 +5705,8 @@ postgres_gc (void *cls)
keys alive for a bit longer, thus causing this statement
to fail. */
(void) GNUNET_PQ_eval_prepared_non_select (conn,
- "gc_denominations",
- params_time);
+ "gc_denominations",
+ params_time);
}
PQfinish (conn);
return ret;
@@ -5675,7 +5733,7 @@ struct DepositSerialContext
* Plugin context.
*/
struct PostgresClosure *pg;
-
+
/**
* Status code, set to #GNUNET_SYSERR on hard errors.
*/
@@ -5698,8 +5756,8 @@ deposit_serial_helper_cb (void *cls,
{
struct DepositSerialContext *dsc = cls;
struct PostgresClosure *pg = dsc->pg;
-
- for (unsigned int i=0;i<num_results;i++)
+
+ for (unsigned int i = 0; i<num_results; i++)
{
struct TALER_EXCHANGEDB_Deposit deposit;
struct TALER_DenominationPublicKey denom_pub;
@@ -5715,15 +5773,15 @@ deposit_serial_helper_cb (void *cls,
GNUNET_PQ_result_spec_rsa_public_key ("denom_pub",
&denom_pub.rsa_public_key),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
- &deposit.coin.coin_pub),
+ &deposit.coin.coin_pub),
GNUNET_PQ_result_spec_auto_from_type ("coin_sig",
- &deposit.csig),
+ &deposit.csig),
TALER_PQ_result_spec_absolute_time ("refund_deadline",
- &deposit.refund_deadline),
+ &deposit.refund_deadline),
TALER_PQ_result_spec_absolute_time ("wire_deadline",
- &deposit.wire_deadline),
+ &deposit.wire_deadline),
GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms",
- &deposit.h_contract_terms),
+ &deposit.h_contract_terms),
TALER_PQ_result_spec_json ("wire",
&deposit.receiver_wire_account),
GNUNET_PQ_result_spec_auto_from_type ("done",
@@ -5776,7 +5834,8 @@ deposit_serial_helper_cb (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_select_deposits_above_serial_id (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
+ struct TALER_EXCHANGEDB_Session *
+ session,
uint64_t serial_id,
TALER_EXCHANGEDB_DepositCallback cb,
void *cb_cls)
@@ -5823,9 +5882,9 @@ struct RefreshsSerialContext
/**
* Plugin context.
- */
+ */
struct PostgresClosure *pg;
-
+
/**
* Status code, set to #GNUNET_SYSERR on hard errors.
*/
@@ -5848,8 +5907,8 @@ refreshs_serial_helper_cb (void *cls,
{
struct RefreshsSerialContext *rsc = cls;
struct PostgresClosure *pg = rsc->pg;
-
- for (unsigned int i=0;i<num_results;i++)
+
+ for (unsigned int i = 0; i<num_results; i++)
{
struct TALER_DenominationPublicKey denom_pub;
struct TALER_CoinSpendPublicKeyP coin_pub;
@@ -5914,9 +5973,11 @@ refreshs_serial_helper_cb (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_select_refreshs_above_serial_id (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
+ struct TALER_EXCHANGEDB_Session *
+ session,
uint64_t serial_id,
- TALER_EXCHANGEDB_RefreshSessionCallback cb,
+ TALER_EXCHANGEDB_RefreshSessionCallback
+ cb,
void *cb_cls)
{
struct PostgresClosure *pg = cls;
@@ -5986,8 +6047,8 @@ refunds_serial_helper_cb (void *cls,
{
struct RefundsSerialContext *rsc = cls;
struct PostgresClosure *pg = rsc->pg;
-
- for (unsigned int i=0;i<num_results;i++)
+
+ for (unsigned int i = 0; i<num_results; i++)
{
struct TALER_EXCHANGEDB_Refund refund;
struct TALER_DenominationPublicKey denom_pub;
@@ -5996,15 +6057,15 @@ refunds_serial_helper_cb (void *cls,
GNUNET_PQ_result_spec_auto_from_type ("merchant_pub",
&refund.merchant_pub),
GNUNET_PQ_result_spec_auto_from_type ("merchant_sig",
- &refund.merchant_sig),
+ &refund.merchant_sig),
GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms",
- &refund.h_contract_terms),
+ &refund.h_contract_terms),
GNUNET_PQ_result_spec_uint64 ("rtransaction_id",
&refund.rtransaction_id),
GNUNET_PQ_result_spec_rsa_public_key ("denom_pub",
&denom_pub.rsa_public_key),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
- &refund.coin.coin_pub),
+ &refund.coin.coin_pub),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
&refund.refund_amount),
GNUNET_PQ_result_spec_uint64 ("refund_serial_id",
@@ -6051,7 +6112,8 @@ refunds_serial_helper_cb (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_select_refunds_above_serial_id (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
+ struct TALER_EXCHANGEDB_Session *
+ session,
uint64_t serial_id,
TALER_EXCHANGEDB_RefundCallback cb,
void *cb_cls)
@@ -6100,7 +6162,7 @@ struct ReservesInSerialContext
* Plugin context.
*/
struct PostgresClosure *pg;
-
+
/**
* Status code, set to #GNUNET_SYSERR on hard errors.
*/
@@ -6123,8 +6185,8 @@ reserves_in_serial_helper_cb (void *cls,
{
struct ReservesInSerialContext *risc = cls;
struct PostgresClosure *pg = risc->pg;
-
- for (unsigned int i=0;i<num_results;i++)
+
+ for (unsigned int i = 0; i<num_results; i++)
{
struct TALER_ReservePublicKeyP reserve_pub;
struct TALER_Amount credit;
@@ -6141,7 +6203,7 @@ reserves_in_serial_helper_cb (void *cls,
&wire_reference_size),
TALER_PQ_RESULT_SPEC_AMOUNT ("credit",
&credit),
- TALER_PQ_result_spec_absolute_time("execution_date",
+ TALER_PQ_result_spec_absolute_time ("execution_date",
&execution_date),
GNUNET_PQ_result_spec_string ("sender_account_details",
&sender_account_details),
@@ -6188,9 +6250,11 @@ reserves_in_serial_helper_cb (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_select_reserves_in_above_serial_id (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
+ struct TALER_EXCHANGEDB_Session *
+ session,
uint64_t serial_id,
- TALER_EXCHANGEDB_ReserveInCallback cb,
+ TALER_EXCHANGEDB_ReserveInCallback
+ cb,
void *cb_cls)
{
struct PostgresClosure *pg = cls;
@@ -6231,10 +6295,13 @@ postgres_select_reserves_in_above_serial_id (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_select_reserves_in_above_serial_id_by_account (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
+ struct
+ TALER_EXCHANGEDB_Session
+ *session,
const char *account_name,
uint64_t serial_id,
- TALER_EXCHANGEDB_ReserveInCallback cb,
+ TALER_EXCHANGEDB_ReserveInCallback
+ cb,
void *cb_cls)
{
struct PostgresClosure *pg = cls;
@@ -6282,7 +6349,7 @@ struct ReservesOutSerialContext
* Plugin context.
*/
struct PostgresClosure *pg;
-
+
/**
* Status code, set to #GNUNET_SYSERR on hard errors.
*/
@@ -6305,8 +6372,8 @@ reserves_out_serial_helper_cb (void *cls,
{
struct ReservesOutSerialContext *rosc = cls;
struct PostgresClosure *pg = rosc->pg;
-
- for (unsigned int i=0;i<num_results;i++)
+
+ for (unsigned int i = 0; i<num_results; i++)
{
struct GNUNET_HashCode h_blind_ev;
struct TALER_DenominationPublicKey denom_pub;
@@ -6328,7 +6395,7 @@ reserves_out_serial_helper_cb (void *cls,
GNUNET_PQ_result_spec_auto_from_type ("reserve_sig",
&reserve_sig),
TALER_PQ_result_spec_absolute_time ("execution_date",
- &execution_date),
+ &execution_date),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
&amount_with_fee),
GNUNET_PQ_result_spec_uint64 ("reserve_out_serial_id",
@@ -6375,9 +6442,11 @@ reserves_out_serial_helper_cb (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_select_reserves_out_above_serial_id (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
+ struct TALER_EXCHANGEDB_Session *
+ session,
uint64_t serial_id,
- TALER_EXCHANGEDB_WithdrawCallback cb,
+ TALER_EXCHANGEDB_WithdrawCallback
+ cb,
void *cb_cls)
{
struct PostgresClosure *pg = cls;
@@ -6447,8 +6516,8 @@ wire_out_serial_helper_cb (void *cls,
{
struct WireOutSerialContext *wosc = cls;
struct PostgresClosure *pg = wosc->pg;
-
- for (unsigned int i=0;i<num_results;i++)
+
+ for (unsigned int i = 0; i<num_results; i++)
{
uint64_t rowid;
struct GNUNET_TIME_Absolute date;
@@ -6459,7 +6528,7 @@ wire_out_serial_helper_cb (void *cls,
GNUNET_PQ_result_spec_uint64 ("wireout_uuid",
&rowid),
TALER_PQ_result_spec_absolute_time ("execution_date",
- &date),
+ &date),
GNUNET_PQ_result_spec_auto_from_type ("wtid_raw",
&wtid),
TALER_PQ_result_spec_json ("wire_target",
@@ -6505,9 +6574,11 @@ wire_out_serial_helper_cb (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_select_wire_out_above_serial_id (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
+ struct TALER_EXCHANGEDB_Session *
+ session,
uint64_t serial_id,
- TALER_EXCHANGEDB_WireTransferOutCallback cb,
+ TALER_EXCHANGEDB_WireTransferOutCallback
+ cb,
void *cb_cls)
{
struct PostgresClosure *pg = cls;
@@ -6548,10 +6619,13 @@ postgres_select_wire_out_above_serial_id (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_select_wire_out_above_serial_id_by_account (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
+ struct
+ TALER_EXCHANGEDB_Session *
+ session,
const char *account_name,
uint64_t serial_id,
- TALER_EXCHANGEDB_WireTransferOutCallback cb,
+ TALER_EXCHANGEDB_WireTransferOutCallback
+ cb,
void *cb_cls)
{
struct PostgresClosure *pg = cls;
@@ -6599,7 +6673,7 @@ struct PaybackSerialContext
* Plugin context.
*/
struct PostgresClosure *pg;
-
+
/**
* Status code, set to #GNUNET_SYSERR on hard errors.
*/
@@ -6622,8 +6696,8 @@ payback_serial_helper_cb (void *cls,
{
struct PaybackSerialContext *psc = cls;
struct PostgresClosure *pg = psc->pg;
-
- for (unsigned int i=0;i<num_results;i++)
+
+ for (unsigned int i = 0; i<num_results; i++)
{
uint64_t rowid;
struct TALER_ReservePublicKeyP reserve_pub;
@@ -6638,7 +6712,7 @@ payback_serial_helper_cb (void *cls,
GNUNET_PQ_result_spec_uint64 ("payback_uuid",
&rowid),
TALER_PQ_result_spec_absolute_time ("timestamp",
- &timestamp),
+ &timestamp),
GNUNET_PQ_result_spec_auto_from_type ("reserve_pub",
&reserve_pub),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
@@ -6652,7 +6726,7 @@ payback_serial_helper_cb (void *cls,
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&coin.denom_pub_hash),
GNUNET_PQ_result_spec_rsa_public_key ("denom_pub",
- &denom_pub.rsa_public_key),
+ &denom_pub.rsa_public_key),
GNUNET_PQ_result_spec_rsa_signature ("denom_sig",
&coin.denom_sig.rsa_signature),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
@@ -6699,7 +6773,8 @@ payback_serial_helper_cb (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_select_payback_above_serial_id (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
+ struct TALER_EXCHANGEDB_Session *
+ session,
uint64_t serial_id,
TALER_EXCHANGEDB_PaybackCallback cb,
void *cb_cls)
@@ -6718,10 +6793,10 @@ postgres_select_payback_above_serial_id (void *cls,
enum GNUNET_DB_QueryStatus qs;
qs = GNUNET_PQ_eval_prepared_multi_select (session->conn,
- "payback_get_incr",
- params,
- &payback_serial_helper_cb,
- &psc);
+ "payback_get_incr",
+ params,
+ &payback_serial_helper_cb,
+ &psc);
if (GNUNET_OK != psc.status)
return GNUNET_DB_STATUS_HARD_ERROR;
return qs;
@@ -6748,7 +6823,7 @@ struct PaybackRefreshSerialContext
* Plugin context.
*/
struct PostgresClosure *pg;
-
+
/**
* Status code, set to #GNUNET_SYSERR on hard errors.
*/
@@ -6771,8 +6846,8 @@ payback_refresh_serial_helper_cb (void *cls,
{
struct PaybackRefreshSerialContext *psc = cls;
struct PostgresClosure *pg = psc->pg;
-
- for (unsigned int i=0;i<num_results;i++)
+
+ for (unsigned int i = 0; i<num_results; i++)
{
uint64_t rowid;
struct TALER_CoinSpendPublicKeyP old_coin_pub;
@@ -6787,7 +6862,7 @@ payback_refresh_serial_helper_cb (void *cls,
GNUNET_PQ_result_spec_uint64 ("payback_uuid",
&rowid),
TALER_PQ_result_spec_absolute_time ("timestamp",
- &timestamp),
+ &timestamp),
GNUNET_PQ_result_spec_auto_from_type ("old_coin_pub",
&old_coin_pub),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
@@ -6801,7 +6876,7 @@ payback_refresh_serial_helper_cb (void *cls,
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&coin.denom_pub_hash),
GNUNET_PQ_result_spec_rsa_public_key ("denom_pub",
- &denom_pub.rsa_public_key),
+ &denom_pub.rsa_public_key),
GNUNET_PQ_result_spec_rsa_signature ("denom_sig",
&coin.denom_sig.rsa_signature),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
@@ -6848,9 +6923,11 @@ payback_refresh_serial_helper_cb (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_select_payback_refresh_above_serial_id (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
+ struct TALER_EXCHANGEDB_Session
+ *session,
uint64_t serial_id,
- TALER_EXCHANGEDB_PaybackRefreshCallback cb,
+ TALER_EXCHANGEDB_PaybackRefreshCallback
+ cb,
void *cb_cls)
{
struct PostgresClosure *pg = cls;
@@ -6897,7 +6974,7 @@ struct ReserveClosedSerialContext
* Plugin's context.
*/
struct PostgresClosure *pg;
-
+
/**
* Status code, set to #GNUNET_SYSERR on hard errors.
*/
@@ -6920,8 +6997,8 @@ reserve_closed_serial_helper_cb (void *cls,
{
struct ReserveClosedSerialContext *rcsc = cls;
struct PostgresClosure *pg = rcsc->pg;
-
- for (unsigned int i=0;i<num_results;i++)
+
+ for (unsigned int i = 0; i<num_results; i++)
{
uint64_t rowid;
struct TALER_ReservePublicKeyP reserve_pub;
@@ -6936,7 +7013,7 @@ reserve_closed_serial_helper_cb (void *cls,
GNUNET_PQ_result_spec_auto_from_type ("reserve_pub",
&reserve_pub),
TALER_PQ_result_spec_absolute_time ("execution_date",
- &execution_date),
+ &execution_date),
GNUNET_PQ_result_spec_auto_from_type ("wtid",
&wtid),
GNUNET_PQ_result_spec_string ("receiver_account",
@@ -6986,11 +7063,13 @@ reserve_closed_serial_helper_cb (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_select_reserve_closed_above_serial_id (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
+ struct TALER_EXCHANGEDB_Session
+ *session,
uint64_t serial_id,
- TALER_EXCHANGEDB_ReserveClosedCallback cb,
+ TALER_EXCHANGEDB_ReserveClosedCallback
+ cb,
void *cb_cls)
-{
+{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&serial_id),
@@ -7035,10 +7114,13 @@ postgres_select_reserve_closed_above_serial_id (void *cls,
static enum GNUNET_DB_QueryStatus
postgres_insert_payback_request (void *cls,
struct TALER_EXCHANGEDB_Session *session,
- const struct TALER_ReservePublicKeyP *reserve_pub,
+ const struct
+ TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_CoinPublicInfo *coin,
- const struct TALER_CoinSpendSignatureP *coin_sig,
- const struct TALER_DenominationBlindingKeyP *coin_blind,
+ const struct
+ TALER_CoinSpendSignatureP *coin_sig,
+ const struct
+ TALER_DenominationBlindingKeyP *coin_blind,
const struct TALER_Amount *amount,
const struct GNUNET_HashCode *h_blind_ev,
struct GNUNET_TIME_Absolute timestamp)
@@ -7126,12 +7208,18 @@ postgres_insert_payback_request (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_insert_payback_refresh_request (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
- const struct TALER_CoinPublicInfo *coin,
- const struct TALER_CoinSpendSignatureP *coin_sig,
- const struct TALER_DenominationBlindingKeyP *coin_blind,
+ struct TALER_EXCHANGEDB_Session *
+ session,
+ const struct
+ TALER_CoinPublicInfo *coin,
+ const struct
+ TALER_CoinSpendSignatureP *coin_sig,
+ const struct
+ TALER_DenominationBlindingKeyP *
+ coin_blind,
const struct TALER_Amount *amount,
- const struct GNUNET_HashCode *h_blind_ev,
+ const struct
+ GNUNET_HashCode *h_blind_ev,
struct GNUNET_TIME_Absolute timestamp)
{
struct GNUNET_PQ_QueryParam params[] = {
@@ -7236,9 +7324,12 @@ postgres_get_old_coin_by_h_blind (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_insert_denomination_revocation (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
- const struct GNUNET_HashCode *denom_pub_hash,
- const struct TALER_MasterSignatureP *master_sig)
+ struct TALER_EXCHANGEDB_Session *
+ session,
+ const struct
+ GNUNET_HashCode *denom_pub_hash,
+ const struct
+ TALER_MasterSignatureP *master_sig)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (denom_pub_hash),
@@ -7266,7 +7357,8 @@ postgres_insert_denomination_revocation (void *cls,
static enum GNUNET_DB_QueryStatus
postgres_get_denomination_revocation (void *cls,
struct TALER_EXCHANGEDB_Session *session,
- const struct GNUNET_HashCode *denom_pub_hash,
+ const struct
+ GNUNET_HashCode *denom_pub_hash,
struct TALER_MasterSignatureP *master_sig,
uint64_t *rowid)
{
@@ -7306,7 +7398,7 @@ struct MissingWireContext
* Plugin context.
*/
struct PostgresClosure *pg;
-
+
/**
* Set to #GNUNET_SYSERR on error.
*/
@@ -7357,9 +7449,9 @@ missing_wire_cb (void *cls,
};
if (GNUNET_OK !=
- GNUNET_PQ_extract_result (result,
- rs,
- --num_results))
+ GNUNET_PQ_extract_result (result,
+ rs,
+ --num_results))
{
GNUNET_break (0);
mwc->status = GNUNET_SYSERR;
@@ -7405,7 +7497,7 @@ postgres_select_deposits_missing_wire (void *cls,
TALER_PQ_query_param_absolute_time (&end_date),
GNUNET_PQ_query_param_end
};
- struct MissingWireContext mwc = {
+ struct MissingWireContext mwc = {
.cb = cb,
.cb_cls = cb_cls,
.pg = pg,
@@ -7414,10 +7506,10 @@ postgres_select_deposits_missing_wire (void *cls,
enum GNUNET_DB_QueryStatus qs;
qs = GNUNET_PQ_eval_prepared_multi_select (session->conn,
- "deposits_get_overdue",
- params,
- &missing_wire_cb,
- &mwc);
+ "deposits_get_overdue",
+ params,
+ &missing_wire_cb,
+ &mwc);
if (GNUNET_OK != mwc.status)
return GNUNET_DB_STATUS_HARD_ERROR;
return qs;
@@ -7473,7 +7565,8 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
GNUNET_CONFIGURATION_get_value_time (cfg,
"exchangedb",
"IDLE_RESERVE_EXPIRATION_TIME",
- &pg->idle_reserve_expiration_time)) ||
+ &pg->idle_reserve_expiration_time))
+ ||
(GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg,
"exchangedb",
@@ -7512,7 +7605,8 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
plugin->iterate_denomination_info = &postgres_iterate_denomination_info;
plugin->reserve_get = &postgres_reserve_get;
plugin->reserves_in_insert = &postgres_reserves_in_insert;
- plugin->get_latest_reserve_in_reference = &postgres_get_latest_reserve_in_reference;
+ plugin->get_latest_reserve_in_reference =
+ &postgres_get_latest_reserve_in_reference;
plugin->get_withdraw_info = &postgres_get_withdraw_info;
plugin->insert_withdraw_info = &postgres_insert_withdraw_info;
plugin->get_reserve_history = &postgres_get_reserve_history;
@@ -7545,7 +7639,8 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
plugin->get_expired_reserves = &postgres_get_expired_reserves;
plugin->insert_reserve_closed = &postgres_insert_reserve_closed;
plugin->wire_prepare_data_insert = &postgres_wire_prepare_data_insert;
- plugin->wire_prepare_data_mark_finished = &postgres_wire_prepare_data_mark_finished;
+ plugin->wire_prepare_data_mark_finished =
+ &postgres_wire_prepare_data_mark_finished;
plugin->wire_prepare_data_get = &postgres_wire_prepare_data_get;
plugin->start_deferred_wire_out = &postgres_start_deferred_wire_out;
plugin->store_wire_transfer_out = &postgres_store_wire_transfer_out;
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index 5018ec63d..7033f728e 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -35,7 +35,7 @@ static int result;
*/
#define FAILIF(cond) \
do { \
- if (!(cond)){ break;} \
+ if (! (cond)) { break;} \
GNUNET_break (0); \
goto drop; \
} while (0)
@@ -136,7 +136,7 @@ test_wire_prepare (struct TALER_EXCHANGEDB_Session *session)
&dead_prepare_cb,
NULL));
return GNUNET_OK;
- drop:
+ drop:
return GNUNET_SYSERR;
}
@@ -171,7 +171,7 @@ check_reserve (struct TALER_EXCHANGEDB_Session *session,
FAILIF (0 != strcmp (currency, reserve.balance.currency));
return GNUNET_OK;
- drop:
+ drop:
return GNUNET_SYSERR;
}
@@ -238,16 +238,18 @@ create_denom_key_pair (unsigned int size,
GNUNET_TIME_round_abs (&now);
dki.issue.properties.start = GNUNET_TIME_absolute_hton (now);
dki.issue.properties.expire_withdraw = GNUNET_TIME_absolute_hton
- (GNUNET_TIME_absolute_add (now,
- GNUNET_TIME_UNIT_HOURS));
+ (GNUNET_TIME_absolute_add (now,
+ GNUNET_TIME_UNIT_HOURS));
dki.issue.properties.expire_deposit = GNUNET_TIME_absolute_hton
- (GNUNET_TIME_absolute_add
- (now,
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 2)));
+ (GNUNET_TIME_absolute_add
+ (now,
+ GNUNET_TIME_relative_multiply (
+ GNUNET_TIME_UNIT_HOURS, 2)));
dki.issue.properties.expire_legal = GNUNET_TIME_absolute_hton
- (GNUNET_TIME_absolute_add
- (now,
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 3)));
+ (GNUNET_TIME_absolute_add
+ (now,
+ GNUNET_TIME_relative_multiply (
+ GNUNET_TIME_UNIT_HOURS, 3)));
TALER_amount_hton (&dki.issue.properties.value, value);
TALER_amount_hton (&dki.issue.properties.fee_withdraw, fee_withdraw);
TALER_amount_hton (&dki.issue.properties.fee_deposit, fee_deposit);
@@ -256,15 +258,17 @@ create_denom_key_pair (unsigned int size,
GNUNET_CRYPTO_rsa_public_key_hash (dkp->pub.rsa_public_key,
&dki.issue.properties.denom_hash);
- dki.issue.properties.purpose.size = htonl (sizeof (struct TALER_DenominationKeyValidityPS));
- dki.issue.properties.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY);
+ dki.issue.properties.purpose.size = htonl (sizeof (struct
+ TALER_DenominationKeyValidityPS));
+ dki.issue.properties.purpose.purpose = htonl (
+ TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->insert_denomination_info (plugin->cls,
session,
&dki.denom_pub,
&dki.issue))
{
- GNUNET_break(0);
+ GNUNET_break (0);
destroy_denom_key_pair (dkp);
return NULL;
}
@@ -274,14 +278,14 @@ create_denom_key_pair (unsigned int size,
&dki.issue.properties.denom_hash,
&issue2))
{
- GNUNET_break(0);
+ GNUNET_break (0);
destroy_denom_key_pair (dkp);
return NULL;
}
if (0 != GNUNET_memcmp (&dki.issue,
&issue2))
{
- GNUNET_break(0);
+ GNUNET_break (0);
destroy_denom_key_pair (dkp);
return NULL;
}
@@ -358,7 +362,8 @@ never_called_cb (void *cls,
static void
check_refresh_reveal_cb (void *cls,
uint32_t num_newcoins,
- const struct TALER_EXCHANGEDB_RefreshRevealedCoin *rrcs,
+ const struct
+ TALER_EXCHANGEDB_RefreshRevealedCoin *rrcs,
unsigned int num_tprivs,
const struct TALER_TransferPrivateKeyP *tprivsr,
const struct TALER_TransferPublicKeyP *tpr)
@@ -366,7 +371,8 @@ check_refresh_reveal_cb (void *cls,
/* compare the refresh commit coin arrays */
for (unsigned int cnt = 0; cnt < num_newcoins; cnt++)
{
- const struct TALER_EXCHANGEDB_RefreshRevealedCoin *acoin = &revealed_coins[cnt];
+ const struct TALER_EXCHANGEDB_RefreshRevealedCoin *acoin =
+ &revealed_coins[cnt];
const struct TALER_EXCHANGEDB_RefreshRevealedCoin *bcoin = &rrcs[cnt];
GNUNET_assert (acoin->coin_ev_size == bcoin->coin_ev_size);
@@ -374,13 +380,15 @@ check_refresh_reveal_cb (void *cls,
GNUNET_memcmp (acoin->coin_ev,
bcoin->coin_ev));
GNUNET_assert (0 ==
- GNUNET_CRYPTO_rsa_public_key_cmp (acoin->denom_pub.rsa_public_key,
- bcoin->denom_pub.rsa_public_key));
+ GNUNET_CRYPTO_rsa_public_key_cmp (
+ acoin->denom_pub.rsa_public_key,
+ bcoin->denom_pub.
+ rsa_public_key));
}
- GNUNET_assert(0 == GNUNET_memcmp(&tpub, tpr));
- GNUNET_assert(0 == memcmp(tprivs, tprivsr,
- sizeof(struct TALER_TransferPrivateKeyP) *
- (TALER_CNC_KAPPA - 1)));
+ GNUNET_assert (0 == GNUNET_memcmp (&tpub, tpr));
+ GNUNET_assert (0 == memcmp (tprivs, tprivsr,
+ sizeof(struct TALER_TransferPrivateKeyP)
+ * (TALER_CNC_KAPPA - 1)));
}
@@ -448,15 +456,17 @@ handle_link_data_cb (void *cls,
int found;
found = GNUNET_NO;
- for (unsigned int cnt=0;cnt < MELT_NEW_COINS;cnt++)
+ for (unsigned int cnt = 0; cnt < MELT_NEW_COINS; cnt++)
{
GNUNET_assert (NULL != ldlp->ev_sig.rsa_signature);
if ( (0 ==
GNUNET_CRYPTO_rsa_public_key_cmp (ldlp->denom_pub.rsa_public_key,
- new_dkp[cnt]->pub.rsa_public_key)) &&
+ new_dkp[cnt]->pub.rsa_public_key))
+ &&
(0 ==
GNUNET_CRYPTO_rsa_signature_cmp (ldlp->ev_sig.rsa_signature,
- revealed_coins[cnt].coin_sig.rsa_signature)) )
+ revealed_coins[cnt].coin_sig.
+ rsa_signature)) )
{
found = GNUNET_YES;
break;
@@ -502,7 +512,7 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
&fee_withdraw,
&fee_deposit,
&fee_refresh,
- &fee_refund);
+ &fee_refund);
GNUNET_assert (NULL != dkp);
/* initialize refresh session melt data */
{
@@ -513,8 +523,8 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
sizeof (refresh_session.coin.coin_pub),
&hc);
refresh_session.coin.denom_sig.rsa_signature =
- GNUNET_CRYPTO_rsa_sign_fdh (dkp->priv.rsa_private_key,
- &hc);
+ GNUNET_CRYPTO_rsa_sign_fdh (dkp->priv.rsa_private_key,
+ &hc);
GNUNET_assert (NULL != refresh_session.coin.denom_sig.rsa_signature);
GNUNET_CRYPTO_rsa_public_key_hash (dkp->pub.rsa_public_key,
&refresh_session.coin.denom_pub_hash);
@@ -532,11 +542,11 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
session,
&refresh_session.coin));
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
- plugin->insert_melt (plugin->cls,
+ plugin->insert_melt (plugin->cls,
session,
&refresh_session));
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
- plugin->get_melt (plugin->cls,
+ plugin->get_melt (plugin->cls,
session,
&refresh_session.rc,
&ret_refresh_session));
@@ -548,29 +558,32 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
FAILIF (0 !=
TALER_amount_cmp (&fee_refresh,
&ret_refresh_session.melt_fee));
- FAILIF(0 !=
- GNUNET_memcmp(&refresh_session.rc, &ret_refresh_session.session.rc));
- FAILIF(0 != GNUNET_memcmp(&refresh_session.coin_sig,
- &ret_refresh_session.session.coin_sig));
FAILIF (0 !=
- GNUNET_CRYPTO_rsa_signature_cmp (refresh_session.coin.denom_sig.rsa_signature,
- ret_refresh_session.session.coin.denom_sig.rsa_signature));
+ GNUNET_memcmp (&refresh_session.rc, &ret_refresh_session.session.rc));
+ FAILIF (0 != GNUNET_memcmp (&refresh_session.coin_sig,
+ &ret_refresh_session.session.coin_sig));
+ FAILIF (0 !=
+ GNUNET_CRYPTO_rsa_signature_cmp (
+ refresh_session.coin.denom_sig.rsa_signature,
+ ret_refresh_session.session.coin.
+ denom_sig.rsa_signature));
FAILIF (0 != memcmp (&refresh_session.coin.coin_pub,
&ret_refresh_session.session.coin.coin_pub,
sizeof (refresh_session.coin.coin_pub)));
FAILIF (0 !=
GNUNET_memcmp (&refresh_session.coin.denom_pub_hash,
&ret_refresh_session.session.coin.denom_pub_hash));
- GNUNET_CRYPTO_rsa_signature_free (ret_refresh_session.session.coin.denom_sig.rsa_signature);
+ GNUNET_CRYPTO_rsa_signature_free (
+ ret_refresh_session.session.coin.denom_sig.rsa_signature);
/* test 'select_refreshs_above_serial_id' */
auditor_row_cnt = 0;
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
- plugin->select_refreshs_above_serial_id (plugin->cls,
- session,
- 0,
- &audit_refresh_session_cb,
- NULL));
+ plugin->select_refreshs_above_serial_id (plugin->cls,
+ session,
+ 0,
+ &audit_refresh_session_cb,
+ NULL));
FAILIF (1 != auditor_row_cnt);
new_dkp = GNUNET_new_array (MELT_NEW_COINS,
@@ -580,7 +593,7 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
revealed_coins
= GNUNET_new_array (MELT_NEW_COINS,
struct TALER_EXCHANGEDB_RefreshRevealedCoin);
- for (unsigned int cnt=0; cnt < MELT_NEW_COINS; cnt++)
+ for (unsigned int cnt = 0; cnt < MELT_NEW_COINS; cnt++)
{
struct TALER_EXCHANGEDB_RefreshRevealedCoin *ccoin;
struct GNUNET_HashCode hc;
@@ -595,12 +608,13 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
&fee_withdraw,
&fee_deposit,
&fee_refresh,
- &fee_refund);
+ &fee_refund);
GNUNET_assert (NULL != new_dkp[cnt]);
new_denom_pubs[cnt] = new_dkp[cnt]->pub;
ccoin = &revealed_coins[cnt];
- ccoin->coin_ev_size = (size_t) GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
- COIN_ENC_MAX_SIZE);
+ ccoin->coin_ev_size = (size_t) GNUNET_CRYPTO_random_u64 (
+ GNUNET_CRYPTO_QUALITY_WEAK,
+ COIN_ENC_MAX_SIZE);
ccoin->coin_ev = GNUNET_malloc (ccoin->coin_ev_size);
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
ccoin->coin_ev,
@@ -651,7 +665,7 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
session,
&refresh_session.coin.coin_pub,
GNUNET_YES,
- &tl);
+ &tl);
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs);
plugin->free_coin_transaction_list (plugin->cls,
tl);
@@ -659,20 +673,22 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
ret = GNUNET_OK;
- drop:
+ drop:
if (NULL != revealed_coins)
{
- for (unsigned int cnt=0; cnt < MELT_NEW_COINS; cnt++)
+ for (unsigned int cnt = 0; cnt < MELT_NEW_COINS; cnt++)
{
if (NULL != revealed_coins[cnt].coin_sig.rsa_signature)
- GNUNET_CRYPTO_rsa_signature_free (revealed_coins[cnt].coin_sig.rsa_signature);
+ GNUNET_CRYPTO_rsa_signature_free (
+ revealed_coins[cnt].coin_sig.rsa_signature);
GNUNET_free (revealed_coins[cnt].coin_ev);
}
GNUNET_free (revealed_coins);
revealed_coins = NULL;
}
destroy_denom_key_pair (dkp);
- GNUNET_CRYPTO_rsa_signature_free (refresh_session.coin.denom_sig.rsa_signature);
+ GNUNET_CRYPTO_rsa_signature_free (
+ refresh_session.coin.denom_sig.rsa_signature);
GNUNET_free_non_null (new_denom_pubs);
for (unsigned int cnt = 0;
(NULL != new_dkp) && (cnt < MELT_NEW_COINS) && (NULL != new_dkp[cnt]);
@@ -1000,8 +1016,9 @@ test_gc (struct TALER_EXCHANGEDB_Session *session)
now = GNUNET_TIME_absolute_get ();
GNUNET_TIME_round_abs (&now);
past = GNUNET_TIME_absolute_subtract (now,
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS,
- 4));
+ GNUNET_TIME_relative_multiply (
+ GNUNET_TIME_UNIT_HOURS,
+ 4));
dkp = create_denom_key_pair (1024,
session,
past,
@@ -1014,12 +1031,12 @@ test_gc (struct TALER_EXCHANGEDB_Session *session)
if (GNUNET_OK !=
plugin->gc (plugin->cls))
{
- GNUNET_break(0);
+ GNUNET_break (0);
destroy_denom_key_pair (dkp);
return GNUNET_SYSERR;
}
- GNUNET_CRYPTO_rsa_public_key_hash (dkp->pub.rsa_public_key,
- &denom_hash);
+ GNUNET_CRYPTO_rsa_public_key_hash (dkp->pub.rsa_public_key,
+ &denom_hash);
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
plugin->get_denomination_info (plugin->cls,
@@ -1027,7 +1044,7 @@ test_gc (struct TALER_EXCHANGEDB_Session *session)
&denom_hash,
&issue2))
{
- GNUNET_break(0);
+ GNUNET_break (0);
destroy_denom_key_pair (dkp);
return GNUNET_SYSERR;
}
@@ -1076,7 +1093,7 @@ test_wire_fees (struct TALER_EXCHANGEDB_Session *session)
start_date,
end_date,
&wire_fee,
- &closing_fee,
+ &closing_fee,
&master_sig))
{
GNUNET_break (0);
@@ -1089,7 +1106,7 @@ test_wire_fees (struct TALER_EXCHANGEDB_Session *session)
start_date,
end_date,
&wire_fee,
- &closing_fee,
+ &closing_fee,
&master_sig))
{
GNUNET_break (0);
@@ -1105,7 +1122,7 @@ test_wire_fees (struct TALER_EXCHANGEDB_Session *session)
&sd,
&ed,
&fee,
- &fee2,
+ &fee2,
&ms))
{
GNUNET_break (0);
@@ -1119,7 +1136,7 @@ test_wire_fees (struct TALER_EXCHANGEDB_Session *session)
&sd,
&ed,
&fee,
- &fee2,
+ &fee2,
&ms))
{
GNUNET_break (0);
@@ -1141,7 +1158,7 @@ test_wire_fees (struct TALER_EXCHANGEDB_Session *session)
}
-static struct TALER_Amount wire_out_amount;
+static struct TALER_Amount wire_out_amount;
/**
@@ -1248,7 +1265,8 @@ test_wire_out (struct TALER_EXCHANGEDB_Session *session,
json_t *wire_out_account;
wire_out_account = json_pack ("{s:s,s:s}",
- "url", "payto://x-taler-bank/localhost:8080/1",
+ "url",
+ "payto://x-taler-bank/localhost:8080/1",
"salt", "this-is-my-salt");
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->store_wire_transfer_out (plugin->cls,
@@ -1293,7 +1311,7 @@ test_wire_out (struct TALER_EXCHANGEDB_Session *session,
FAILIF (1 != auditor_row_cnt);
return GNUNET_OK;
- drop:
+ drop:
return GNUNET_SYSERR;
}
@@ -1327,7 +1345,7 @@ payback_cb (void *cls,
FAILIF (0 != GNUNET_memcmp (cb,
coin_blind));
return GNUNET_OK;
- drop:
+ drop:
return GNUNET_SYSERR;
}
@@ -1412,12 +1430,12 @@ wire_missing_cb (void *cls,
*/
static int
check_refund_cb (void *cls,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
- const struct TALER_MerchantSignatureP *merchant_sig,
- const struct GNUNET_HashCode *h_contract,
- uint64_t rtransaction_id,
- const struct TALER_Amount *amount_with_fee,
- const struct TALER_Amount *refund_fee)
+ const struct TALER_MerchantPublicKeyP *merchant_pub,
+ const struct TALER_MerchantSignatureP *merchant_sig,
+ const struct GNUNET_HashCode *h_contract,
+ uint64_t rtransaction_id,
+ const struct TALER_Amount *amount_with_fee,
+ const struct TALER_Amount *refund_fee)
{
const struct TALER_EXCHANGEDB_Refund *refund = cls;
@@ -1445,13 +1463,13 @@ check_refund_cb (void *cls,
result = 66;
}
if (0 != TALER_amount_cmp (amount_with_fee,
- &refund->refund_amount))
+ &refund->refund_amount))
{
GNUNET_break (0);
result = 66;
}
if (0 != TALER_amount_cmp (refund_fee,
- &refund->refund_fee))
+ &refund->refund_fee))
{
GNUNET_break (0);
result = 66;
@@ -1601,7 +1619,7 @@ run (void *cls)
&reserve_pub,
&value,
now,
- sndr,
+ sndr,
"account-1",
"TEST2",
5));
@@ -1637,12 +1655,12 @@ run (void *cls)
&fee_withdraw,
&fee_deposit,
&fee_refresh,
- &fee_refund);
+ &fee_refund);
GNUNET_assert (NULL != dkp);
GNUNET_CRYPTO_rsa_public_key_hash (dkp->pub.rsa_public_key,
&dkp_pub_hash);
- RND_BLK(&cbc.h_coin_envelope);
- RND_BLK(&cbc.reserve_sig);
+ RND_BLK (&cbc.h_coin_envelope);
+ RND_BLK (&cbc.reserve_sig);
cbc.denom_pub_hash = dkp_pub_hash;
cbc.sig.rsa_signature
= GNUNET_CRYPTO_rsa_sign_fdh (dkp->priv.rsa_private_key,
@@ -1675,8 +1693,8 @@ run (void *cls)
session,
&cbc.h_coin_envelope,
&cbc2));
- FAILIF(0 != GNUNET_memcmp(&cbc2.reserve_sig, &cbc.reserve_sig));
- FAILIF(0 != GNUNET_memcmp(&cbc2.reserve_pub, &cbc.reserve_pub));
+ FAILIF (0 != GNUNET_memcmp (&cbc2.reserve_sig, &cbc.reserve_sig));
+ FAILIF (0 != GNUNET_memcmp (&cbc2.reserve_pub, &cbc.reserve_pub));
result = 6;
FAILIF (GNUNET_OK !=
GNUNET_CRYPTO_rsa_verify (&cbc.h_coin_envelope,
@@ -1714,39 +1732,39 @@ run (void *cls)
&coin_blind));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_add (&amount_with_fee,
- &value,
- &value));
+ TALER_amount_add (&amount_with_fee,
+ &value,
+ &value));
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (CURRENCY ":0.000010",
&fee_closing));
now = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&now);
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
- plugin->insert_reserve_closed (plugin->cls,
- session,
- &reserve_pub,
- now,
- sndr,
- &wire_out_wtid,
- &amount_with_fee,
- &fee_closing));
+ plugin->insert_reserve_closed (plugin->cls,
+ session,
+ &reserve_pub,
+ now,
+ sndr,
+ &wire_out_wtid,
+ &amount_with_fee,
+ &fee_closing));
FAILIF (GNUNET_OK !=
check_reserve (session,
&reserve_pub,
- 0,
- 0,
+ 0,
+ 0,
value.currency));
result = 7;
qs = plugin->get_reserve_history (plugin->cls,
session,
&reserve_pub,
- &rh);
+ &rh);
FAILIF (0 > qs);
FAILIF (NULL == rh);
rh_head = rh;
- for (cnt=0; NULL != rh_head; rh_head=rh_head->next, cnt++)
+ for (cnt = 0; NULL != rh_head; rh_head = rh_head->next, cnt++)
{
switch (rh_head->type)
{
@@ -1793,7 +1811,7 @@ run (void *cls)
case TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK:
{
struct TALER_EXCHANGEDB_ClosingTransfer *closing
- = rh_head->details.closing;
+ = rh_head->details.closing;
FAILIF (0 != memcmp (&closing->reserve_pub,
&reserve_pub,
@@ -1811,16 +1829,16 @@ run (void *cls)
auditor_row_cnt = 0;
FAILIF (0 >=
plugin->select_reserves_in_above_serial_id (plugin->cls,
- session,
- 0,
- &audit_reserve_in_cb,
- NULL));
+ session,
+ 0,
+ &audit_reserve_in_cb,
+ NULL));
FAILIF (0 >=
plugin->select_reserves_out_above_serial_id (plugin->cls,
- session,
- 0,
- &audit_reserve_out_cb,
- NULL));
+ session,
+ 0,
+ &audit_reserve_out_cb,
+ NULL));
FAILIF (3 != auditor_row_cnt);
/* Tests for deposits */
@@ -1877,10 +1895,10 @@ run (void *cls)
auditor_row_cnt = 0;
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->select_deposits_above_serial_id (plugin->cls,
- session,
- 0,
- &audit_deposit_cb,
- NULL));
+ session,
+ 0,
+ &audit_deposit_cb,
+ NULL));
FAILIF (1 != auditor_row_cnt);
result = 9;
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
@@ -1906,7 +1924,7 @@ run (void *cls)
"test-2"));
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->mark_deposit_tiny (plugin->cls,
- session,
+ session,
deposit_rowid));
FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
plugin->get_ready_deposit (plugin->cls,
@@ -1960,7 +1978,7 @@ run (void *cls)
&deposit2,
GNUNET_YES));
FAILIF (GNUNET_OK !=
- test_melting (session));
+ test_melting (session));
FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
plugin->commit (plugin->cls,
session));
@@ -1972,7 +1990,7 @@ run (void *cls)
RND_BLK (&refund.merchant_sig);
refund.h_contract_terms = deposit.h_contract_terms;
refund.rtransaction_id = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
- UINT64_MAX);
+ UINT64_MAX);
refund.refund_amount = deposit.amount_with_fee;
refund.refund_fee = fee_refund;
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
@@ -1980,11 +1998,11 @@ run (void *cls)
session,
&refund));
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
- plugin->select_refunds_by_coin (plugin->cls,
- session,
- &refund.coin.coin_pub,
- &check_refund_cb,
- &refund));
+ plugin->select_refunds_by_coin (plugin->cls,
+ session,
+ &refund.coin.coin_pub,
+ &check_refund_cb,
+ &refund));
/* test payback / revocation */
RND_BLK (&master_sig);
@@ -2024,7 +2042,7 @@ run (void *cls)
session,
&dkp_pub_hash,
&msig,
- &rev_rowid));
+ &rev_rowid));
FAILIF (0 != GNUNET_memcmp (&msig,
&master_sig));
}
@@ -2046,17 +2064,17 @@ run (void *cls)
auditor_row_cnt = 0;
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->select_refunds_above_serial_id (plugin->cls,
- session,
- 0,
- &audit_refund_cb,
- NULL));
+ session,
+ 0,
+ &audit_refund_cb,
+ NULL));
FAILIF (1 != auditor_row_cnt);
qs = plugin->get_coin_transactions (plugin->cls,
session,
&refund.coin.coin_pub,
GNUNET_YES,
- &tl);
+ &tl);
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs);
GNUNET_assert (NULL != tl);
matched = 0;
@@ -2088,8 +2106,10 @@ run (void *cls)
sizeof (struct GNUNET_HashCode)));
/* Note: not comparing 'wire', seems truly redundant and would be tricky */
FAILIF (have->timestamp.abs_value_us != deposit.timestamp.abs_value_us);
- FAILIF (have->refund_deadline.abs_value_us != deposit.refund_deadline.abs_value_us);
- FAILIF (have->wire_deadline.abs_value_us != deposit.wire_deadline.abs_value_us);
+ FAILIF (have->refund_deadline.abs_value_us !=
+ deposit.refund_deadline.abs_value_us);
+ FAILIF (have->wire_deadline.abs_value_us !=
+ deposit.wire_deadline.abs_value_us);
FAILIF (0 != TALER_amount_cmp (&have->amount_with_fee,
&deposit.amount_with_fee));
FAILIF (0 != TALER_amount_cmp (&have->deposit_fee,
@@ -2098,7 +2118,7 @@ run (void *cls)
break;
}
#if 0
- /* this coin pub was actually never melted... */
+ /* this coin pub was actually never melted... */
case TALER_EXCHANGEDB_TT_REFRESH_MELT:
FAILIF (0 != memcmp (&melt,
&tlp->details.melt,
@@ -2175,7 +2195,7 @@ run (void *cls)
result = 0;
- drop:
+ drop:
if ( (0 != result) &&
(NULL != session) )
plugin->rollback (plugin->cls,
@@ -2220,10 +2240,10 @@ main (int argc,
plugin_name++;
(void) GNUNET_asprintf (&testname,
"test-exchange-db-%s",
- plugin_name);
+ plugin_name);
(void) GNUNET_asprintf (&config_filename,
"%s.conf",
- testname);
+ testname);
cfg = GNUNET_CONFIGURATION_create ();
if (GNUNET_OK !=
GNUNET_CONFIGURATION_parse (cfg,
@@ -2235,7 +2255,7 @@ main (int argc,
return 2;
}
GNUNET_SCHEDULER_run (&run,
- cfg);
+ cfg);
GNUNET_CONFIGURATION_destroy (cfg);
GNUNET_free (config_filename);
GNUNET_free (testname);
diff --git a/src/exchangedb/test_exchangedb_auditors.c b/src/exchangedb/test_exchangedb_auditors.c
index 9424919c4..4c50d09ab 100644
--- a/src/exchangedb/test_exchangedb_auditors.c
+++ b/src/exchangedb/test_exchangedb_auditors.c
@@ -156,7 +156,7 @@ main (int argc,
&auditor_cb,
NULL));
ret = 0;
- EXITIF_exit:
+ EXITIF_exit:
if (NULL != tmpdir)
{
(void) GNUNET_DISK_directory_remove (tmpdir);
diff --git a/src/exchangedb/test_exchangedb_denomkeys.c b/src/exchangedb/test_exchangedb_denomkeys.c
index a8e7af04d..8b0c9c04e 100644
--- a/src/exchangedb/test_exchangedb_denomkeys.c
+++ b/src/exchangedb/test_exchangedb_denomkeys.c
@@ -140,13 +140,15 @@ main (int argc,
GNUNET_free (pk);
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
&dki.issue,
- sizeof (struct TALER_EXCHANGEDB_DenominationKeyInformationP));
+ sizeof (struct
+ TALER_EXCHANGEDB_DenominationKeyInformationP));
dki.denom_priv.rsa_private_key
= GNUNET_CRYPTO_rsa_private_key_create (RSA_KEY_SIZE);
dki.denom_pub.rsa_public_key
= GNUNET_CRYPTO_rsa_private_key_get_public (dki.denom_priv.rsa_private_key);
- enc_size = GNUNET_CRYPTO_rsa_private_key_encode (dki.denom_priv.rsa_private_key,
- &enc);
+ enc_size = GNUNET_CRYPTO_rsa_private_key_encode (
+ dki.denom_priv.rsa_private_key,
+ &enc);
EXITIF (NULL == (tmpdir = GNUNET_DISK_mkdtemp ("test_exchangedb_dki")));
start = GNUNET_TIME_absolute_ntoh (dki.issue.properties.start);
GNUNET_asprintf (&tmpfile,
@@ -172,24 +174,26 @@ main (int argc,
EXITIF (GNUNET_OK !=
TALER_EXCHANGEDB_denomination_key_revoke (revdir,
- &dki.issue.properties.denom_hash,
+ &dki.issue.properties.
+ denom_hash,
&master_priv));
EXITIF (1 !=
TALER_EXCHANGEDB_revocations_iterate (revdir,
- &master_pub,
- &dki_iter_revoked,
- &dki));
+ &master_pub,
+ &dki_iter_revoked,
+ &dki));
GNUNET_free (revdir);
- enc_read_size = GNUNET_CRYPTO_rsa_private_key_encode (dki_read.denom_priv.rsa_private_key,
- &enc_read);
+ enc_read_size = GNUNET_CRYPTO_rsa_private_key_encode (
+ dki_read.denom_priv.rsa_private_key,
+ &enc_read);
EXITIF (enc_size != enc_read_size);
EXITIF (0 != memcmp (enc,
enc_read,
enc_size));
ret = 0;
- EXITIF_exit:
+ EXITIF_exit:
GNUNET_free_non_null (enc);
GNUNET_free_non_null (tmpfile);
if (NULL != tmpdir)
diff --git a/src/exchangedb/test_exchangedb_signkeys.c b/src/exchangedb/test_exchangedb_signkeys.c
index 9ff423082..99d65e26f 100644
--- a/src/exchangedb/test_exchangedb_signkeys.c
+++ b/src/exchangedb/test_exchangedb_signkeys.c
@@ -73,7 +73,8 @@ main (int argc,
NULL);
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
&ski,
- sizeof (struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP));
+ sizeof (struct
+ TALER_EXCHANGEDB_PrivateSigningKeyInformationP));
now = GNUNET_TIME_absolute_get ();
EXITIF (NULL == (tmpfile = GNUNET_DISK_mkdtemp ("test_exchangedb_ski")));
EXITIF (GNUNET_OK !=
@@ -85,7 +86,7 @@ main (int argc,
&ski_iter,
&ski));
ret = 0;
- EXITIF_exit:
+ EXITIF_exit:
if (NULL != tmpfile)
{
(void) GNUNET_DISK_directory_remove (tmpfile);
diff --git a/src/exchangedb/test_perf_taler_exchangedb.c b/src/exchangedb/test_perf_taler_exchangedb.c
index 0f93c7089..ad8e630d4 100644
--- a/src/exchangedb/test_perf_taler_exchangedb.c
+++ b/src/exchangedb/test_perf_taler_exchangedb.c
@@ -52,7 +52,7 @@ test_allocate ()
dki = PERF_TALER_EXCHANGEDB_denomination_init ();
reserve = PERF_TALER_EXCHANGEDB_reserve_init ();
coin = PERF_TALER_EXCHANGEDB_coin_init (dki,
- reserve);
+ reserve);
deposit = PERF_TALER_EXCHANGEDB_deposit_init (coin);
dki_copy = PERF_TALER_EXCHANGEDB_denomination_copy (dki);
@@ -76,99 +76,100 @@ test_allocate ()
* and logs the results using Gauger
*/
int
-main (int argc, char ** argv)
+main (int argc, char **argv)
{
int ret = 0;
- struct PERF_TALER_EXCHANGEDB_Cmd init[] =
- {
+ struct PERF_TALER_EXCHANGEDB_Cmd init[] = {
PERF_TALER_EXCHANGEDB_INIT_CMD_END ("init")
};
- struct PERF_TALER_EXCHANGEDB_Cmd benchmark[] =
- {
+ struct PERF_TALER_EXCHANGEDB_Cmd benchmark[] = {
// Denomination used to create coins
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("00 - Start of interpreter"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("01 - denomination loop",
- NB_DENOMINATION_INIT),
+ NB_DENOMINATION_INIT),
PERF_TALER_EXCHANGEDB_INIT_CMD_START_TRANSACTION ("01 - start transaction"),
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_DENOMINATION ("01 - denomination"),
PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_DENOMINATION ("01 - insert",
- "01 - denomination"),
- PERF_TALER_EXCHANGEDB_INIT_CMD_COMMIT_TRANSACTION ("01 - commit transaction"),
+ "01 - denomination"),
+ PERF_TALER_EXCHANGEDB_INIT_CMD_COMMIT_TRANSACTION (
+ "01 - commit transaction"),
PERF_TALER_EXCHANGEDB_INIT_CMD_SAVE_ARRAY ("01 - save denomination",
- "01 - denomination loop",
- "01 - denomination",
- NB_DENOMINATION_SAVE),
+ "01 - denomination loop",
+ "01 - denomination",
+ NB_DENOMINATION_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("01 - denomination loop end",
- "01 - denomination loop"),
+ "01 - denomination loop"),
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("01 - init denomination complete"),
// End of initialization
// Reserve initialization
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("02 - init reserve loop",
- NB_RESERVE_INIT),
+ NB_RESERVE_INIT),
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_RESERVE ("02 - reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_RESERVE ("02 - insert",
- "02 - reserve"),
+ "02 - reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_SAVE_ARRAY ("02 - save reserve",
- "02 - init reserve loop",
- "02 - reserve",
- NB_RESERVE_SAVE),
+ "02 - init reserve loop",
+ "02 - reserve",
+ NB_RESERVE_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("02 - init reserve end loop",
- "02 - init reserve loop"),
+ "02 - init reserve loop"),
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("02 - reserve init complete"),
// End reserve init
// Withdrawal initialization
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("03 - init withdraw loop",
- NB_WITHDRAW_INIT),
+ NB_WITHDRAW_INIT),
PERF_TALER_EXCHANGEDB_INIT_CMD_START_TRANSACTION ("03 - start transaction"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("03 - denomination load",
- "03 - init withdraw loop",
- "01 - save denomination"),
+ "03 - init withdraw loop",
+ "01 - save denomination"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("03 - reserve load",
- "03 - init withdraw loop",
- "02 - save reserve"),
+ "03 - init withdraw loop",
+ "02 - save reserve"),
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_WITHDRAW ("03 - withdraw",
- "03 - denomination load",
- "03 - reserve load"),
+ "03 - denomination load",
+ "03 - reserve load"),
PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_WITHDRAW ("03 - insert withdraw",
- "03 - withdraw"),
- PERF_TALER_EXCHANGEDB_INIT_CMD_COMMIT_TRANSACTION ("03 - commit transaction"),
+ "03 - withdraw"),
+ PERF_TALER_EXCHANGEDB_INIT_CMD_COMMIT_TRANSACTION (
+ "03 - commit transaction"),
PERF_TALER_EXCHANGEDB_INIT_CMD_SAVE_ARRAY ("03 - coin array",
- "03 - init withdraw loop",
- "03 - withdraw",
- NB_WITHDRAW_SAVE),
+ "03 - init withdraw loop",
+ "03 - withdraw",
+ NB_WITHDRAW_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("03 - withdraw init end loop",
- "03 - init withdraw loop"),
+ "03 - init withdraw loop"),
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("03 - withdraw init complete"),
- //End of withdrawal initialization
- //Deposit initialization
+ // End of withdrawal initialization
+ // Deposit initialization
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("04 - time start"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP ("04 - deposit init loop",
- NB_DEPOSIT_INIT),
+ NB_DEPOSIT_INIT),
PERF_TALER_EXCHANGEDB_INIT_CMD_START_TRANSACTION ("04 - start transaction"),
PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY ("04 - coin load",
- "04 - deposit init loop",
- "03 - coin array"),
+ "04 - deposit init loop",
+ "03 - coin array"),
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_DEPOSIT ("04 - deposit",
- "04 - coin load"),
+ "04 - coin load"),
PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_DEPOSIT ("04 - insert deposit",
- "04 - deposit"),
- PERF_TALER_EXCHANGEDB_INIT_CMD_COMMIT_TRANSACTION ("04 - commit transaction"),
+ "04 - deposit"),
+ PERF_TALER_EXCHANGEDB_INIT_CMD_COMMIT_TRANSACTION (
+ "04 - commit transaction"),
PERF_TALER_EXCHANGEDB_INIT_CMD_SAVE_ARRAY ("04 - deposit array",
- "04 - deposit init loop",
- "04 - deposit",
- NB_DEPOSIT_SAVE),
+ "04 - deposit init loop",
+ "04 - deposit",
+ NB_DEPOSIT_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP ("04 - deposit init loop end",
- "04 - deposit init loop"),
+ "04 - deposit init loop"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME ("04 - time stop"),
PERF_TALER_EXCHANGEDB_INIT_CMD_GAUGER ("04 - gauger",
- "04 - time start",
- "04 - time stop",
- "TEST",
- "time to insert a deposit",
- "deposit/sec",
- NB_DEPOSIT_SAVE),
+ "04 - time start",
+ "04 - time stop",
+ "TEST",
+ "time to insert a deposit",
+ "deposit/sec",
+ NB_DEPOSIT_SAVE),
PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG ("04 - deposit init complete"),
// End of deposit initialization
PERF_TALER_EXCHANGEDB_INIT_CMD_END ("end"),