fix handling of withdraw failure

This commit is contained in:
Christian Grothoff 2018-08-19 18:03:52 +02:00
parent 121a0692ea
commit 755f4cb4a9
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -217,8 +217,6 @@ withdraw_transaction (void *cls,
GNUNET_assert (0 == qs); GNUNET_assert (0 == qs);
wc->collectable.sig = denom_sig; wc->collectable.sig = denom_sig;
/* Check if balance is sufficient */ /* Check if balance is sufficient */
r.pub = wc->wsrd.reserve_pub; r.pub = wc->wsrd.reserve_pub;
qs = TEH_plugin->reserve_get (TEH_plugin->cls, qs = TEH_plugin->reserve_get (TEH_plugin->cls,
@ -238,7 +236,6 @@ withdraw_transaction (void *cls,
"reserve_pub"); "reserve_pub");
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
if (0 < TALER_amount_cmp (&wc->amount_required, if (0 < TALER_amount_cmp (&wc->amount_required,
&r.balance)) &r.balance))
{ {
@ -249,12 +246,12 @@ withdraw_transaction (void *cls,
session, session,
&wc->wsrd.reserve_pub, &wc->wsrd.reserve_pub,
&rh); &rh);
if (0 >= qs) if (NULL == rh)
{ {
if (GNUNET_DB_STATUS_HARD_ERROR == qs) if (GNUNET_DB_STATUS_HARD_ERROR == qs)
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection, *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
TALER_EC_WITHDRAW_DB_FETCH_ERROR); TALER_EC_WITHDRAW_DB_FETCH_ERROR);
return qs; return GNUNET_DB_STATUS_HARD_ERROR;
} }
*mhd_ret = reply_reserve_withdraw_insufficient_funds (connection, *mhd_ret = reply_reserve_withdraw_insufficient_funds (connection,
rh); rh);