aboutsummaryrefslogtreecommitdiff
path: root/src/auditordb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-03-15 13:12:45 +0100
committerChristian Grothoff <christian@grothoff.org>2017-03-15 13:12:45 +0100
commita3db0d4a8c779609137e048bd6ee7c7e4a34901c (patch)
treeed43eedb55e21c42882a9158541c993457ccd345 /src/auditordb
parentaf5810ccae377ae08b9bdcc11914114d1614c58a (diff)
introduce 'struct TALER_AUDITORDB_ProgressPoint'
Diffstat (limited to 'src/auditordb')
-rw-r--r--src/auditordb/plugin_auditordb_postgres.c180
-rw-r--r--src/auditordb/test_auditordb.c137
2 files changed, 102 insertions, 215 deletions
diff --git a/src/auditordb/plugin_auditordb_postgres.c b/src/auditordb/plugin_auditordb_postgres.c
index 65da0bf18..989e54aea 100644
--- a/src/auditordb/plugin_auditordb_postgres.c
+++ b/src/auditordb/plugin_auditordb_postgres.c
@@ -1199,18 +1199,15 @@ postgres_insert_denomination_info (void *cls,
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&issue->denom_hash),
GNUNET_PQ_query_param_auto_from_type (&issue->master),
-
GNUNET_PQ_query_param_auto_from_type (&issue->start),
GNUNET_PQ_query_param_auto_from_type (&issue->expire_withdraw),
GNUNET_PQ_query_param_auto_from_type (&issue->expire_deposit),
GNUNET_PQ_query_param_auto_from_type (&issue->expire_legal),
-
TALER_PQ_query_param_amount_nbo (&issue->value),
TALER_PQ_query_param_amount_nbo (&issue->fee_withdraw),
TALER_PQ_query_param_amount_nbo (&issue->fee_deposit),
TALER_PQ_query_param_amount_nbo (&issue->fee_refresh),
TALER_PQ_query_param_amount_nbo (&issue->fee_refund),
-
GNUNET_PQ_query_param_end
};
@@ -1264,7 +1261,6 @@ postgres_select_denomination_info (void *cls,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
GNUNET_PQ_query_param_end
};
PGresult *result;
@@ -1294,18 +1290,15 @@ postgres_select_denomination_info (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", &issue.denom_hash),
-
GNUNET_PQ_result_spec_auto_from_type ("valid_from", &issue.start),
GNUNET_PQ_result_spec_auto_from_type ("expire_withdraw", &issue.expire_withdraw),
GNUNET_PQ_result_spec_auto_from_type ("expire_deposit", &issue.expire_deposit),
GNUNET_PQ_result_spec_auto_from_type ("expire_legal", &issue.expire_legal),
-
TALER_PQ_result_spec_amount_nbo ("coin", &issue.value),
TALER_PQ_result_spec_amount_nbo ("fee_withdraw", &issue.fee_withdraw),
TALER_PQ_result_spec_amount_nbo ("fee_deposit", &issue.fee_deposit),
TALER_PQ_result_spec_amount_nbo ("fee_refresh", &issue.fee_refresh),
TALER_PQ_result_spec_amount_nbo ("fee_refund", &issue.fee_refund),
-
GNUNET_PQ_result_spec_end
};
if (GNUNET_OK !=
@@ -1338,39 +1331,27 @@ postgres_select_denomination_info (void *cls,
* @param cls the @e cls of this struct with the plugin-specific state
* @param session connection to use
* @param master_pub master key of the exchange
- * @param last_reserve_in_serial_id serial ID of the last reserve_in transfer the auditor processed
- * @param last_reserve_out_serial_id serial ID of the last withdraw the auditor processed
- * @param last_deposit_serial_id serial ID of the last deposit the auditor processed
- * @param last_melt_serial_id serial ID of the last refresh the auditor processed
- * @param last_prewire_serial_id serial ID of the last prewire transfer the auditor processed
+ * @param pp where is the auditor in processing
* @return #GNUNET_OK on success; #GNUNET_SYSERR on failure
*/
int
postgres_insert_auditor_progress (void *cls,
struct TALER_AUDITORDB_Session *session,
const struct TALER_MasterPublicKeyP *master_pub,
- uint64_t last_reserve_in_serial_id,
- uint64_t last_reserve_out_serial_id,
- uint64_t last_deposit_serial_id,
- uint64_t last_melt_serial_id,
- uint64_t last_refund_serial_id,
- uint64_t last_prewire_serial_id)
+ const struct TALER_AUDITORDB_ProgressPoint *pp)
{
PGresult *result;
- int ret;
-
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
- GNUNET_PQ_query_param_uint64 (&last_reserve_in_serial_id),
- GNUNET_PQ_query_param_uint64 (&last_reserve_out_serial_id),
- GNUNET_PQ_query_param_uint64 (&last_deposit_serial_id),
- GNUNET_PQ_query_param_uint64 (&last_melt_serial_id),
- GNUNET_PQ_query_param_uint64 (&last_refund_serial_id),
- GNUNET_PQ_query_param_uint64 (&last_prewire_serial_id),
-
+ GNUNET_PQ_query_param_uint64 (&pp->last_reserve_in_serial_id),
+ GNUNET_PQ_query_param_uint64 (&pp->last_reserve_out_serial_id),
+ GNUNET_PQ_query_param_uint64 (&pp->last_deposit_serial_id),
+ GNUNET_PQ_query_param_uint64 (&pp->last_melt_serial_id),
+ GNUNET_PQ_query_param_uint64 (&pp->last_refund_serial_id),
+ GNUNET_PQ_query_param_uint64 (&pp->last_prewire_serial_id),
GNUNET_PQ_query_param_end
};
+ int ret;
result = GNUNET_PQ_exec_prepared (session->conn,
"auditor_progress_insert",
@@ -1396,39 +1377,27 @@ postgres_insert_auditor_progress (void *cls,
* @param cls the @e cls of this struct with the plugin-specific state
* @param session connection to use
* @param master_pub master key of the exchange
- * @param last_reserve_in_serial_id serial ID of the last reserve_in transfer the auditor processed
- * @param last_reserve_out_serial_id serial ID of the last withdraw the auditor processed
- * @param last_deposit_serial_id serial ID of the last deposit the auditor processed
- * @param last_melt_serial_id serial ID of the last refresh the auditor processed
- * @param last_prewire_serial_id serial ID of the last prewire transfer the auditor processed
+ * @param pp where is the auditor in processing
* @return #GNUNET_OK on success; #GNUNET_SYSERR on failure
*/
int
postgres_update_auditor_progress (void *cls,
struct TALER_AUDITORDB_Session *session,
const struct TALER_MasterPublicKeyP *master_pub,
- uint64_t last_reserve_in_serial_id,
- uint64_t last_reserve_out_serial_id,
- uint64_t last_deposit_serial_id,
- uint64_t last_melt_serial_id,
- uint64_t last_refund_serial_id,
- uint64_t last_prewire_serial_id)
+ const struct TALER_AUDITORDB_ProgressPoint *pp)
{
PGresult *result;
- int ret;
-
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_uint64 (&last_reserve_in_serial_id),
- GNUNET_PQ_query_param_uint64 (&last_reserve_out_serial_id),
- GNUNET_PQ_query_param_uint64 (&last_deposit_serial_id),
- GNUNET_PQ_query_param_uint64 (&last_melt_serial_id),
- GNUNET_PQ_query_param_uint64 (&last_refund_serial_id),
- GNUNET_PQ_query_param_uint64 (&last_prewire_serial_id),
-
+ GNUNET_PQ_query_param_uint64 (&pp->last_reserve_in_serial_id),
+ GNUNET_PQ_query_param_uint64 (&pp->last_reserve_out_serial_id),
+ GNUNET_PQ_query_param_uint64 (&pp->last_deposit_serial_id),
+ GNUNET_PQ_query_param_uint64 (&pp->last_melt_serial_id),
+ GNUNET_PQ_query_param_uint64 (&pp->last_refund_serial_id),
+ GNUNET_PQ_query_param_uint64 (&pp->last_prewire_serial_id),
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
GNUNET_PQ_query_param_end
};
+ int ret;
result = GNUNET_PQ_exec_prepared (session->conn,
"auditor_progress_update",
@@ -1453,11 +1422,7 @@ postgres_update_auditor_progress (void *cls,
* @param cls the @e cls of this struct with the plugin-specific state
* @param session connection to use
* @param master_pub master key of the exchange
- * @param[out] last_reserve_in_serial_id serial ID of the last reserve_in transfer the auditor processed
- * @param[out] last_reserve_out_serial_id serial ID of the last withdraw the auditor processed
- * @param[out] last_deposit_serial_id serial ID of the last deposit the auditor processed
- * @param[out] last_melt_serial_id serial ID of the last refresh the auditor processed
- * @param[out] last_prewire_serial_id serial ID of the last prewire transfer the auditor processed
+ * @param[out] pp set to where the auditor is in processing
* @return #GNUNET_OK on success; #GNUNET_SYSERR on failure;
* #GNUNET_NO if we have no records for the @a master_pub
*/
@@ -1465,19 +1430,23 @@ int
postgres_get_auditor_progress (void *cls,
struct TALER_AUDITORDB_Session *session,
const struct TALER_MasterPublicKeyP *master_pub,
- uint64_t *last_reserve_in_serial_id,
- uint64_t *last_reserve_out_serial_id,
- uint64_t *last_deposit_serial_id,
- uint64_t *last_melt_serial_id,
- uint64_t *last_refund_serial_id,
- uint64_t *last_prewire_serial_id)
+ struct TALER_AUDITORDB_ProgressPoint *pp)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
GNUNET_PQ_query_param_end
};
PGresult *result;
+ struct GNUNET_PQ_ResultSpec rs[] = {
+ GNUNET_PQ_result_spec_uint64 ("last_reserve_in_serial_id", &pp->last_reserve_in_serial_id),
+ GNUNET_PQ_result_spec_uint64 ("last_reserve_out_serial_id", &pp->last_reserve_out_serial_id),
+ GNUNET_PQ_result_spec_uint64 ("last_deposit_serial_id", &pp->last_deposit_serial_id),
+ GNUNET_PQ_result_spec_uint64 ("last_melt_serial_id", &pp->last_melt_serial_id),
+ GNUNET_PQ_result_spec_uint64 ("last_refund_serial_id", &pp->last_refund_serial_id),
+ GNUNET_PQ_result_spec_uint64 ("last_prewire_serial_id", &pp->last_prewire_serial_id),
+ GNUNET_PQ_result_spec_end
+ };
+
result = GNUNET_PQ_exec_prepared (session->conn,
"auditor_progress_select",
params);
@@ -1499,18 +1468,10 @@ postgres_get_auditor_progress (void *cls,
}
GNUNET_assert (1 == nrows);
- struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_uint64 ("last_reserve_in_serial_id", last_reserve_in_serial_id),
- GNUNET_PQ_result_spec_uint64 ("last_reserve_out_serial_id", last_reserve_out_serial_id),
- GNUNET_PQ_result_spec_uint64 ("last_deposit_serial_id", last_deposit_serial_id),
- GNUNET_PQ_result_spec_uint64 ("last_melt_serial_id", last_melt_serial_id),
- GNUNET_PQ_result_spec_uint64 ("last_refund_serial_id", last_refund_serial_id),
- GNUNET_PQ_result_spec_uint64 ("last_prewire_serial_id", last_prewire_serial_id),
-
- GNUNET_PQ_result_spec_end
- };
if (GNUNET_OK !=
- GNUNET_PQ_extract_result (result, rs, 0))
+ GNUNET_PQ_extract_result (result,
+ rs,
+ 0))
{
GNUNET_break (0);
PQclear (result);
@@ -1552,19 +1513,14 @@ postgres_insert_reserve_info (void *cls,
{
PGresult *result;
int ret;
-
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (reserve_pub),
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
TALER_PQ_query_param_amount (reserve_balance),
TALER_PQ_query_param_amount (withdraw_fee_balance),
-
GNUNET_PQ_query_param_auto_from_type (&expiration_date),
-
GNUNET_PQ_query_param_uint64 (&last_reserve_in_serial_id),
GNUNET_PQ_query_param_uint64 (&last_reserve_out_serial_id),
-
GNUNET_PQ_query_param_end
};
@@ -1620,19 +1576,14 @@ postgres_update_reserve_info (void *cls,
{
PGresult *result;
int ret;
-
struct GNUNET_PQ_QueryParam params[] = {
TALER_PQ_query_param_amount (reserve_balance),
TALER_PQ_query_param_amount (withdraw_fee_balance),
-
GNUNET_PQ_query_param_auto_from_type (&expiration_date),
-
GNUNET_PQ_query_param_uint64 (&last_reserve_in_serial_id),
GNUNET_PQ_query_param_uint64 (&last_reserve_out_serial_id),
-
GNUNET_PQ_query_param_auto_from_type (reserve_pub),
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
GNUNET_PQ_query_param_end
};
@@ -1730,7 +1681,6 @@ postgres_get_reserve_info (void *cls,
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (reserve_pub),
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
GNUNET_PQ_query_param_end
};
PGresult *result;
@@ -1799,13 +1749,10 @@ postgres_insert_reserve_summary (void *cls,
{
PGresult *result;
int ret;
-
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
TALER_PQ_query_param_amount (reserve_balance),
TALER_PQ_query_param_amount (withdraw_fee_balance),
-
GNUNET_PQ_query_param_end
};
@@ -1851,13 +1798,10 @@ postgres_update_reserve_summary (void *cls,
{
PGresult *result;
int ret;
-
struct GNUNET_PQ_QueryParam params[] = {
TALER_PQ_query_param_amount (reserve_balance),
TALER_PQ_query_param_amount (withdraw_fee_balance),
-
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
GNUNET_PQ_query_param_end
};
@@ -1899,7 +1843,6 @@ postgres_get_reserve_summary (void *cls,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
GNUNET_PQ_query_param_end
};
PGresult *result;
@@ -1978,20 +1921,16 @@ postgres_insert_denomination_balance (void *cls,
{
PGresult *result;
int ret;
-
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (denom_pub_hash),
-
TALER_PQ_query_param_amount (denom_balance),
TALER_PQ_query_param_amount (deposit_fee_balance),
TALER_PQ_query_param_amount (melt_fee_balance),
TALER_PQ_query_param_amount (refund_fee_balance),
-
GNUNET_PQ_query_param_uint64 (&last_reserve_out_serial_id),
GNUNET_PQ_query_param_uint64 (&last_deposit_serial_id),
GNUNET_PQ_query_param_uint64 (&last_melt_serial_id),
GNUNET_PQ_query_param_uint64 (&last_refund_serial_id),
-
GNUNET_PQ_query_param_end
};
@@ -2060,20 +1999,16 @@ postgres_update_denomination_balance (void *cls,
{
PGresult *result;
int ret;
-
struct GNUNET_PQ_QueryParam params[] = {
TALER_PQ_query_param_amount (denom_balance),
TALER_PQ_query_param_amount (deposit_fee_balance),
TALER_PQ_query_param_amount (melt_fee_balance),
TALER_PQ_query_param_amount (refund_fee_balance),
-
GNUNET_PQ_query_param_uint64 (&last_reserve_out_serial_id),
GNUNET_PQ_query_param_uint64 (&last_deposit_serial_id),
GNUNET_PQ_query_param_uint64 (&last_melt_serial_id),
GNUNET_PQ_query_param_uint64 (&last_refund_serial_id),
-
GNUNET_PQ_query_param_auto_from_type (denom_pub_hash),
-
GNUNET_PQ_query_param_end
};
@@ -2129,10 +2064,10 @@ postgres_get_denomination_balance (void *cls,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (denom_pub_hash),
-
GNUNET_PQ_query_param_end
};
PGresult *result;
+
result = GNUNET_PQ_exec_prepared (session->conn,
"denomination_pending_select",
params);
@@ -2203,15 +2138,12 @@ postgres_insert_denomination_summary (void *cls,
{
PGresult *result;
int ret;
-
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
TALER_PQ_query_param_amount (denom_balance),
TALER_PQ_query_param_amount (deposit_fee_balance),
TALER_PQ_query_param_amount (melt_fee_balance),
TALER_PQ_query_param_amount (refund_fee_balance),
-
GNUNET_PQ_query_param_end
};
@@ -2268,15 +2200,12 @@ postgres_update_denomination_summary (void *cls,
{
PGresult *result;
int ret;
-
struct GNUNET_PQ_QueryParam params[] = {
TALER_PQ_query_param_amount (denom_balance),
TALER_PQ_query_param_amount (deposit_fee_balance),
TALER_PQ_query_param_amount (melt_fee_balance),
TALER_PQ_query_param_amount (refund_fee_balance),
-
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
GNUNET_PQ_query_param_end
};
@@ -2321,10 +2250,10 @@ postgres_get_denomination_summary (void *cls,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
GNUNET_PQ_query_param_end
};
PGresult *result;
+
result = GNUNET_PQ_exec_prepared (session->conn,
"total_liabilities_select",
params);
@@ -2384,12 +2313,9 @@ postgres_insert_risk_summary (void *cls,
{
PGresult *result;
int ret;
-
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
TALER_PQ_query_param_amount (risk),
-
GNUNET_PQ_query_param_end
};
@@ -2428,12 +2354,9 @@ postgres_update_risk_summary (void *cls,
{
PGresult *result;
int ret;
-
struct GNUNET_PQ_QueryParam params[] = {
TALER_PQ_query_param_amount (risk),
-
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
GNUNET_PQ_query_param_end
};
@@ -2472,10 +2395,10 @@ postgres_get_risk_summary (void *cls,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
GNUNET_PQ_query_param_end
};
PGresult *result;
+
result = GNUNET_PQ_exec_prepared (session->conn,
"total_risk_select",
params);
@@ -2544,18 +2467,14 @@ postgres_insert_historic_denom_revenue (void *cls,
{
PGresult *result;
int ret;
-
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_auto_from_type (denom_pub_hash),
-
GNUNET_PQ_query_param_auto_from_type (&revenue_timestamp),
-
TALER_PQ_query_param_amount (revenue_balance),
TALER_PQ_query_param_amount (deposit_fee_balance),
TALER_PQ_query_param_amount (melt_fee_balance),
TALER_PQ_query_param_amount (refund_fee_balance),
-
GNUNET_PQ_query_param_end
};
@@ -2608,10 +2527,10 @@ postgres_select_historic_denom_revenue (void *cls,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
GNUNET_PQ_query_param_end
};
PGresult *result;
+
result = GNUNET_PQ_exec_prepared (session->conn,
"historic_denomination_revenue_select",
params);
@@ -2640,19 +2559,16 @@ postgres_select_historic_denom_revenue (void *cls,
struct TALER_Amount deposit_fee_balance;
struct TALER_Amount melt_fee_balance;
struct TALER_Amount refund_fee_balance;
-
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", &denom_pub_hash),
-
GNUNET_PQ_result_spec_auto_from_type ("revenue_timestamp", &revenue_timestamp),
-
TALER_PQ_result_spec_amount ("revenue_balance", &revenue_balance),
TALER_PQ_result_spec_amount ("deposit_fee_balance", &deposit_fee_balance),
TALER_PQ_result_spec_amount ("melt_fee_balance", &melt_fee_balance),
TALER_PQ_result_spec_amount ("refund_fee_balance", &refund_fee_balance),
-
GNUNET_PQ_result_spec_end
};
+
if (GNUNET_OK !=
GNUNET_PQ_extract_result (result, rs, 0))
{
@@ -2707,15 +2623,11 @@ postgres_insert_historic_losses (void *cls,
{
PGresult *result;
int ret;
-
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_auto_from_type (denom_pub_hash),
-
GNUNET_PQ_query_param_auto_from_type (&loss_timestamp),
-
TALER_PQ_query_param_amount (loss_balance),
-
GNUNET_PQ_query_param_end
};
@@ -2756,10 +2668,10 @@ postgres_select_historic_losses (void *cls,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
GNUNET_PQ_query_param_end
};
PGresult *result;
+
result = GNUNET_PQ_exec_prepared (session->conn,
"historic_losses_select",
params);
@@ -2841,15 +2753,11 @@ postgres_insert_historic_reserve_revenue (void *cls,
{
PGresult *result;
int ret;
-
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
GNUNET_PQ_query_param_auto_from_type (&start_time),
GNUNET_PQ_query_param_auto_from_type (&end_time),
-
TALER_PQ_query_param_amount (reserve_profits),
-
GNUNET_PQ_query_param_end
};
@@ -2889,10 +2797,10 @@ postgres_select_historic_reserve_revenue (void *cls,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
GNUNET_PQ_query_param_end
};
PGresult *result;
+
result = GNUNET_PQ_exec_prepared (session->conn,
"historic_reserve_summary_select",
params);
@@ -2922,9 +2830,7 @@ postgres_select_historic_reserve_revenue (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("start_date", &start_date),
GNUNET_PQ_result_spec_auto_from_type ("end_date", &end_date),
-
TALER_PQ_result_spec_amount ("reserve_profits", &reserve_profits),
-
GNUNET_PQ_result_spec_end
};
if (GNUNET_OK !=
@@ -2970,11 +2876,9 @@ postgres_insert_predicted_result (void *cls,
{
PGresult *result;
int ret;
-
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
TALER_PQ_query_param_amount (balance),
-
GNUNET_PQ_query_param_end
};
@@ -3017,7 +2921,6 @@ postgres_update_predicted_result (void *cls,
struct GNUNET_PQ_QueryParam params[] = {
TALER_PQ_query_param_amount (balance),
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
GNUNET_PQ_query_param_end
};
@@ -3056,10 +2959,10 @@ postgres_get_predicted_balance (void *cls,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
-
GNUNET_PQ_query_param_end
};
PGresult *result;
+
result = GNUNET_PQ_exec_prepared (session->conn,
"predicted_result_select",
params);
@@ -3113,7 +3016,6 @@ libtaler_plugin_auditordb_postgres_init (void *cls)
const char *ec;
pg = GNUNET_new (struct PostgresClosure);
-
if (0 != pthread_key_create (&pg->db_conn_threadlocal,
&db_conn_destroy))
{
diff --git a/src/auditordb/test_auditordb.c b/src/auditordb/test_auditordb.c
index 93c279384..5f110865d 100644
--- a/src/auditordb/test_auditordb.c
+++ b/src/auditordb/test_auditordb.c
@@ -201,52 +201,43 @@ run (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test: insert_auditor_progress\n");
- uint64_t
- last_reserve_in_serial_id = 1234,
- last_reserve_out_serial_id = 5678,
- last_deposit_serial_id = 123,
- last_melt_serial_id = 456,
- last_refund_serial_id = 789,
- last_prewire_serial_id = 555,
-
- last_reserve_in_serial_id2 = 0,
- last_reserve_out_serial_id2 = 0,
- last_deposit_serial_id2 = 0,
- last_melt_serial_id2 = 0,
- last_refund_serial_id2 = 0,
- last_prewire_serial_id2 = 0;
+ struct TALER_AUDITORDB_ProgressPoint pp = {
+ .last_reserve_in_serial_id = 1234,
+ .last_reserve_out_serial_id = 5678,
+ .last_deposit_serial_id = 123,
+ .last_melt_serial_id = 456,
+ .last_refund_serial_id = 789,
+ .last_prewire_serial_id = 555
+ };
+ struct TALER_AUDITORDB_ProgressPoint pp2 = {
+ .last_reserve_in_serial_id = 0,
+ .last_reserve_out_serial_id = 0,
+ .last_deposit_serial_id = 0,
+ .last_melt_serial_id = 0,
+ .last_refund_serial_id = 0,
+ .last_prewire_serial_id = 0
+ };
FAILIF (GNUNET_OK !=
plugin->insert_auditor_progress (plugin->cls,
session,
&master_pub,
- last_reserve_in_serial_id,
- last_reserve_out_serial_id,
- last_deposit_serial_id,
- last_melt_serial_id,
- last_refund_serial_id,
- last_prewire_serial_id));
-
+ &pp));
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test: update_auditor_progress\n");
- last_reserve_in_serial_id++;
- last_reserve_out_serial_id++;
- last_deposit_serial_id2++;
- last_melt_serial_id2++;
- last_refund_serial_id2++;
- last_prewire_serial_id2++;
+ pp.last_reserve_in_serial_id++;
+ pp.last_reserve_out_serial_id++;
+ pp.last_deposit_serial_id++;
+ pp.last_melt_serial_id++;
+ pp.last_refund_serial_id++;
+ pp.last_prewire_serial_id++;
FAILIF (GNUNET_OK !=
plugin->update_auditor_progress (plugin->cls,
session,
&master_pub,
- last_reserve_in_serial_id,
- last_reserve_out_serial_id,
- last_deposit_serial_id,
- last_melt_serial_id,
- last_refund_serial_id,
- last_prewire_serial_id));
+ &pp));
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test: get_auditor_progress\n");
@@ -255,19 +246,13 @@ run (void *cls)
plugin->get_auditor_progress (plugin->cls,
session,
&master_pub,
- &last_reserve_in_serial_id2,
- &last_reserve_out_serial_id2,
- &last_deposit_serial_id2,
- &last_melt_serial_id2,
- &last_refund_serial_id2,
- &last_prewire_serial_id2));
-
- FAILIF (last_reserve_in_serial_id2 != last_reserve_in_serial_id
- || last_reserve_out_serial_id2 != last_reserve_out_serial_id
- || last_deposit_serial_id2 != last_deposit_serial_id
- || last_melt_serial_id2 != last_melt_serial_id
- || last_refund_serial_id2 != last_refund_serial_id
- || last_prewire_serial_id2 != last_prewire_serial_id);
+ &pp2));
+ FAILIF ( (pp.last_reserve_in_serial_id != pp2.last_reserve_in_serial_id) ||
+ (pp.last_reserve_out_serial_id != pp2.last_reserve_out_serial_id) ||
+ (pp.last_deposit_serial_id != pp2.last_deposit_serial_id) ||
+ (pp.last_melt_serial_id != pp2.last_melt_serial_id) ||
+ (pp.last_refund_serial_id != pp2.last_refund_serial_id) ||
+ (pp.last_prewire_serial_id != pp2.last_prewire_serial_id) );
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test: insert_reserve_info\n");
@@ -290,14 +275,14 @@ run (void *cls)
&reserve_balance,
&withdraw_fee_balance,
past,
- last_reserve_in_serial_id,
- last_reserve_out_serial_id));
+ pp.last_reserve_in_serial_id,
+ pp.last_reserve_out_serial_id));
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test: update_reserve_info\n");
- last_reserve_in_serial_id++;
- last_reserve_out_serial_id++;
+ pp.last_reserve_in_serial_id++;
+ pp.last_reserve_out_serial_id++;
FAILIF (GNUNET_OK !=
plugin->update_reserve_info (plugin->cls,
@@ -307,8 +292,8 @@ run (void *cls)
&reserve_balance,
&withdraw_fee_balance,
future,
- last_reserve_in_serial_id,
- last_reserve_out_serial_id));
+ pp.last_reserve_in_serial_id,
+ pp.last_reserve_out_serial_id));
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test: get_reserve_info\n");
@@ -321,14 +306,14 @@ run (void *cls)
&reserve_balance2,
&withdraw_fee_balance2,
&date,
- &last_reserve_in_serial_id2,
- &last_reserve_out_serial_id2));
+ &pp2.last_reserve_in_serial_id,
+ &pp2.last_reserve_out_serial_id));
FAILIF (0 != memcmp (&date, &future, sizeof (future))
|| 0 != memcmp (&reserve_balance2, &reserve_balance, sizeof (reserve_balance))
|| 0 != memcmp (&withdraw_fee_balance2, &withdraw_fee_balance, sizeof (withdraw_fee_balance))
- || last_reserve_in_serial_id2 != last_reserve_in_serial_id
- || last_reserve_out_serial_id2 != last_reserve_out_serial_id);
+ || pp2.last_reserve_in_serial_id != pp.last_reserve_in_serial_id
+ || pp2.last_reserve_out_serial_id != pp.last_reserve_out_serial_id);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test: insert_reserve_summary\n");
@@ -393,18 +378,18 @@ run (void *cls)
&melt_fee_balance,
&deposit_fee_balance,
&denom_balance,
- last_reserve_out_serial_id,
- last_deposit_serial_id,
- last_melt_serial_id,
- last_refund_serial_id));
+ pp.last_reserve_out_serial_id,
+ pp.last_deposit_serial_id,
+ pp.last_melt_serial_id,
+ pp.last_refund_serial_id));
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test: update_denomination_balance\n");
- last_reserve_out_serial_id++;
- last_deposit_serial_id++;
- last_melt_serial_id++;
- last_refund_serial_id++;
+ pp.last_reserve_out_serial_id++;
+ pp.last_deposit_serial_id++;
+ pp.last_melt_serial_id++;
+ pp.last_refund_serial_id++;
FAILIF (GNUNET_OK !=
plugin->update_denomination_balance (plugin->cls,
@@ -414,10 +399,10 @@ run (void *cls)
&deposit_fee_balance,
&melt_fee_balance,
&refund_fee_balance,
- last_reserve_out_serial_id,
- last_deposit_serial_id,
- last_melt_serial_id,
- last_refund_serial_id));
+ pp.last_reserve_out_serial_id,
+ pp.last_deposit_serial_id,
+ pp.last_melt_serial_id,
+ pp.last_refund_serial_id));
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test: get_denomination_balance\n");
@@ -430,19 +415,19 @@ run (void *cls)
&deposit_fee_balance2,
&melt_fee_balance2,
&refund_fee_balance2,
- &last_reserve_out_serial_id2,
- &last_deposit_serial_id2,
- &last_melt_serial_id2,
- &last_refund_serial_id2));
+ &pp2.last_reserve_out_serial_id,
+ &pp2.last_deposit_serial_id,
+ &pp2.last_melt_serial_id,
+ &pp2.last_refund_serial_id));
FAILIF (0 != memcmp (&denom_balance2, &denom_balance, sizeof (denom_balance))
|| 0 != memcmp (&deposit_fee_balance2, &deposit_fee_balance, sizeof (deposit_fee_balance))
|| 0 != memcmp (&melt_fee_balance2, &melt_fee_balance, sizeof (melt_fee_balance))
|| 0 != memcmp (&refund_fee_balance2, &refund_fee_balance, sizeof (refund_fee_balance))
- || last_reserve_out_serial_id2 != last_reserve_out_serial_id
- || last_deposit_serial_id2 != last_deposit_serial_id
- || last_melt_serial_id2 != last_melt_serial_id
- || last_refund_serial_id2 != last_refund_serial_id);
+ || pp2.last_reserve_out_serial_id != pp.last_reserve_out_serial_id
+ || pp2.last_deposit_serial_id != pp.last_deposit_serial_id
+ || pp2.last_melt_serial_id != pp.last_melt_serial_id
+ || pp2.last_refund_serial_id != pp.last_refund_serial_id);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test: insert_denomination_summary\n");