From 7910ca183f40a544dae4add5e7b5ff4775e65e12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Kesim?= Date: Tue, 22 Feb 2022 18:35:10 +0100 Subject: double melt test no works with age restriction - added missing field h_age_commitment in exchange's error response - slight refactoring --- src/lib/exchange_api_common.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'src/lib') diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c index b7a43bbc8..160f62dc6 100644 --- a/src/lib/exchange_api_common.c +++ b/src/lib/exchange_api_common.c @@ -477,7 +477,7 @@ TALER_EXCHANGE_verify_coin_history ( struct TALER_MerchantPublicKeyP merchant_pub; struct GNUNET_TIME_Timestamp refund_deadline = {0}; struct TALER_CoinSpendSignatureP sig; - struct TALER_AgeCommitmentHash *hac = NULL; + struct TALER_AgeCommitmentHash hac = {0}; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("coin_sig", &sig), @@ -487,6 +487,9 @@ TALER_EXCHANGE_verify_coin_history ( &h_wire), GNUNET_JSON_spec_fixed_auto ("h_denom_pub", h_denom_pub), + GNUNET_JSON_spec_mark_optional ( + GNUNET_JSON_spec_fixed_auto ("h_age_commitment", + &hac)), GNUNET_JSON_spec_timestamp ("timestamp", &wallet_timestamp), GNUNET_JSON_spec_mark_optional ( @@ -508,18 +511,19 @@ TALER_EXCHANGE_verify_coin_history ( return GNUNET_SYSERR; } if (GNUNET_OK != - TALER_wallet_deposit_verify (&amount, - &fee, - &h_wire, - &h_contract_terms, - hac, - NULL /* h_extensions! */, - h_denom_pub, - wallet_timestamp, - &merchant_pub, - refund_deadline, - coin_pub, - &sig)) + TALER_wallet_deposit_verify ( + &amount, + &fee, + &h_wire, + &h_contract_terms, + TALER_AgeCommitmentHash_isNullOrZero (&hac) ? NULL : &hac, + NULL /* h_extensions! */, + h_denom_pub, + wallet_timestamp, + &merchant_pub, + refund_deadline, + coin_pub, + &sig)) { GNUNET_break_op (0); return GNUNET_SYSERR; -- cgit v1.2.3