summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_deposit.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-02-24 13:53:09 +0100
committerChristian Grothoff <christian@grothoff.org>2022-02-24 13:53:19 +0100
commitfd9ba53c492835b52bd75a5ae113b7bcc81fe161 (patch)
treeccb61b10436e0fdc5cb068595fad26e910bdabb2 /src/exchange/taler-exchange-httpd_deposit.c
parent10b9023575b14e581cfd952b75039e71488f5a8f (diff)
downloadexchange-fd9ba53c492835b52bd75a5ae113b7bcc81fe161.tar.gz
exchange-fd9ba53c492835b52bd75a5ae113b7bcc81fe161.tar.bz2
exchange-fd9ba53c492835b52bd75a5ae113b7bcc81fe161.zip
make_coin_known can experience serialization failures, add retry logic
Diffstat (limited to 'src/exchange/taler-exchange-httpd_deposit.c')
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c
index ea319f23a..66cbe04ca 100644
--- a/src/exchange/taler-exchange-httpd_deposit.c
+++ b/src/exchange/taler-exchange-httpd_deposit.c
@@ -442,12 +442,24 @@ TEH_handler_deposit (struct MHD_Connection *connection,
enum GNUNET_DB_QueryStatus qs;
/* make sure coin is 'known' in database */
- qs = TEH_make_coin_known (&deposit.coin,
- connection,
- &dc.known_coin_id,
- &mhd_ret);
- /* no transaction => no serialization failures should be possible */
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs);
+ for (unsigned int tries = 0; tries<MAX_TRANSACTION_COMMIT_RETRIES; tries++)
+ {
+ qs = TEH_make_coin_known (&deposit.coin,
+ connection,
+ &dc.known_coin_id,
+ &mhd_ret);
+ /* no transaction => no serialization failures should be possible */
+ if (GNUNET_DB_STATUS_SOFT_ERROR != qs)
+ break;
+ }
+ if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
+ {
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_COMMIT_FAILED,
+ "make_coin_known");
+ }
if (qs < 0)
return mhd_ret;
}