summaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-11-17 15:33:31 +0100
committerChristian Grothoff <christian@grothoff.org>2016-11-17 15:33:31 +0100
commitbb7c58921eb56d464ed2b8a3a6fbbed9c82919d8 (patch)
tree2a65b69f5e8ce05cd7681607bd71a860d412c827 /src/exchange
parentf8eb77927f41d31fb1d9049b81ebb9d354726066 (diff)
downloadexchange-bb7c58921eb56d464ed2b8a3a6fbbed9c82919d8.tar.gz
exchange-bb7c58921eb56d464ed2b8a3a6fbbed9c82919d8.tar.bz2
exchange-bb7c58921eb56d464ed2b8a3a6fbbed9c82919d8.zip
if reserve history computation reveals database inconsistency, do not abort but return proper error code
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-httpd_db.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/exchange/taler-exchange-httpd_db.c b/src/exchange/taler-exchange-httpd_db.c
index 4f51e18f2..848d28822 100644
--- a/src/exchange/taler-exchange-httpd_db.c
+++ b/src/exchange/taler-exchange-httpd_db.c
@@ -748,10 +748,17 @@ execute_reserve_withdraw_transaction (struct MHD_Connection *connection,
&withdraw_total);
}
/* All reserve balances should be non-negative */
- GNUNET_assert (GNUNET_SYSERR !=
- TALER_amount_subtract (&balance,
- &deposit_total,
- &withdraw_total));
+ if (GNUNET_SYSERR ==
+ TALER_amount_subtract (&balance,
+ &deposit_total,
+ &withdraw_total))
+ {
+ GNUNET_break (0); /* database inconsistent */
+ TEH_plugin->rollback (TEH_plugin->cls,
+ session);
+ return TEH_RESPONSE_reply_internal_db_error (connection,
+ TALER_EC_WITHDRAW_RESERVE_HISTORY_IMPOSSIBLE);
+ }
if (0 < TALER_amount_cmp (&amount_required,
&balance))
{