summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_db.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchange/taler-exchange-httpd_db.c')
-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))
{