summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_recoup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchange/taler-exchange-httpd_recoup.c')
-rw-r--r--src/exchange/taler-exchange-httpd_recoup.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/exchange/taler-exchange-httpd_recoup.c b/src/exchange/taler-exchange-httpd_recoup.c
index c1f6ff33..d9969d90 100644
--- a/src/exchange/taler-exchange-httpd_recoup.c
+++ b/src/exchange/taler-exchange-httpd_recoup.c
@@ -132,6 +132,20 @@ recoup_transaction (void *cls,
enum GNUNET_DB_QueryStatus qs;
int existing_recoup_found;
+ /* make sure coin is 'known' in database */
+ qs = TEH_plugin->ensure_coin_known (TEH_plugin->cls,
+ session,
+ pc->coin);
+ if (GNUNET_DB_STATUS_HARD_ERROR == qs)
+ {
+ *mhd_ret
+ = TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_DB_COIN_HISTORY_STORE_ERROR,
+ "could not persist coin data");
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ }
+
/* Check whether a recoup is allowed, and if so, to which
reserve / account the money should go */
if (pc->refreshed)
@@ -450,22 +464,6 @@ verify_and_execute_recoup (struct MHD_Connection *connection,
&pc.h_blind);
GNUNET_free (coin_ev);
- /* make sure coin is 'known' in database */
- {
- struct TEH_DB_KnowCoinContext kcc;
- MHD_RESULT mhd_ret;
-
- kcc.coin = coin;
- kcc.connection = connection;
- if (GNUNET_OK !=
- TEH_DB_run_transaction (connection,
- "know coin for recoup",
- &mhd_ret,
- &TEH_DB_know_coin_transaction,
- &kcc))
- return mhd_ret;
- }
-
/* Perform actual recoup transaction */
pc.coin_sig = coin_sig;
pc.coin_bks = coin_bks;