diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-07-08 18:20:44 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-07-08 18:20:44 +0200 |
commit | c93f64710674bb4f635288c5e326f2cf47b8e8c7 (patch) | |
tree | 1b21032df96468b831cb7c6d379592911277510c /src/exchange/taler-exchange-httpd_recoup.c | |
parent | 8e03498a487d3d00c20167dc19c24f9a0fe1a647 (diff) |
merge known_coin transaction into main transaction (for #6416)
Diffstat (limited to 'src/exchange/taler-exchange-httpd_recoup.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_recoup.c | 30 |
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; |