diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-11-23 19:29:50 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-11-23 19:29:50 +0100 |
commit | 7c11a822ba9ebce8a0dfe04510945ad36c0a0c71 (patch) | |
tree | da669686cbb123941562d99a6273f17c09984ef7 /src | |
parent | e8a88392da98c3325ba39b20901a5c220158d1f5 (diff) |
more libtalermhd refactoring
Diffstat (limited to 'src')
-rw-r--r-- | src/exchange/taler-exchange-httpd_payback.c | 69 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_refund.c | 110 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_reserve_status.c | 34 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_reserve_withdraw.c | 110 |
4 files changed, 178 insertions, 145 deletions
diff --git a/src/exchange/taler-exchange-httpd_payback.c b/src/exchange/taler-exchange-httpd_payback.c index b8adc950d..e8a179f1b 100644 --- a/src/exchange/taler-exchange-httpd_payback.c +++ b/src/exchange/taler-exchange-httpd_payback.c @@ -27,6 +27,7 @@ #include <microhttpd.h> #include <pthread.h> #include "taler_json_lib.h" +#include "taler_mhd_lib.h" #include "taler-exchange-httpd_parsing.h" #include "taler-exchange-httpd_payback.h" #include "taler-exchange-httpd_responses.h" @@ -68,24 +69,25 @@ reply_payback_refresh_success (struct MHD_Connection *connection, &pub, &sig)) { - return TEH_RESPONSE_reply_internal_error (connection, - TALER_EC_EXCHANGE_BAD_CONFIGURATION, - "no keys"); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_EXCHANGE_BAD_CONFIGURATION, + "no keys"); } - return TEH_RESPONSE_reply_json_pack (connection, - MHD_HTTP_OK, - "{s:o, s:o, s:o, s:o, s:o}", - "old_coin_pub", - GNUNET_JSON_from_data_auto ( - old_coin_pub), - "timestamp", GNUNET_JSON_from_time_abs ( - timestamp), - "amount", TALER_JSON_from_amount ( - amount), - "exchange_sig", - GNUNET_JSON_from_data_auto (&sig), - "exchange_pub", - GNUNET_JSON_from_data_auto (&pub)); + return TALER_MHD_reply_json_pack (connection, + MHD_HTTP_OK, + "{s:o, s:o, s:o, s:o, s:o}", + "old_coin_pub", + GNUNET_JSON_from_data_auto ( + old_coin_pub), + "timestamp", GNUNET_JSON_from_time_abs ( + timestamp), + "amount", TALER_JSON_from_amount ( + amount), + "exchange_sig", + GNUNET_JSON_from_data_auto (&sig), + "exchange_pub", + GNUNET_JSON_from_data_auto (&pub)); } @@ -122,23 +124,24 @@ reply_payback_success (struct MHD_Connection *connection, &pub, &sig)) { - return TEH_RESPONSE_reply_internal_error (connection, - TALER_EC_EXCHANGE_BAD_CONFIGURATION, - "no keys"); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_EXCHANGE_BAD_CONFIGURATION, + "no keys"); } - return TEH_RESPONSE_reply_json_pack (connection, - MHD_HTTP_OK, - "{s:o, s:o, s:o, s:o, s:o}", - "reserve_pub", - GNUNET_JSON_from_data_auto (reserve_pub), - "timestamp", GNUNET_JSON_from_time_abs ( - timestamp), - "amount", TALER_JSON_from_amount ( - amount), - "exchange_sig", - GNUNET_JSON_from_data_auto (&sig), - "exchange_pub", - GNUNET_JSON_from_data_auto (&pub)); + return TALER_MHD_reply_json_pack (connection, + MHD_HTTP_OK, + "{s:o, s:o, s:o, s:o, s:o}", + "reserve_pub", + GNUNET_JSON_from_data_auto (reserve_pub), + "timestamp", GNUNET_JSON_from_time_abs ( + timestamp), + "amount", TALER_JSON_from_amount ( + amount), + "exchange_sig", + GNUNET_JSON_from_data_auto (&sig), + "exchange_pub", + GNUNET_JSON_from_data_auto (&pub)); } diff --git a/src/exchange/taler-exchange-httpd_refund.c b/src/exchange/taler-exchange-httpd_refund.c index 48532a2ce..adc712c11 100644 --- a/src/exchange/taler-exchange-httpd_refund.c +++ b/src/exchange/taler-exchange-httpd_refund.c @@ -29,6 +29,7 @@ #include <microhttpd.h> #include <pthread.h> #include "taler_json_lib.h" +#include "taler_mhd_lib.h" #include "taler-exchange-httpd_parsing.h" #include "taler-exchange-httpd_refund.h" #include "taler-exchange-httpd_responses.h" @@ -66,17 +67,17 @@ reply_refund_success (struct MHD_Connection *connection, &pub, &sig)) { - return TEH_RESPONSE_reply_internal_error (connection, - TALER_EC_EXCHANGE_BAD_CONFIGURATION, - "no keys"); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_EXCHANGE_BAD_CONFIGURATION, + "no keys"); } - return TEH_RESPONSE_reply_json_pack (connection, - MHD_HTTP_OK, - "{s:s, s:o, s:o}", - "status", "REFUND_OK", - "sig", GNUNET_JSON_from_data_auto (&sig), - "pub", GNUNET_JSON_from_data_auto ( - &pub)); + return TALER_MHD_reply_json_pack (connection, + MHD_HTTP_OK, + "{s:s, s:o, s:o}", + "status", "REFUND_OK", + "sig", GNUNET_JSON_from_data_auto (&sig), + "pub", GNUNET_JSON_from_data_auto (&pub)); } @@ -94,11 +95,11 @@ reply_refund_failure (struct MHD_Connection *connection, unsigned int response_code, enum TALER_ErrorCode ec) { - return TEH_RESPONSE_reply_json_pack (connection, - response_code, - "{s:s, s:I}", - "status", "refund failure", - "code", (json_int_t) ec); + return TALER_MHD_reply_json_pack (connection, + response_code, + "{s:s, s:I}", + "hint", "refund failure", + "code", (json_int_t) ec); } @@ -114,15 +115,15 @@ static int reply_refund_conflict (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_TransactionList *tl) { - return TEH_RESPONSE_reply_json_pack (connection, - MHD_HTTP_CONFLICT, - "{s:s, s:I, s:o}", - "status", "conflicting refund", - "code", - (json_int_t) TALER_EC_REFUND_CONFLICT, - "history", - TEH_RESPONSE_compile_transaction_history ( - tl)); + return TALER_MHD_reply_json_pack (connection, + MHD_HTTP_CONFLICT, + "{s:s, s:I, s:o}", + "hint", "conflicting refund", + "code", + (json_int_t) TALER_EC_REFUND_CONFLICT, + "history", + TEH_RESPONSE_compile_transaction_history ( + tl)); } @@ -259,8 +260,10 @@ refund_transaction (void *cls, TALER_LOG_WARNING ("Deposit to /refund was not found\n"); TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); - *mhd_ret = TEH_RESPONSE_reply_transaction_unknown (connection, - TALER_EC_REFUND_DEPOSIT_NOT_FOUND); + *mhd_ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_NOT_FOUND, + TALER_EC_REFUND_DEPOSIT_NOT_FOUND, + "deposit unknown"); return GNUNET_DB_STATUS_HARD_ERROR; } /* handle if conflicting refund found */ @@ -309,9 +312,10 @@ refund_transaction (void *cls, GNUNET_break (0); TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); - *mhd_ret = TEH_RESPONSE_reply_internal_error (connection, - TALER_EC_REFUND_DB_INCONSISTENT, - "database inconsistent"); + *mhd_ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_REFUND_DB_INCONSISTENT, + "database inconsistent"); return qs; } if (GNUNET_DB_STATUS_SOFT_ERROR == qs) @@ -349,9 +353,10 @@ refund_transaction (void *cls, TALER_LOG_ERROR ("Lacking keys to operate\n"); TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); - *mhd_ret = TEH_RESPONSE_reply_internal_error (connection, - TALER_EC_EXCHANGE_BAD_CONFIGURATION, - "no keys"); + *mhd_ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_EXCHANGE_BAD_CONFIGURATION, + "no keys"); return GNUNET_DB_STATUS_HARD_ERROR; } dki = TEH_KS_denomination_key_lookup_by_hash (mks, @@ -367,9 +372,10 @@ refund_transaction (void *cls, TEH_KS_release (mks); TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); - *mhd_ret = TEH_RESPONSE_reply_with_error (connection, - ec, - hc); + *mhd_ret = TALER_MHD_reply_with_error (connection, + ec, + hc, + "denomination not found, but coin known"); return GNUNET_DB_STATUS_HARD_ERROR; } TALER_amount_ntoh (&expect_fee, @@ -382,9 +388,10 @@ refund_transaction (void *cls, { TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); - *mhd_ret = TEH_RESPONSE_reply_arg_invalid (connection, - TALER_EC_REFUND_FEE_TOO_LOW, - "refund_fee"); + *mhd_ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_REFUND_FEE_TOO_LOW, + "refund_fee"); return GNUNET_DB_STATUS_HARD_ERROR; } if (1 == fee_cmp) @@ -402,8 +409,10 @@ refund_transaction (void *cls, if (GNUNET_DB_STATUS_HARD_ERROR == qs) { TALER_LOG_WARNING ("Failed to store /refund information in database\n"); - *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection, - TALER_EC_REFUND_STORE_DB_ERROR); + *mhd_ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_REFUND_STORE_DB_ERROR, + "could not persist store information"); return qs; } /* Success or soft failure */ @@ -443,17 +452,19 @@ verify_and_execute_refund (struct MHD_Connection *connection, &refund->refund_fee) ) { GNUNET_break_op (0); - return TEH_RESPONSE_reply_arg_invalid (connection, - TALER_EC_REFUND_FEE_CURRENCY_MISSMATCH, - "refund_fee"); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_REFUND_FEE_CURRENCY_MISSMATCH, + "refund_fee"); } if (-1 == TALER_amount_cmp (&refund->refund_amount, &refund->refund_fee) ) { GNUNET_break_op (0); - return TEH_RESPONSE_reply_arg_invalid (connection, - TALER_EC_REFUND_FEE_ABOVE_AMOUNT, - "refund_amount"); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_REFUND_FEE_ABOVE_AMOUNT, + "refund_amount"); } if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_REFUND, @@ -462,9 +473,10 @@ verify_and_execute_refund (struct MHD_Connection *connection, &refund->merchant_pub.eddsa_pub)) { TALER_LOG_WARNING ("Invalid signature on /refund request\n"); - return TEH_RESPONSE_reply_signature_invalid (connection, - TALER_EC_REFUND_MERCHANT_SIGNATURE_INVALID, - "merchant_sig"); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_FORBIDDEN, + TALER_EC_REFUND_MERCHANT_SIGNATURE_INVALID, + "merchant_sig"); } if (GNUNET_OK != TEH_DB_run_transaction (connection, diff --git a/src/exchange/taler-exchange-httpd_reserve_status.c b/src/exchange/taler-exchange-httpd_reserve_status.c index 4f9761485..0e46c0b24 100644 --- a/src/exchange/taler-exchange-httpd_reserve_status.c +++ b/src/exchange/taler-exchange-httpd_reserve_status.c @@ -23,6 +23,7 @@ #include "platform.h" #include <gnunet/gnunet_util_lib.h> #include <jansson.h> +#include "taler_mhd_lib.h" #include "taler-exchange-httpd_reserve_status.h" #include "taler-exchange-httpd_parsing.h" #include "taler-exchange-httpd_responses.h" @@ -47,15 +48,16 @@ reply_reserve_status_success (struct MHD_Connection *connection, json_history = TEH_RESPONSE_compile_reserve_history (rh, &balance); if (NULL == json_history) - return TEH_RESPONSE_reply_internal_error (connection, - TALER_EC_RESERVE_STATUS_DB_ERROR, - "balance calculation failure"); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_RESERVE_STATUS_DB_ERROR, + "balance calculation failure"); json_balance = TALER_JSON_from_amount (&balance); - return TEH_RESPONSE_reply_json_pack (connection, - MHD_HTTP_OK, - "{s:o, s:o}", - "balance", json_balance, - "history", json_history); + return TALER_MHD_reply_json_pack (connection, + MHD_HTTP_OK, + "{s:o, s:o}", + "balance", json_balance, + "history", json_history); } @@ -155,14 +157,14 @@ TEH_RESERVE_handler_reserve_status (struct TEH_RequestHandler *rh, /* generate proper response */ if (NULL == rsc.rh) - return TEH_RESPONSE_reply_json_pack (connection, - MHD_HTTP_NOT_FOUND, - "{s:s, s:s, s:I}", - "error", "Reserve not found", - "parameter", "withdraw_pub", - "code", - (json_int_t) - TALER_EC_RESERVE_STATUS_UNKNOWN); + return TALER_MHD_reply_json_pack (connection, + MHD_HTTP_NOT_FOUND, + "{s:s, s:s, s:I}", + "error", "Reserve not found", + "parameter", "withdraw_pub", + "code", + (json_int_t) + TALER_EC_RESERVE_STATUS_UNKNOWN); mhd_ret = reply_reserve_status_success (connection, rsc.rh); TEH_plugin->free_reserve_history (TEH_plugin->cls, diff --git a/src/exchange/taler-exchange-httpd_reserve_withdraw.c b/src/exchange/taler-exchange-httpd_reserve_withdraw.c index 578aace31..229da564a 100644 --- a/src/exchange/taler-exchange-httpd_reserve_withdraw.c +++ b/src/exchange/taler-exchange-httpd_reserve_withdraw.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014-2017 GNUnet e.V. + Copyright (C) 2014-2019 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as @@ -16,7 +16,6 @@ Public License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ - /** * @file taler-exchange-httpd_reserve_withdraw.c * @brief Handle /reserve/withdraw requests @@ -27,6 +26,7 @@ #include "platform.h" #include <gnunet/gnunet_util_lib.h> #include <jansson.h> +#include "taler_mhd_lib.h" #include "taler-exchange-httpd_reserve_withdraw.h" #include "taler-exchange-httpd_parsing.h" #include "taler-exchange-httpd_responses.h" @@ -65,20 +65,21 @@ reply_reserve_withdraw_insufficient_funds (struct MHD_Connection *connection, /* Address the case where the ptr is not null, but * it fails "internally" to dump as string (= corrupted). */ || (0 == json_dumpb (json_history, NULL, 0, 0))) - return TEH_RESPONSE_reply_internal_error (connection, - TALER_EC_WITHDRAW_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS, - "balance calculation failure"); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_WITHDRAW_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS, + "balance calculation failure"); json_balance = TALER_JSON_from_amount (&balance); - return TEH_RESPONSE_reply_json_pack (connection, - MHD_HTTP_FORBIDDEN, - "{s:s, s:I, s:o, s:o}", - "error", "Insufficient funds", - "code", - (json_int_t) - TALER_EC_WITHDRAW_INSUFFICIENT_FUNDS, - "balance", json_balance, - "history", json_history); + return TALER_MHD_reply_json_pack (connection, + MHD_HTTP_FORBIDDEN, + "{s:s, s:I, s:o, s:o}", + "error", "Insufficient funds", + "code", + (json_int_t) + TALER_EC_WITHDRAW_INSUFFICIENT_FUNDS, + "balance", json_balance, + "history", json_history); } @@ -98,10 +99,10 @@ reply_reserve_withdraw_success (struct MHD_Connection *connection, json_t *sig_json; sig_json = GNUNET_JSON_from_rsa_signature (collectable->sig.rsa_signature); - return TEH_RESPONSE_reply_json_pack (connection, - MHD_HTTP_OK, - "{s:o}", - "ev_sig", sig_json); + return TALER_MHD_reply_json_pack (connection, + MHD_HTTP_OK, + "{s:o}", + "ev_sig", sig_json); } @@ -209,8 +210,10 @@ withdraw_transaction (void *cls, { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); if (GNUNET_DB_STATUS_HARD_ERROR == qs) - *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection, - TALER_EC_WITHDRAW_DB_FETCH_ERROR); + *mhd_ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_WITHDRAW_DB_FETCH_ERROR, + "failed to fetch withdraw data"); wc->collectable.sig = denom_sig; return qs; } @@ -252,15 +255,18 @@ withdraw_transaction (void *cls, if (0 > qs) { if (GNUNET_DB_STATUS_HARD_ERROR == qs) - *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection, - TALER_EC_WITHDRAW_DB_FETCH_ERROR); + *mhd_ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_WITHDRAW_DB_FETCH_ERROR, + "failed to fetch reserve data"); return qs; } if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) { - *mhd_ret = TEH_RESPONSE_reply_arg_unknown (connection, - TALER_EC_WITHDRAW_RESERVE_UNKNOWN, - "reserve_pub"); + *mhd_ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_NOT_FOUND, + TALER_EC_WITHDRAW_RESERVE_UNKNOWN, + "reserve_pub"); return GNUNET_DB_STATUS_HARD_ERROR; } if (0 < TALER_amount_cmp (&wc->amount_required, @@ -286,8 +292,10 @@ withdraw_transaction (void *cls, if (NULL == rh) { if (GNUNET_DB_STATUS_HARD_ERROR == qs) - *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection, - TALER_EC_WITHDRAW_DB_FETCH_ERROR); + *mhd_ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_WITHDRAW_DB_FETCH_ERROR, + "failed to fetch reserve history"); return GNUNET_DB_STATUS_HARD_ERROR; } *mhd_ret = reply_reserve_withdraw_insufficient_funds (connection, @@ -308,9 +316,10 @@ withdraw_transaction (void *cls, if (NULL == wc->collectable.sig.rsa_signature) { GNUNET_break (0); - *mhd_ret = TEH_RESPONSE_reply_internal_error (connection, - TALER_EC_WITHDRAW_SIGNATURE_FAILED, - "Internal error"); + *mhd_ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_WITHDRAW_SIGNATURE_FAILED, + "Failed to create signature"); return GNUNET_DB_STATUS_HARD_ERROR; } } @@ -330,8 +339,10 @@ withdraw_transaction (void *cls, { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); if (GNUNET_DB_STATUS_HARD_ERROR == qs) - *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection, - TALER_EC_WITHDRAW_DB_STORE_ERROR); + *mhd_ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_WITHDRAW_DB_STORE_ERROR, + "failed to persist withdraw data"); return qs; } return qs; @@ -403,9 +414,10 @@ TEH_RESERVE_handler_reserve_withdraw (struct TEH_RequestHandler *rh, { TALER_LOG_ERROR ("Lacking keys to operate\n"); GNUNET_JSON_parse_free (spec); - return TEH_RESPONSE_reply_internal_error (connection, - TALER_EC_EXCHANGE_BAD_CONFIGURATION, - "no keys"); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_EXCHANGE_BAD_CONFIGURATION, + "no keys"); } wc.dki = TEH_KS_denomination_key_lookup_by_hash (wc.key_state, &wc.denom_pub_hash, @@ -416,9 +428,10 @@ TEH_RESERVE_handler_reserve_withdraw (struct TEH_RequestHandler *rh, { GNUNET_JSON_parse_free (spec); TEH_KS_release (wc.key_state); - return TEH_RESPONSE_reply_with_error (connection, - ec, - hc); + return TALER_MHD_reply_with_error (connection, + ec, + hc, + "could not find denomination key"); } GNUNET_assert (NULL != wc.dki->denom_priv.rsa_private_key); TALER_amount_ntoh (&amount, @@ -432,9 +445,10 @@ TEH_RESERVE_handler_reserve_withdraw (struct TEH_RequestHandler *rh, { GNUNET_JSON_parse_free (spec); TEH_KS_release (wc.key_state); - return TEH_RESPONSE_reply_internal_error (connection, - TALER_EC_WITHDRAW_AMOUNT_FEE_OVERFLOW, - "amount overflow for value plus withdraw fee"); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_WITHDRAW_AMOUNT_FEE_OVERFLOW, + "amount overflow for value plus withdraw fee"); } TALER_amount_hton (&wc.wsrd.amount_with_fee, &wc.amount_required); @@ -460,9 +474,10 @@ TEH_RESERVE_handler_reserve_withdraw (struct TEH_RequestHandler *rh, "Client supplied invalid signature for /reserve/withdraw request\n"); GNUNET_JSON_parse_free (spec); TEH_KS_release (wc.key_state); - return TEH_RESPONSE_reply_signature_invalid (connection, - TALER_EC_WITHDRAW_RESERVE_SIGNATURE_INVALID, - "reserve_sig"); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_FORBIDDEN, + TALER_EC_WITHDRAW_RESERVE_SIGNATURE_INVALID, + "reserve_sig"); } #if OPTIMISTIC_SIGN @@ -476,9 +491,10 @@ TEH_RESERVE_handler_reserve_withdraw (struct TEH_RequestHandler *rh, GNUNET_break (0); GNUNET_JSON_parse_free (spec); TEH_KS_release (wc.key_state); - return TEH_RESPONSE_reply_internal_error (connection, - TALER_EC_WITHDRAW_SIGNATURE_FAILED, - "Internal error"); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_WITHDRAW_SIGNATURE_FAILED, + "Failed to sign"); } #endif |