From 04f2e9a4d5b64000b5e29b4603c9bc57c732c4f7 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 14 Dec 2020 17:12:25 +0100 Subject: (start to) remove logic no longer needed with new key management --- src/exchange/taler-exchange-httpd_refund.c | 67 +++++++++++------------------- 1 file changed, 25 insertions(+), 42 deletions(-) (limited to 'src/exchange/taler-exchange-httpd_refund.c') diff --git a/src/exchange/taler-exchange-httpd_refund.c b/src/exchange/taler-exchange-httpd_refund.c index 6bb943483..ace6e28f4 100644 --- a/src/exchange/taler-exchange-httpd_refund.c +++ b/src/exchange/taler-exchange-httpd_refund.c @@ -32,7 +32,6 @@ #include "taler_mhd_lib.h" #include "taler-exchange-httpd_refund.h" #include "taler-exchange-httpd_responses.h" -#include "taler-exchange-httpd_keystate.h" #include "taler-exchange-httpd_keys.h" @@ -448,52 +447,36 @@ verify_and_execute_refund (struct MHD_Connection *connection, } { - struct TEH_KS_StateHandle *key_state; - - key_state = TEH_KS_acquire (GNUNET_TIME_absolute_get ()); - if (NULL == key_state) + /* Obtain information about the coin's denomination! */ + struct TEH_DenominationKey *dk; + unsigned int hc; + enum TALER_ErrorCode ec; + + dk = TEH_keys_denomination_by_hash (&denom_hash, + &ec, + &hc); + if (NULL == dk) { - TALER_LOG_ERROR ("Lacking keys to operate\n"); + /* DKI not found, but we do have a coin with this DK in our database; + not good... */ + GNUNET_break (0); return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_EXCHANGE_GENERIC_BAD_CONFIGURATION, - "no keys"); + hc, + ec, + NULL); } - /* Obtain information about the coin's denomination! */ - { - struct TEH_DenominationKey *dk; - unsigned int hc; - enum TALER_ErrorCode ec; - - dk = TEH_keys_denomination_by_hash (&denom_hash, - &ec, - &hc); - if (NULL == dk) - { - /* DKI not found, but we do have a coin with this DK in our database; - not good... */ - GNUNET_break (0); - TEH_KS_release (key_state); - return TALER_MHD_reply_with_error (connection, - hc, - ec, - NULL); - } - if (GNUNET_TIME_absolute_get ().abs_value_us >= - dk->meta.expire_deposit.abs_value_us) - { - /* This denomination is past the expiration time for deposits, and thus refunds */ - TEH_KS_release (key_state); - return TALER_MHD_reply_with_error ( - connection, - MHD_HTTP_GONE, - TALER_EC_EXCHANGE_GENERIC_DENOMINATION_EXPIRED, - NULL); - } - refund->details.refund_fee = dk->meta.fee_refund; + if (GNUNET_TIME_absolute_get ().abs_value_us >= + dk->meta.expire_deposit.abs_value_us) + { + /* This denomination is past the expiration time for deposits, and thus refunds */ + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_GONE, + TALER_EC_EXCHANGE_GENERIC_DENOMINATION_EXPIRED, + NULL); } - TEH_KS_release (key_state); + refund->details.refund_fee = dk->meta.fee_refund; } /* Finally run the actual transaction logic */ -- cgit v1.2.3