diff --git a/src/exchange/taler-exchange-httpd_age-withdraw.c b/src/exchange/taler-exchange-httpd_age-withdraw.c index 60bc5fec2..8a2a409eb 100644 --- a/src/exchange/taler-exchange-httpd_age-withdraw.c +++ b/src/exchange/taler-exchange-httpd_age-withdraw.c @@ -35,6 +35,7 @@ #include "taler-exchange-httpd_age-withdraw.h" #include "taler-exchange-httpd_responses.h" #include "taler-exchange-httpd_keys.h" +#include "taler_util.h" /** @@ -104,7 +105,7 @@ free_age_withdraw_context_resources (struct AgeWithdrawContext *awc) * Parse the denominations and blinded coin data of an '/age-withdraw' request. * * @param connection The MHD connection to handle - * @param j_denoms_h Array of n hashes of the denominations for the withdrawal, in JSON format + * @param j_denom_hs Array of n hashes of the denominations for the withdrawal, in JSON format * @param j_blinded_coin_evs Array of n arrays of kappa blinded envelopes of in JSON format for the coins. * @param[out] awc The context of the operation, only partially built at call time * @param[out] mhd_ret The result if a reply is queued for MHD @@ -122,6 +123,7 @@ parse_age_withdraw_json ( const char *error = NULL; unsigned int idx = 0; json_t *value = NULL; + struct GNUNET_HashContext *hash_context; /* The age value MUST be on the beginning of an age group */ @@ -160,6 +162,7 @@ parse_age_withdraw_json ( goto EXIT; awc->num_coins = num_coins; + awc->commitment.num_coins = num_coins; } /* Continue parsing the parts */ @@ -194,6 +197,9 @@ parse_age_withdraw_json ( awc->coin_evs = GNUNET_new_array (awc->num_coins * TALER_CNC_KAPPA, struct TALER_BlindedPlanchet); + hash_context = GNUNET_CRYPTO_hash_context_start (); + GNUNET_assert (NULL != hash_context); + /* Parse blinded envelopes. */ json_array_foreach (j_blinded_coin_evs, idx, value) { const json_t *j_kappa_coin_evs = value; @@ -222,9 +228,6 @@ parse_age_withdraw_json ( size_t off = idx * TALER_CNC_KAPPA; unsigned int kappa = 0; enum GNUNET_GenericReturnValue ret; - struct GNUNET_HashContext *hash_context; - - hash_context = GNUNET_CRYPTO_hash_context_start (); json_array_foreach (j_kappa_coin_evs, kappa, value) { struct GNUNET_JSON_Specification spec[] = { @@ -271,12 +274,13 @@ parse_age_withdraw_json ( } } - /* Finally, calculate the h_commitment from all blinded envelopes */ - GNUNET_CRYPTO_hash_context_finish (hash_context, - &awc->commitment.h_commitment.hash); } }; /* json_array_foreach over j_blinded_coin_evs */ + /* Finally, calculate the h_commitment from all blinded envelopes */ + GNUNET_CRYPTO_hash_context_finish (hash_context, + &awc->commitment.h_commitment.hash); + GNUNET_assert (NULL == error); @@ -739,27 +743,6 @@ age_withdraw_transaction (void *cls, &allowed_maximum_age, &reserve_birthday, &conflict); - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "XXXXXXX got from do_age_withdraw:" - "\n\tqs: %d" - "\n\tcommitment: %s" - "\n\tmax_age: %d" - "\n\tfound: %d" - "\n\tbalance_ok: %d" - "\n\tage_ok: %d" - "\n\tallowed_maximum_age: %d" - "\n\treserve_birthday: %d" - "\n\tconflict: %d\n", - qs, - GNUNET_h2s (&awc->commitment.h_commitment.hash), - awc->commitment.max_age, - found, - balance_ok, - age_ok, - allowed_maximum_age, - reserve_birthday, - conflict); - if (0 > qs) { if (GNUNET_DB_STATUS_HARD_ERROR == qs) diff --git a/src/lib/exchange_api_age_withdraw.c b/src/lib/exchange_api_age_withdraw.c index bd84dcb32..f510bdbae 100644 --- a/src/lib/exchange_api_age_withdraw.c +++ b/src/lib/exchange_api_age_withdraw.c @@ -724,14 +724,6 @@ perform_protocol ( awbh->reserve_priv, &awbh->reserve_sig); - GNUNET_assert (GNUNET_OK == - TALER_wallet_age_withdraw_verify (&awbh->h_commitment, - &awbh->amount_with_fee, - &awbh->age_mask, - awbh->max_age, - &awbh->reserve_pub, - &awbh->reserve_sig)); - /* Initiate the POST-request */ j_request_body = GNUNET_JSON_PACK ( GNUNET_JSON_pack_array_steal ("denom_hs", j_denoms), diff --git a/src/testing/test_exchange_api_age_restriction.c b/src/testing/test_exchange_api_age_restriction.c index b3f7357f7..56e46b22a 100644 --- a/src/testing/test_exchange_api_age_restriction.c +++ b/src/testing/test_exchange_api_age_restriction.c @@ -258,10 +258,10 @@ run (void *cls, */ struct TALER_TESTING_Command age_withdraw[] = { CMD_TRANSFER_TO_EXCHANGE ("create-reserve-kyc-1", - "EUR:20.02"), + "EUR:30.02"), TALER_TESTING_cmd_check_bank_admin_transfer ( "check-create-reserve-1", - "EUR:20.02", + "EUR:30.02", cred.user42_payto, cred.exchange_payto, "create-reserve-kyc-1"), @@ -295,6 +295,8 @@ run (void *cls, 8, MHD_HTTP_OK, "EUR:10", + "EUR:5", + "EUR:5", NULL), TALER_TESTING_cmd_end (), }; diff --git a/src/testing/testing_api_cmd_age_withdraw.c b/src/testing/testing_api_cmd_age_withdraw.c index 9b7bfd209..98a5e1d85 100644 --- a/src/testing/testing_api_cmd_age_withdraw.c +++ b/src/testing/testing_api_cmd_age_withdraw.c @@ -294,7 +294,7 @@ age_withdraw_run ( if (NULL == dpk) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to determine denomination key at %s\n", + "Failed to determine denomination key for amount at %s\n", (NULL != cmd) ? cmd->label : ""); GNUNET_break (0); TALER_TESTING_interpreter_fail (is);