aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb/plugin_exchangedb_postgres.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-08-13 20:49:48 +0200
committerChristian Grothoff <christian@grothoff.org>2020-08-13 20:49:48 +0200
commitf581b54dfbe0996c2b25ccf4995967e594811597 (patch)
treeeeca2364e7d4bd715d17bebce0b235ca8957b2a9 /src/exchangedb/plugin_exchangedb_postgres.c
parent4e0b5104382a1271261a24c4b97cb50f63aea976 (diff)
remove optimization combining two SQL statements on reserve update as it could not be shown to have a significant benefit at this time (only 2% fewer serialization failures). May deserve further evaluation in the future, if reserve update ever becomes crucial.
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c49
1 files changed, 0 insertions, 49 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index e3604ec07..c0ae1fdf5 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -399,30 +399,6 @@ postgres_get_session (void *cls)
" WHERE"
" reserve_pub=$5;",
5),
- /* Used in #insert_withdraw_info() when coins are withdrawn from the reserve */
- GNUNET_PQ_make_prepare ("reserve_reduce",
- "UPDATE reserves"
- " SET"
- " gc_date="
- " CASE WHEN (reserves.gc_date > $2)"
- " THEN reserves.gc_date"
- " ELSE $2"
- " END"
- ",current_balance_val="
- " CASE WHEN (reserves.current_balance_frac >= $4)"
- " THEN reserves.current_balance_val - $3"
- " ELSE reserves.current_balance_val - $3 - 1"
- " END"
- ",current_balance_frac="
- " CASE WHEN (reserves.current_balance_frac >= $4)"
- " THEN reserves.current_balance_frac - $4"
- " ELSE 100000000 + reserves.current_balance_frac - $4"
- " END"
- " WHERE reserve_pub=$1"
- " AND current_balance_val >= $3"
- " AND ( (current_balance_frac >= $4) OR"
- " (current_balance_val > $3) )",
- 4),
/* Used in #postgres_reserves_in_insert() to store transaction details */
GNUNET_PQ_make_prepare ("reserves_in_add_transaction",
"INSERT INTO reserves_in "
@@ -2179,7 +2155,6 @@ postgres_insert_withdraw_info (
return qs;
}
-#if 1
/* update reserve balance */
reserve.pub = collectable->reserve_pub;
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
@@ -2220,30 +2195,6 @@ postgres_insert_withdraw_info (
GNUNET_break (0);
qs = GNUNET_DB_STATUS_HARD_ERROR;
}
-#else
- {
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (&collectable->reserve_pub),
- TALER_PQ_query_param_absolute_time (&expiry),
- TALER_PQ_query_param_amount (&collectable->amount_with_fee),
- GNUNET_PQ_query_param_end
- };
-
- expiry = GNUNET_TIME_absolute_add (now,
- pg->legal_reserve_expiration_time);
- qs = GNUNET_PQ_eval_prepared_non_select (session->conn,
- "reserve_reduce",
- params);
- if (0 == qs)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Withdrawal from reserve `%s' refused due to balance mismatch.\n",
- TALER_B2S (&collectable->reserve_pub));
- return GNUNET_DB_STATUS_HARD_ERROR;
- }
- }
-
-#endif
return qs;
}