diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-08-19 16:01:57 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-08-19 16:01:57 +0200 |
commit | 0df2028f96f5977739d4659bf253e0c6d9468326 (patch) | |
tree | 906222af6c332e219af4a5d112891d7212237de3 /src/exchange/taler-exchange-httpd_deposit.c | |
parent | ddca1f5c68e112928d715e1aee2758c40e14fb51 (diff) | |
download | exchange-0df2028f96f5977739d4659bf253e0c6d9468326.tar.gz exchange-0df2028f96f5977739d4659bf253e0c6d9468326.tar.bz2 exchange-0df2028f96f5977739d4659bf253e0c6d9468326.zip |
make transactions smaller to try to reduce rollbacks
Diffstat (limited to 'src/exchange/taler-exchange-httpd_deposit.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_deposit.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c index 8bf47717e..53fe4222a 100644 --- a/src/exchange/taler-exchange-httpd_deposit.c +++ b/src/exchange/taler-exchange-httpd_deposit.c @@ -144,7 +144,15 @@ deposit_transaction (void *cls, session, deposit); if (qs < 0) + { + if (GNUNET_DB_STATUS_HARD_ERROR == qs) + { + *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection, + TALER_EC_DEPOSIT_HISTORY_DB_ERROR); + return GNUNET_DB_STATUS_HARD_ERROR; + } return qs; + } if (1 == qs) { struct TALER_Amount amount_without_fee; @@ -518,6 +526,22 @@ TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh, "deposited amount smaller than depositing fee"); } + /* make sure coin is 'known' in database */ + { + struct TEH_DB_KnowCoinContext kcc; + int mhd_ret; + + kcc.coin = &deposit.coin; + kcc.connection = connection; + if (GNUNET_OK != + TEH_DB_run_transaction (connection, + "know coin for deposit", + &mhd_ret, + &TEH_DB_know_coin_transaction, + &kcc)) + return mhd_ret; + } + res = verify_and_execute_deposit (connection, &deposit); GNUNET_JSON_parse_free (spec); |