summaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_reserve.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-01-17 20:20:28 +0100
committerChristian Grothoff <christian@grothoff.org>2020-01-17 20:20:28 +0100
commita064ca705efe56ded01bc59cf575f17792a4b452 (patch)
tree9d92f0b564d2e9a5ae632f752fb0274bfb6416f6 /src/lib/exchange_api_reserve.c
parent6c5155ca74287add72e7a9a79bf274f2adc4fb3a (diff)
downloadexchange-a064ca705efe56ded01bc59cf575f17792a4b452.tar.gz
exchange-a064ca705efe56ded01bc59cf575f17792a4b452.tar.bz2
exchange-a064ca705efe56ded01bc59cf575f17792a4b452.zip
check currencies match first
Diffstat (limited to 'src/lib/exchange_api_reserve.c')
-rw-r--r--src/lib/exchange_api_reserve.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/lib/exchange_api_reserve.c b/src/lib/exchange_api_reserve.c
index bb898b52..2f9b0e9d 100644
--- a/src/lib/exchange_api_reserve.c
+++ b/src/lib/exchange_api_reserve.c
@@ -224,7 +224,30 @@ parse_reserve_history (struct TALER_EXCHANGE_Handle *exchange,
GNUNET_JSON_parse_free (withdraw_spec);
return GNUNET_SYSERR;
}
- /* TODO: check that withdraw fee matches expectations! */
+ /* check that withdraw fee matches expectations! */
+ {
+ const struct TALER_EXCHANGE_Keys *key_state;
+ const struct TALER_EXCHANGE_DenomPublicKey *dki;
+ struct TALER_Amount fee;
+
+ key_state = TALER_EXCHANGE_get_keys (exchange);
+ dki = TALER_EXCHANGE_get_denomination_key_by_hash (key_state,
+ &withdraw_purpose.
+ h_denomination_pub);
+ TALER_amount_ntoh (&fee,
+ &withdraw_purpose.withdraw_fee);
+ if ( (GNUNET_YES !=
+ TALER_amount_cmp_currency (&fee,
+ &dki->fee_withdraw)) ||
+ (0 !=
+ TALER_amount_cmp (&fee,
+ &dki->fee_withdraw)) )
+ {
+ GNUNET_break_op (0);
+ GNUNET_JSON_parse_free (withdraw_spec);
+ return GNUNET_SYSERR;
+ }
+ }
rhistory[off].details.out_authorization_sig
= json_object_get (transaction,
"signature");