summaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-07-24 09:00:35 +0200
committerChristian Grothoff <christian@grothoff.org>2021-07-24 09:00:35 +0200
commit42decef957861689c41d16a0dcfa8af3d9052816 (patch)
treeed55c4e5a2e2a4b8d2880fe10c8f82173cf0a11e /src/exchange
parent325b60989faadb54213af578bb9b1b705d022726 (diff)
downloadexchange-42decef957861689c41d16a0dcfa8af3d9052816.tar.gz
exchange-42decef957861689c41d16a0dcfa8af3d9052816.tar.bz2
exchange-42decef957861689c41d16a0dcfa8af3d9052816.zip
fix #6939 in exchange
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c12
-rw-r--r--src/exchange/taler-exchange-httpd_management_wire_fees.c24
-rw-r--r--src/exchange/taler-exchange-httpd_melt.c13
-rw-r--r--src/exchange/taler-exchange-httpd_refund.c16
4 files changed, 5 insertions, 60 deletions
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c
index 8e93d998d..5e802fb0e 100644
--- a/src/exchange/taler-exchange-httpd_deposit.c
+++ b/src/exchange/taler-exchange-httpd_deposit.c
@@ -332,6 +332,7 @@ TEH_handler_deposit (struct MHD_Connection *connection,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_json ("wire", &wire),
TALER_JSON_spec_amount ("contribution",
+ TEH_currency,
&deposit.amount_with_fee),
GNUNET_JSON_spec_fixed_auto ("denom_pub_hash",
&deposit.coin.denom_pub_hash),
@@ -488,17 +489,6 @@ TEH_handler_deposit (struct MHD_Connection *connection,
}
deposit.deposit_fee = dk->meta.fee_deposit;
- if (GNUNET_YES !=
- TALER_amount_cmp_currency (&deposit.amount_with_fee,
- &deposit.deposit_fee) )
- {
- GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_CURRENCY_MISMATCH,
- deposit.deposit_fee.currency);
- }
/* check coin signature */
if (GNUNET_YES !=
TALER_test_coin_valid (&deposit.coin,
diff --git a/src/exchange/taler-exchange-httpd_management_wire_fees.c b/src/exchange/taler-exchange-httpd_management_wire_fees.c
index 0a011bc03..0a8bf4d1e 100644
--- a/src/exchange/taler-exchange-httpd_management_wire_fees.c
+++ b/src/exchange/taler-exchange-httpd_management_wire_fees.c
@@ -180,8 +180,10 @@ TEH_handler_management_post_wire_fees (
TALER_JSON_spec_absolute_time ("fee_end",
&afc.end_time),
TALER_JSON_spec_amount ("closing_fee",
+ TEH_currency,
&afc.closing_fee),
TALER_JSON_spec_amount ("wire_fee",
+ TEH_currency,
&afc.wire_fee),
GNUNET_JSON_spec_end ()
};
@@ -201,28 +203,6 @@ TEH_handler_management_post_wire_fees (
}
if (GNUNET_OK !=
- TALER_amount_cmp_currency (&afc.closing_fee,
- &afc.wire_fee))
- {
- /* currencies of the two fees must be identical */
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_CURRENCY_MISMATCH,
- NULL);
- }
- if (0 !=
- strcasecmp (afc.wire_fee.currency,
- TEH_currency))
- {
- /* currency does not match exchange's currency */
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_PRECONDITION_FAILED,
- TALER_EC_GENERIC_CURRENCY_MISMATCH,
- TEH_currency);
- }
-
- if (GNUNET_OK !=
TALER_exchange_offline_wire_fee_verify (
afc.wire_method,
afc.start_time,
diff --git a/src/exchange/taler-exchange-httpd_melt.c b/src/exchange/taler-exchange-httpd_melt.c
index a11d608bc..8e51a4174 100644
--- a/src/exchange/taler-exchange-httpd_melt.c
+++ b/src/exchange/taler-exchange-httpd_melt.c
@@ -554,18 +554,6 @@ check_for_denomination_key (struct MHD_Connection *connection,
rmc->coin_refresh_fee = dk->meta.fee_refresh;
rmc->coin_value = dk->meta.value;
- /* check client used sane currency */
- if (GNUNET_YES !=
- TALER_amount_cmp_currency (&rmc->refresh_session.amount_with_fee,
- &rmc->coin_value) )
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (
- connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_CURRENCY_MISMATCH,
- rmc->refresh_session.amount_with_fee.currency);
- }
/* check coin is actually properly signed */
if (GNUNET_OK !=
TALER_test_coin_valid (&rmc->refresh_session.coin,
@@ -621,6 +609,7 @@ TEH_handler_melt (struct MHD_Connection *connection,
GNUNET_JSON_spec_fixed_auto ("confirm_sig",
&rmc.refresh_session.coin_sig),
TALER_JSON_spec_amount ("value_with_fee",
+ TEH_currency,
&rmc.refresh_session.amount_with_fee),
GNUNET_JSON_spec_fixed_auto ("rc",
&rmc.refresh_session.rc),
diff --git a/src/exchange/taler-exchange-httpd_refund.c b/src/exchange/taler-exchange-httpd_refund.c
index d0865dd8e..35b179be4 100644
--- a/src/exchange/taler-exchange-httpd_refund.c
+++ b/src/exchange/taler-exchange-httpd_refund.c
@@ -312,21 +312,6 @@ refund_transaction (void *cls,
return GNUNET_DB_STATUS_HARD_ERROR;
}
- /* check currency is compatible */
- if (GNUNET_YES !=
- TALER_amount_cmp_currency (&refund->details.refund_amount,
- &deposit_total))
- {
- GNUNET_break_op (0); /* currency mismatch */
- TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
- tlx);
- *mhd_ret = TALER_MHD_reply_with_error (connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_CURRENCY_MISMATCH,
- deposit_total.currency);
- return GNUNET_DB_STATUS_HARD_ERROR;
- }
-
/* check total refund amount is sufficiently low */
if (refund_found)
GNUNET_break (0 <=
@@ -505,6 +490,7 @@ TEH_handler_refund (struct MHD_Connection *connection,
};
struct GNUNET_JSON_Specification spec[] = {
TALER_JSON_spec_amount ("refund_amount",
+ TEH_currency,
&refund.details.refund_amount),
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
&refund.details.h_contract_terms),