check currencies match first
This commit is contained in:
parent
6c5155ca74
commit
a064ca705e
@ -139,9 +139,12 @@ TALER_EXCHANGE_verify_coin_history (const struct
|
|||||||
/* check that deposit fee matches our expectations from /keys! */
|
/* check that deposit fee matches our expectations from /keys! */
|
||||||
TALER_amount_ntoh (&fee,
|
TALER_amount_ntoh (&fee,
|
||||||
&dr.deposit_fee);
|
&dr.deposit_fee);
|
||||||
if (0 !=
|
if ( (GNUNET_YES !=
|
||||||
TALER_amount_cmp (&fee,
|
TALER_amount_cmp_currency (&fee,
|
||||||
&dk->fee_deposit))
|
&dki->fee_deposit)) ||
|
||||||
|
(0 !=
|
||||||
|
TALER_amount_cmp (&fee,
|
||||||
|
&dk->fee_deposit)) )
|
||||||
{
|
{
|
||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
@ -188,9 +191,12 @@ TALER_EXCHANGE_verify_coin_history (const struct
|
|||||||
/* check that melt fee matches our expectations from /keys! */
|
/* check that melt fee matches our expectations from /keys! */
|
||||||
TALER_amount_ntoh (&fee,
|
TALER_amount_ntoh (&fee,
|
||||||
&rm.melt_fee);
|
&rm.melt_fee);
|
||||||
if (0 !=
|
if ( (GNUNET_YES !=
|
||||||
TALER_amount_cmp (&fee,
|
TALER_amount_cmp_currency (&fee,
|
||||||
&dk->fee_refresh))
|
&dki->fee_refresh)) ||
|
||||||
|
(0 !=
|
||||||
|
TALER_amount_cmp (&fee,
|
||||||
|
&dk->fee_refresh)) )
|
||||||
{
|
{
|
||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
@ -249,9 +255,12 @@ TALER_EXCHANGE_verify_coin_history (const struct
|
|||||||
/* check that refund fee matches our expectations from /keys! */
|
/* check that refund fee matches our expectations from /keys! */
|
||||||
TALER_amount_ntoh (&fee,
|
TALER_amount_ntoh (&fee,
|
||||||
&rr.refund_fee);
|
&rr.refund_fee);
|
||||||
if (0 !=
|
if ( (GNUNET_YES !=
|
||||||
TALER_amount_cmp (&fee,
|
TALER_amount_cmp_currency (&fee,
|
||||||
&dk->fee_refund))
|
&dki->fee_refund)) ||
|
||||||
|
(0 !=
|
||||||
|
TALER_amount_cmp (&fee,
|
||||||
|
&dk->fee_refund)) )
|
||||||
{
|
{
|
||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
|
@ -224,7 +224,30 @@ parse_reserve_history (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
GNUNET_JSON_parse_free (withdraw_spec);
|
GNUNET_JSON_parse_free (withdraw_spec);
|
||||||
return GNUNET_SYSERR;
|
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
|
rhistory[off].details.out_authorization_sig
|
||||||
= json_object_get (transaction,
|
= json_object_get (transaction,
|
||||||
"signature");
|
"signature");
|
||||||
|
Loading…
Reference in New Issue
Block a user