diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2023-10-15 23:30:51 +0200 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2023-10-15 23:30:51 +0200 |
commit | 917dd4d70ff2f38d475146b387e649a669996f10 (patch) | |
tree | 2550f23c5d9418bdaae7c5b7b328d9e5c60e226b /src/exchange/taler-exchange-httpd_responses.c | |
parent | c72cf2ce10017dccc342c4ea86ac2b006aa54149 (diff) | |
download | exchange-917dd4d70ff2f38d475146b387e649a669996f10.tar.gz exchange-917dd4d70ff2f38d475146b387e649a669996f10.tar.bz2 exchange-917dd4d70ff2f38d475146b387e649a669996f10.zip |
avoid extra transaction to fetch balance if reserve is out of funds, remove legacy /withdraw endpoint
Diffstat (limited to 'src/exchange/taler-exchange-httpd_responses.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_responses.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c index 2d5d8dce9..322da3877 100644 --- a/src/exchange/taler-exchange-httpd_responses.c +++ b/src/exchange/taler-exchange-httpd_responses.c @@ -181,31 +181,16 @@ MHD_RESULT TEH_RESPONSE_reply_reserve_insufficient_balance ( struct MHD_Connection *connection, enum TALER_ErrorCode ec, + const struct TALER_Amount *reserve_balance, const struct TALER_Amount *balance_required, const struct TALER_ReservePublicKeyP *reserve_pub) { - struct TALER_Amount balance; - enum GNUNET_DB_QueryStatus qs; - - // FIXME: pass balance as argument to this function, - // instead of getting it in another transaction! - qs = TEH_plugin->get_reserve_balance (TEH_plugin->cls, - reserve_pub, - &balance); - if (qs < 0) - { - GNUNET_break (0); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_FETCH_FAILED, - "reserve balance"); - } return TALER_MHD_REPLY_JSON_PACK ( connection, MHD_HTTP_CONFLICT, TALER_JSON_pack_ec (ec), TALER_JSON_pack_amount ("balance", - &balance), + reserve_balance), TALER_JSON_pack_amount ("requested_amount", balance_required)); } |