summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/auditor/taler-auditor.c1
-rw-r--r--src/benchmark/taler-exchange-benchmark.c6
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c3
-rw-r--r--src/exchange/taler-exchange-httpd_payback.c1
-rw-r--r--src/exchange/taler-exchange-httpd_refresh_melt.c1
-rw-r--r--src/exchange/taler-exchange-httpd_refund.c1
-rw-r--r--src/exchangedb/perf_taler_exchangedb_interpreter.c1
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c56
-rw-r--r--src/exchangedb/test_exchangedb.c2
-rw-r--r--src/include/taler_exchangedb_plugin.h2
10 files changed, 56 insertions, 18 deletions
diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c
index f5d185cf..c32f4618 100644
--- a/src/auditor/taler-auditor.c
+++ b/src/auditor/taler-auditor.c
@@ -2120,6 +2120,7 @@ wire_transfer_information_cb (void *cls,
qs = edb->get_coin_transactions (edb->cls,
esession,
coin_pub,
+ GNUNET_YES,
&tl);
if ( (qs < 0) ||
(NULL == tl) )
diff --git a/src/benchmark/taler-exchange-benchmark.c b/src/benchmark/taler-exchange-benchmark.c
index 4a664da5..26163d12 100644
--- a/src/benchmark/taler-exchange-benchmark.c
+++ b/src/benchmark/taler-exchange-benchmark.c
@@ -571,6 +571,9 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
fakebank = fork ();
if (0 == fakebank)
{
+ GNUNET_log_setup ("benchmark-fakebank",
+ NULL == loglev ? "INFO" : loglev,
+ logfile);
GNUNET_SCHEDULER_run (&launch_fakebank,
exchange_bank_account.bank_base_url);
exit (0);
@@ -686,6 +689,9 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
if (0 == (cpids[i] = fork ()))
{
/* I am the child, do the work! */
+ GNUNET_log_setup ("benchmark-worker",
+ NULL == loglev ? "INFO" : loglev,
+ logfile);
result = TALER_TESTING_setup
(run,
NULL,
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c
index 53fe4222..107456ca 100644
--- a/src/exchange/taler-exchange-httpd_deposit.c
+++ b/src/exchange/taler-exchange-httpd_deposit.c
@@ -153,7 +153,7 @@ deposit_transaction (void *cls,
}
return qs;
}
- if (1 == qs)
+ if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
{
struct TALER_Amount amount_without_fee;
@@ -182,6 +182,7 @@ deposit_transaction (void *cls,
qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls,
session,
&deposit->coin.coin_pub,
+ GNUNET_NO,
&tl);
if (0 > qs)
return qs;
diff --git a/src/exchange/taler-exchange-httpd_payback.c b/src/exchange/taler-exchange-httpd_payback.c
index aebbe2b8..877a3ce2 100644
--- a/src/exchange/taler-exchange-httpd_payback.c
+++ b/src/exchange/taler-exchange-httpd_payback.c
@@ -209,6 +209,7 @@ payback_transaction (void *cls,
qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls,
session,
&pc->coin->coin_pub,
+ GNUNET_YES,
&tl);
if (0 > qs)
{
diff --git a/src/exchange/taler-exchange-httpd_refresh_melt.c b/src/exchange/taler-exchange-httpd_refresh_melt.c
index 83bf197e..a844d3a4 100644
--- a/src/exchange/taler-exchange-httpd_refresh_melt.c
+++ b/src/exchange/taler-exchange-httpd_refresh_melt.c
@@ -172,6 +172,7 @@ refresh_check_melt (struct MHD_Connection *connection,
qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls,
session,
&rmc->refresh_session.coin.coin_pub,
+ GNUNET_NO,
&tl);
if (0 > qs)
{
diff --git a/src/exchange/taler-exchange-httpd_refund.c b/src/exchange/taler-exchange-httpd_refund.c
index 8d573e47..86915806 100644
--- a/src/exchange/taler-exchange-httpd_refund.c
+++ b/src/exchange/taler-exchange-httpd_refund.c
@@ -164,6 +164,7 @@ refund_transaction (void *cls,
qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls,
session,
&refund->coin.coin_pub,
+ GNUNET_NO,
&tl);
if (0 > qs)
{
diff --git a/src/exchangedb/perf_taler_exchangedb_interpreter.c b/src/exchangedb/perf_taler_exchangedb_interpreter.c
index 2d0ec396..6c046032 100644
--- a/src/exchangedb/perf_taler_exchangedb_interpreter.c
+++ b/src/exchangedb/perf_taler_exchangedb_interpreter.c
@@ -1410,6 +1410,7 @@ interpret (struct PERF_TALER_EXCHANGEDB_interpreter_state *state)
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);
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index d3efb931..f24b8f71 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -1579,7 +1579,7 @@ postgres_prepare (PGconn *db_conn)
",denoms.denom_pub"
",coins.denom_sig"
" FROM payback"
- " JOIN known_coins coins"
+ " JOIN kown_coins coins"
" USING (coin_pub)"
" JOIN denominations denoms"
" USING (denom_pub_hash)"
@@ -4277,6 +4277,23 @@ add_coin_payback (void *cls,
/**
+ * Work we need to do.
+ */
+struct Work
+{
+ /**
+ * SQL prepared statement name.
+ */
+ const char *statement;
+
+ /**
+ * Function to call to handle the result(s).
+ */
+ GNUNET_PQ_PostgresResultHandler cb;
+};
+
+
+/**
* Compile a list of all (historic) transactions performed
* with the given coin (/refresh/melt, /deposit and /refund operations).
*
@@ -4290,25 +4307,22 @@ static enum GNUNET_DB_QueryStatus
postgres_get_coin_transactions (void *cls,
struct TALER_EXCHANGEDB_Session *session,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ int include_payback,
struct TALER_EXCHANGEDB_TransactionList **tlp)
{
- struct CoinHistoryContext chc;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (coin_pub),
- GNUNET_PQ_query_param_end
+ static const struct Work work_op[] = {
+ /** #TALER_EXCHANGEDB_TT_DEPOSIT */
+ { "get_deposit_with_coin_pub",
+ &add_coin_deposit },
+ /** #TALER_EXCHANGEDB_TT_REFRESH_MELT */
+ { "get_refresh_session_by_coin",
+ &add_coin_melt },
+ /** #TALER_EXCHANGEDB_TT_REFUND */
+ { "get_refunds_by_coin",
+ &add_coin_refund },
+ { NULL, NULL }
};
- enum GNUNET_DB_QueryStatus qs;
- struct {
- /**
- * SQL prepared statement name.
- */
- const char *statement;
-
- /**
- * Function to call to handle the result(s).
- */
- GNUNET_PQ_PostgresResultHandler cb;
- } work[] = {
+ static const struct Work work_wp[] = {
/** #TALER_EXCHANGEDB_TT_DEPOSIT */
{ "get_deposit_with_coin_pub",
&add_coin_deposit },
@@ -4323,7 +4337,15 @@ postgres_get_coin_transactions (void *cls,
&add_coin_payback },
{ NULL, NULL }
};
+ struct CoinHistoryContext chc;
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_auto_from_type (coin_pub),
+ GNUNET_PQ_query_param_end
+ };
+ enum GNUNET_DB_QueryStatus qs;
+ const struct Work * work;
+ work = (GNUNET_YES == include_payback) ? work_wp : work_op;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Getting transactions for coin %s\n",
TALER_B2S (coin_pub));
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index 8666f1a5..f69127ec 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -718,6 +718,7 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
qs = plugin->get_coin_transactions (plugin->cls,
session,
&refresh_session.coin.coin_pub,
+ GNUNET_YES,
&tl);
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs);
plugin->free_coin_transaction_list (plugin->cls,
@@ -2132,6 +2133,7 @@ run (void *cls)
qs = plugin->get_coin_transactions (plugin->cls,
session,
&refund.coin.coin_pub,
+ GNUNET_YES,
&tl);
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs);
GNUNET_assert (NULL != tl);
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index b06bc740..580a628c 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -1680,6 +1680,7 @@ struct TALER_EXCHANGEDB_Plugin
* @param cls the @e cls of this struct with the plugin-specific state
* @param session database connection
* @param coin_pub coin to investigate
+ * @param include_payback include payback transactions of the coin?
* @param[out] tlp set to list of transactions, NULL if coin is fresh
* @return database transaction status
*/
@@ -1687,6 +1688,7 @@ struct TALER_EXCHANGEDB_Plugin
(*get_coin_transactions) (void *cls,
struct TALER_EXCHANGEDB_Session *session,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ int include_payback,
struct TALER_EXCHANGEDB_TransactionList **tlp);