aboutsummaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_deposit.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-12-08 15:18:40 +0100
committerChristian Grothoff <christian@grothoff.org>2021-12-08 15:18:40 +0100
commit9d3f7d3a56712d6a963e8a4775a8f9757740d648 (patch)
tree95955e48fffa2d6dfcf6e81083b43c3df40f2072 /src/exchange/taler-exchange-httpd_deposit.c
parent2e6e2387b8c4e83e32c50e4fc8cb5312bce68735 (diff)
move ensure_coin_known for melt and recoup outside of transaction, more logging
Diffstat (limited to 'src/exchange/taler-exchange-httpd_deposit.c')
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c
index 5534c402..d549a1fa 100644
--- a/src/exchange/taler-exchange-httpd_deposit.c
+++ b/src/exchange/taler-exchange-httpd_deposit.c
@@ -162,13 +162,6 @@ deposit_transaction (void *cls,
enum GNUNET_DB_QueryStatus qs;
struct TALER_Amount deposit_fee;
- /* make sure coin is 'known' in database */
- qs = TEH_make_coin_known (&deposit->coin,
- connection,
- mhd_ret);
- if (qs < 0)
- return qs;
-
/* Check for idempotency: did we get this request before? */
qs = TEH_plugin->have_deposit (TEH_plugin->cls,
deposit,
@@ -490,6 +483,31 @@ TEH_handler_deposit (struct MHD_Connection *connection,
NULL);
}
+ if (GNUNET_SYSERR ==
+ TEH_plugin->preflight (TEH_plugin->cls))
+ {
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_START_FAILED,
+ "preflight failure");
+ }
+
+ {
+ MHD_RESULT mhd_ret = MHD_NO;
+ enum GNUNET_DB_QueryStatus qs;
+
+ /* make sure coin is 'known' in database */
+ qs = TEH_make_coin_known (&deposit.coin,
+ connection,
+ &mhd_ret);
+ /* no transaction => no serialization failures should be possible */
+ GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs);
+ if (qs < 0)
+ return mhd_ret;
+ }
+
+
/* execute transaction */
{
MHD_RESULT mhd_ret;