diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-03-18 23:03:00 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-03-18 23:03:00 +0100 |
commit | e4a4a7e193705a12e04ab6b4a3360168ffb4b27a (patch) | |
tree | 418550dd65ba746a952cd218910fbfa13f1e9026 /src/auditordb | |
parent | 0f5ce284c4601f1819a9d2a91c120acdaa72fe15 (diff) |
finish sync_denomination() implementation
Diffstat (limited to 'src/auditordb')
-rw-r--r-- | src/auditordb/plugin_auditordb_postgres.c | 66 | ||||
-rw-r--r-- | src/auditordb/test_auditordb.c | 20 |
2 files changed, 9 insertions, 77 deletions
diff --git a/src/auditordb/plugin_auditordb_postgres.c b/src/auditordb/plugin_auditordb_postgres.c index 58f1152fb..ddacca657 100644 --- a/src/auditordb/plugin_auditordb_postgres.c +++ b/src/auditordb/plugin_auditordb_postgres.c @@ -375,15 +375,7 @@ postgres_create_tables (void *cls) ",revenue_balance_val INT8 NOT NULL" ",revenue_balance_frac INT4 NOT NULL" ",revenue_balance_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL" - ",deposit_fee_balance_val INT8 NOT NULL" - ",deposit_fee_balance_frac INT4 NOT NULL" - ",deposit_fee_balance_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL" - ",melt_fee_balance_val INT8 NOT NULL" - ",melt_fee_balance_frac INT4 NOT NULL" - ",melt_fee_balance_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL" - ",refund_fee_balance_val INT8 NOT NULL" - ",refund_fee_balance_frac INT4 NOT NULL" - ",refund_fee_balance_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL" ")"); + ")"); /* Table with historic losses; basically, when we need to @@ -779,17 +771,8 @@ postgres_prepare (PGconn *db_conn) ",revenue_balance_val" ",revenue_balance_frac" ",revenue_balance_curr" - ",deposit_fee_balance_val" - ",deposit_fee_balance_frac" - ",deposit_fee_balance_curr" - ",melt_fee_balance_val" - ",melt_fee_balance_frac" - ",melt_fee_balance_curr" - ",refund_fee_balance_val" - ",refund_fee_balance_frac" - ",refund_fee_balance_curr" - ") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15);", - 15, NULL); + ") VALUES ($1,$2,$3,$4,$5,$6);", + 6, NULL); /* Used in #postgres_select_historic_denom_revenue() */ PREPARE ("historic_denomination_revenue_select", @@ -799,15 +782,6 @@ postgres_prepare (PGconn *db_conn) ",revenue_balance_val" ",revenue_balance_frac" ",revenue_balance_curr" - ",deposit_fee_balance_val" - ",deposit_fee_balance_frac" - ",deposit_fee_balance_curr" - ",melt_fee_balance_val" - ",melt_fee_balance_frac" - ",melt_fee_balance_curr" - ",refund_fee_balance_val" - ",refund_fee_balance_frac" - ",refund_fee_balance_curr" " FROM historic_denomination_revenue" " WHERE master_pub=$1;", 1, NULL); @@ -2133,9 +2107,6 @@ postgres_get_denomination_summary (void *cls, * @param revenue_balance what was the total profit made from * deposit fees, melting fees, refresh fees * and coins that were never returned? - * @param deposit_fee_balance total profits from deposit fees - * @param melt_fee_balance total profits from melting fees - * @param refund_fee_balance total profits from refund fees * @return #GNUNET_OK on success; #GNUNET_SYSERR on failure */ static int @@ -2144,10 +2115,7 @@ postgres_insert_historic_denom_revenue (void *cls, const struct TALER_MasterPublicKeyP *master_pub, const struct GNUNET_HashCode *denom_pub_hash, struct GNUNET_TIME_Absolute revenue_timestamp, - const struct TALER_Amount *revenue_balance, - const struct TALER_Amount *deposit_fee_balance, - const struct TALER_Amount *melt_fee_balance, - const struct TALER_Amount *refund_fee_balance) + const struct TALER_Amount *revenue_balance) { PGresult *result; int ret; @@ -2156,24 +2124,9 @@ postgres_insert_historic_denom_revenue (void *cls, 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 }; - GNUNET_assert (GNUNET_YES == - TALER_amount_cmp_currency (revenue_balance, - deposit_fee_balance)); - - GNUNET_assert (GNUNET_YES == - TALER_amount_cmp_currency (revenue_balance, - melt_fee_balance)); - - GNUNET_assert (GNUNET_YES == - TALER_amount_cmp_currency (revenue_balance, - refund_fee_balance)); - result = GNUNET_PQ_exec_prepared (session->conn, "historic_denomination_revenue_insert", params); @@ -2240,16 +2193,10 @@ postgres_select_historic_denom_revenue (void *cls, struct GNUNET_HashCode denom_pub_hash; struct GNUNET_TIME_Absolute revenue_timestamp; struct TALER_Amount revenue_balance; - 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 }; @@ -2264,10 +2211,7 @@ postgres_select_historic_denom_revenue (void *cls, ret = cb (cb_cls, &denom_pub_hash, revenue_timestamp, - &revenue_balance, - &deposit_fee_balance, - &melt_fee_balance, - &refund_fee_balance); + &revenue_balance); switch (ret) { case GNUNET_OK: diff --git a/src/auditordb/test_auditordb.c b/src/auditordb/test_auditordb.c index 03ceb609d..24184aee9 100644 --- a/src/auditordb/test_auditordb.c +++ b/src/auditordb/test_auditordb.c @@ -461,10 +461,7 @@ run (void *cls) &master_pub, &denom_pub_hash, past, - &rbalance, - &deposit_fee_balance, - &melt_fee_balance, - &refund_fee_balance)); + &rbalance)); FAILIF (GNUNET_OK != plugin->insert_historic_denom_revenue (plugin->cls, @@ -472,10 +469,7 @@ run (void *cls) &master_pub, &rnd_hash, now, - &rbalance, - &deposit_fee_balance, - &melt_fee_balance, - &refund_fee_balance)); + &rbalance)); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Test: select_historic_denom_revenue\n"); @@ -484,10 +478,7 @@ run (void *cls) select_historic_denom_revenue_result (void *cls, const struct GNUNET_HashCode *denom_pub_hash2, struct GNUNET_TIME_Absolute revenue_timestamp2, - const struct TALER_Amount *revenue_balance2, - const struct TALER_Amount *deposit_fee_balance2, - const struct TALER_Amount *melt_fee_balance2, - const struct TALER_Amount *refund_fee_balance2) + const struct TALER_Amount *revenue_balance2) { static int n = 0; @@ -500,10 +491,7 @@ run (void *cls) && 0 != memcmp (&revenue_timestamp2, &now, sizeof (now))) || (0 != memcmp (denom_pub_hash2, &denom_pub_hash, sizeof (denom_pub_hash)) && 0 != memcmp (denom_pub_hash2, &rnd_hash, sizeof (rnd_hash))) - || 0 != memcmp (revenue_balance2, &rbalance, sizeof (rbalance)) - || 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))) + || 0 != memcmp (revenue_balance2, &rbalance, sizeof (rbalance))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "select_historic_denom_revenue_result: result does not match\n"); |