got testing_api_cmd_refresh to compile
This commit is contained in:
parent
4a575f5044
commit
2164c36f0f
@ -1479,10 +1479,10 @@ TALER_planchet_setup_refresh (const struct TALER_TransferSecretP *secret_seed,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup information for a fresh coin.
|
* Setup information for fresh coins to be withdrawn
|
||||||
|
* or refreshed.
|
||||||
*
|
*
|
||||||
* @param[out] ps value to initialize
|
* @param[out] ps value to initialize
|
||||||
* @oaram alg_values WitdrawValues containing cipher
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
TALER_planchet_setup_random (
|
TALER_planchet_setup_random (
|
||||||
|
@ -1411,6 +1411,12 @@ struct TALER_EXCHANGE_WithdrawResponse
|
|||||||
*/
|
*/
|
||||||
struct TALER_CoinSpendPrivateKeyP coin_priv;
|
struct TALER_CoinSpendPrivateKeyP coin_priv;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value used to blind the key for the signature.
|
||||||
|
* Needed for recoup operations.
|
||||||
|
*/
|
||||||
|
union TALER_DenominationBlindingKeyP bks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signature over the coin.
|
* Signature over the coin.
|
||||||
*/
|
*/
|
||||||
@ -1634,6 +1640,7 @@ struct TALER_EXCHANGE_MeltHandle;
|
|||||||
* @param hr HTTP response data
|
* @param hr HTTP response data
|
||||||
* @param num_coins number of fresh coins to be created, length of the @a exchange_vals array, 0 if the operation failed
|
* @param num_coins number of fresh coins to be created, length of the @a exchange_vals array, 0 if the operation failed
|
||||||
* @param alg_values array @a num_coins of exchange values contributed to the refresh operation
|
* @param alg_values array @a num_coins of exchange values contributed to the refresh operation
|
||||||
|
* @param bks array of @a num_coins blinding keys used to blind the fresh coins
|
||||||
* @param noreveal_index choice by the exchange in the cut-and-choose protocol,
|
* @param noreveal_index choice by the exchange in the cut-and-choose protocol,
|
||||||
* UINT32_MAX on error
|
* UINT32_MAX on error
|
||||||
* @param sign_key exchange key used to sign @a full_response, or NULL
|
* @param sign_key exchange key used to sign @a full_response, or NULL
|
||||||
@ -1644,6 +1651,7 @@ typedef void
|
|||||||
const struct TALER_EXCHANGE_HttpResponse *hr,
|
const struct TALER_EXCHANGE_HttpResponse *hr,
|
||||||
unsigned int num_coins,
|
unsigned int num_coins,
|
||||||
const struct TALER_ExchangeWithdrawValues *alg_values,
|
const struct TALER_ExchangeWithdrawValues *alg_values,
|
||||||
|
const union TALER_DenominationBlindingKeyP *bks,
|
||||||
uint32_t noreveal_index,
|
uint32_t noreveal_index,
|
||||||
const struct TALER_ExchangePublicKeyP *sign_key);
|
const struct TALER_ExchangePublicKeyP *sign_key);
|
||||||
|
|
||||||
|
@ -91,6 +91,12 @@ struct TALER_EXCHANGE_MeltHandle
|
|||||||
*/
|
*/
|
||||||
struct TALER_ExchangeWithdrawValues *alg_values;
|
struct TALER_ExchangeWithdrawValues *alg_values;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of `num_fresh_coins` blinding secrets
|
||||||
|
* used for blinding the coins.
|
||||||
|
*/
|
||||||
|
union TALER_DenominationBlindingKeyP *bks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle for the preflight request, or NULL.
|
* Handle for the preflight request, or NULL.
|
||||||
*/
|
*/
|
||||||
@ -135,7 +141,6 @@ verify_melt_signature_ok (struct TALER_EXCHANGE_MeltHandle *mh,
|
|||||||
noreveal_index),
|
noreveal_index),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
struct TALER_RefreshMeltConfirmationPS confirm;
|
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
GNUNET_JSON_parse (json,
|
GNUNET_JSON_parse (json,
|
||||||
@ -145,7 +150,6 @@ verify_melt_signature_ok (struct TALER_EXCHANGE_MeltHandle *mh,
|
|||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check that exchange signing key is permitted */
|
/* check that exchange signing key is permitted */
|
||||||
key_state = TALER_EXCHANGE_get_keys (mh->exchange);
|
key_state = TALER_EXCHANGE_get_keys (mh->exchange);
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
@ -163,20 +167,24 @@ verify_melt_signature_ok (struct TALER_EXCHANGE_MeltHandle *mh,
|
|||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* verify signature by exchange */
|
/* verify signature by exchange -- FIXME: move to util! */
|
||||||
confirm.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT);
|
|
||||||
confirm.purpose.size
|
|
||||||
= htonl (sizeof (struct TALER_RefreshMeltConfirmationPS));
|
|
||||||
confirm.rc = mh->md.rc;
|
|
||||||
confirm.noreveal_index = htonl (*noreveal_index);
|
|
||||||
if (GNUNET_OK !=
|
|
||||||
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT,
|
|
||||||
&confirm,
|
|
||||||
&exchange_sig.eddsa_signature,
|
|
||||||
&exchange_pub->eddsa_pub))
|
|
||||||
{
|
{
|
||||||
GNUNET_break_op (0);
|
struct TALER_RefreshMeltConfirmationPS confirm = {
|
||||||
return GNUNET_SYSERR;
|
.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT),
|
||||||
|
.purpose.size = htonl (sizeof (confirm)),
|
||||||
|
.rc = mh->md.rc,
|
||||||
|
.noreveal_index = htonl (*noreveal_index)
|
||||||
|
};
|
||||||
|
|
||||||
|
if (GNUNET_OK !=
|
||||||
|
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT,
|
||||||
|
&confirm,
|
||||||
|
&exchange_sig.eddsa_signature,
|
||||||
|
&exchange_pub->eddsa_pub))
|
||||||
|
{
|
||||||
|
GNUNET_break_op (0);
|
||||||
|
return GNUNET_SYSERR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
@ -368,6 +376,9 @@ handle_melt_finished (void *cls,
|
|||||||
(0 == hr.http_status)
|
(0 == hr.http_status)
|
||||||
? NULL
|
? NULL
|
||||||
: mh->alg_values,
|
: mh->alg_values,
|
||||||
|
(0 == hr.http_status)
|
||||||
|
? NULL
|
||||||
|
: mh->bks,
|
||||||
noreveal_index,
|
noreveal_index,
|
||||||
(0 == hr.http_status)
|
(0 == hr.http_status)
|
||||||
? NULL
|
? NULL
|
||||||
@ -451,6 +462,7 @@ handle_melt_finished (void *cls,
|
|||||||
&hr,
|
&hr,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
|
NULL,
|
||||||
UINT32_MAX,
|
UINT32_MAX,
|
||||||
NULL);
|
NULL);
|
||||||
TALER_EXCHANGE_melt_cancel (mh);
|
TALER_EXCHANGE_melt_cancel (mh);
|
||||||
@ -561,6 +573,7 @@ fail_mh (struct TALER_EXCHANGE_MeltHandle *mh)
|
|||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
|
NULL,
|
||||||
UINT32_MAX,
|
UINT32_MAX,
|
||||||
NULL);
|
NULL);
|
||||||
TALER_EXCHANGE_melt_cancel (mh);
|
TALER_EXCHANGE_melt_cancel (mh);
|
||||||
@ -591,8 +604,7 @@ csr_cb (void *cls,
|
|||||||
{
|
{
|
||||||
case TALER_DENOMINATION_INVALID:
|
case TALER_DENOMINATION_INVALID:
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
// FIXME:
|
fail_mh (mh);
|
||||||
// fail_mh (mh).
|
|
||||||
return;
|
return;
|
||||||
case TALER_DENOMINATION_RSA:
|
case TALER_DENOMINATION_RSA:
|
||||||
GNUNET_assert (TALER_DENOMINATION_RSA == wv->cipher);
|
GNUNET_assert (TALER_DENOMINATION_RSA == wv->cipher);
|
||||||
@ -640,6 +652,8 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
mh->melt_cb_cls = melt_cb_cls;
|
mh->melt_cb_cls = melt_cb_cls;
|
||||||
mh->alg_values = GNUNET_new_array (rd->fresh_pks_len,
|
mh->alg_values = GNUNET_new_array (rd->fresh_pks_len,
|
||||||
struct TALER_ExchangeWithdrawValues);
|
struct TALER_ExchangeWithdrawValues);
|
||||||
|
mh->bks = GNUNET_new_array (rd->fresh_pks_len,
|
||||||
|
union TALER_DenominationBlindingKeyP);
|
||||||
for (unsigned int i = 0; i<rd->fresh_pks_len; i++)
|
for (unsigned int i = 0; i<rd->fresh_pks_len; i++)
|
||||||
{
|
{
|
||||||
const struct TALER_EXCHANGE_DenomPublicKey *fresh_pk = &rd->fresh_pks[i];
|
const struct TALER_EXCHANGE_DenomPublicKey *fresh_pk = &rd->fresh_pks[i];
|
||||||
@ -650,6 +664,7 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
case TALER_DENOMINATION_INVALID:
|
case TALER_DENOMINATION_INVALID:
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
GNUNET_free (mh->alg_values);
|
GNUNET_free (mh->alg_values);
|
||||||
|
GNUNET_free (mh->bks);
|
||||||
GNUNET_free (mh);
|
GNUNET_free (mh);
|
||||||
return NULL;
|
return NULL;
|
||||||
case TALER_DENOMINATION_RSA:
|
case TALER_DENOMINATION_RSA:
|
||||||
@ -705,6 +720,8 @@ TALER_EXCHANGE_melt_cancel (struct TALER_EXCHANGE_MeltHandle *mh)
|
|||||||
mh->csr = NULL;
|
mh->csr = NULL;
|
||||||
}
|
}
|
||||||
TALER_EXCHANGE_free_melt_data_ (&mh->md); /* does not free 'md' itself */
|
TALER_EXCHANGE_free_melt_data_ (&mh->md); /* does not free 'md' itself */
|
||||||
|
GNUNET_free (mh->alg_values);
|
||||||
|
GNUNET_free (mh->bks);
|
||||||
GNUNET_free (mh->url);
|
GNUNET_free (mh->url);
|
||||||
TALER_curl_easy_post_finished (&mh->ctx);
|
TALER_curl_easy_post_finished (&mh->ctx);
|
||||||
GNUNET_free (mh);
|
GNUNET_free (mh);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of TALER
|
This file is part of TALER
|
||||||
Copyright (C) 2014-2021 Taler Systems SA
|
Copyright (C) 2014-2022 Taler Systems SA
|
||||||
|
|
||||||
TALER is free software; you can redistribute it and/or modify it under the
|
TALER is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the GNU General Public License as published by the Free Software
|
terms of the GNU General Public License as published by the Free Software
|
||||||
@ -145,7 +145,10 @@ handle_reserve_withdraw_finished (
|
|||||||
wr.hr.ec = TALER_EC_EXCHANGE_WITHDRAW_UNBLIND_FAILURE;
|
wr.hr.ec = TALER_EC_EXCHANGE_WITHDRAW_UNBLIND_FAILURE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
wr.details.success.coin_priv = wh->priv;
|
||||||
|
wr.details.success.bks = wh->bks;
|
||||||
wr.details.success.sig = fc.sig;
|
wr.details.success.sig = fc.sig;
|
||||||
|
wr.details.success.exchange_vals = wh->alg_values;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MHD_HTTP_ACCEPTED:
|
case MHD_HTTP_ACCEPTED:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of TALER
|
This file is part of TALER
|
||||||
Copyright (C) 2014-2021 Taler Systems SA
|
Copyright (C) 2014-2022 Taler Systems SA
|
||||||
|
|
||||||
TALER is free software; you can redistribute it and/or modify it under the
|
TALER is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the GNU General Public License as published by the Free Software
|
terms of the GNU General Public License as published by the Free Software
|
||||||
@ -152,7 +152,8 @@ reserve_withdraw_payment_required (
|
|||||||
json_t *history;
|
json_t *history;
|
||||||
size_t len;
|
size_t len;
|
||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
TALER_JSON_spec_amount_any ("balance", &balance),
|
TALER_JSON_spec_amount_any ("balance",
|
||||||
|
&balance),
|
||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -182,9 +183,9 @@ reserve_withdraw_payment_required (
|
|||||||
not fit on the stack. Use "GNUNET_malloc_large" as a malicious
|
not fit on the stack. Use "GNUNET_malloc_large" as a malicious
|
||||||
exchange may theoretically try to crash us by giving a history
|
exchange may theoretically try to crash us by giving a history
|
||||||
that does not fit into our memory. */
|
that does not fit into our memory. */
|
||||||
rhistory = GNUNET_malloc_large (sizeof (struct
|
rhistory = GNUNET_malloc_large (
|
||||||
TALER_EXCHANGE_ReserveHistory)
|
sizeof (struct TALER_EXCHANGE_ReserveHistory)
|
||||||
* len);
|
* len);
|
||||||
if (NULL == rhistory)
|
if (NULL == rhistory)
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of TALER
|
This file is part of TALER
|
||||||
Copyright (C) 2018-2020 Taler Systems SA
|
Copyright (C) 2018-2022 Taler Systems SA
|
||||||
|
|
||||||
TALER is free software; you can redistribute it and/or modify it
|
TALER is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by
|
under the terms of the GNU General Public License as published by
|
||||||
@ -91,9 +91,9 @@ struct RefreshMeltState
|
|||||||
const char *coin_reference;
|
const char *coin_reference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Crypto data" used in the refresh operation.
|
* Data used in the refresh operation.
|
||||||
*/
|
*/
|
||||||
json_t *refresh_data;
|
struct TALER_EXCHANGE_RefreshData refresh_data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference to a previous melt command.
|
* Reference to a previous melt command.
|
||||||
@ -116,6 +116,16 @@ struct RefreshMeltState
|
|||||||
*/
|
*/
|
||||||
struct TALER_EXCHANGE_DenomPublicKey *fresh_pks;
|
struct TALER_EXCHANGE_DenomPublicKey *fresh_pks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of @a num_fresh_coins of exchange values contributed to the refresh operation
|
||||||
|
*/
|
||||||
|
struct TALER_ExchangeWithdrawValues *alg_values;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entropy seed for the refresh-melt operation.
|
||||||
|
*/
|
||||||
|
struct TALER_PlanchetSecretsP ps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private key of the dirty coin being melted.
|
* Private key of the dirty coin being melted.
|
||||||
*/
|
*/
|
||||||
@ -337,7 +347,7 @@ static void
|
|||||||
reveal_cb (void *cls,
|
reveal_cb (void *cls,
|
||||||
const struct TALER_EXCHANGE_HttpResponse *hr,
|
const struct TALER_EXCHANGE_HttpResponse *hr,
|
||||||
unsigned int num_coins,
|
unsigned int num_coins,
|
||||||
const struct TALER_PlanchetSecretsP *coin_privs,
|
const struct TALER_CoinSpendPrivateKeyP *coin_privs,
|
||||||
const struct TALER_DenominationSignature *sigs)
|
const struct TALER_DenominationSignature *sigs)
|
||||||
{
|
{
|
||||||
struct RefreshRevealState *rrs = cls;
|
struct RefreshRevealState *rrs = cls;
|
||||||
@ -402,6 +412,7 @@ reveal_cb (void *cls,
|
|||||||
for (unsigned int i = 0; i<num_coins; i++)
|
for (unsigned int i = 0; i<num_coins; i++)
|
||||||
{
|
{
|
||||||
struct TALER_TESTING_FreshCoinData *fc = &rrs->fresh_coins[i];
|
struct TALER_TESTING_FreshCoinData *fc = &rrs->fresh_coins[i];
|
||||||
|
const union TALER_DenominationBlindingKeyP *bks;
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_TESTING_get_trait_denom_pub (melt_cmd,
|
TALER_TESTING_get_trait_denom_pub (melt_cmd,
|
||||||
@ -412,8 +423,17 @@ reveal_cb (void *cls,
|
|||||||
TALER_TESTING_interpreter_fail (rrs->is);
|
TALER_TESTING_interpreter_fail (rrs->is);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fc->coin_priv = coin_privs[i].coin_priv;
|
if (GNUNET_OK !=
|
||||||
fc->blinding_key = coin_privs[i].blinding_key;
|
TALER_TESTING_get_trait_blinding_key (melt_cmd,
|
||||||
|
i,
|
||||||
|
&bks))
|
||||||
|
{
|
||||||
|
GNUNET_break (0);
|
||||||
|
TALER_TESTING_interpreter_fail (rrs->is);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fc->coin_priv = coin_privs[i];
|
||||||
|
fc->blinding_key = *bks;
|
||||||
TALER_denom_sig_deep_copy (&fc->sig,
|
TALER_denom_sig_deep_copy (&fc->sig,
|
||||||
&sigs[i]);
|
&sigs[i]);
|
||||||
}
|
}
|
||||||
@ -461,9 +481,13 @@ refresh_reveal_run (void *cls,
|
|||||||
TALER_TESTING_interpreter_fail (rrs->is);
|
TALER_TESTING_interpreter_fail (rrs->is);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// FIXME: use trait for 'rms'!
|
||||||
rms = melt_cmd->cls;
|
rms = melt_cmd->cls;
|
||||||
rrs->rrh = TALER_EXCHANGE_refreshes_reveal (is->exchange,
|
rrs->rrh = TALER_EXCHANGE_refreshes_reveal (is->exchange,
|
||||||
rms->refresh_data,
|
&rms->ps,
|
||||||
|
&rms->refresh_data,
|
||||||
|
rms->num_fresh_coins,
|
||||||
|
rms->alg_values,
|
||||||
rms->noreveal_index,
|
rms->noreveal_index,
|
||||||
&reveal_cb,
|
&reveal_cb,
|
||||||
rrs);
|
rrs);
|
||||||
@ -763,6 +787,7 @@ refresh_link_run (void *cls,
|
|||||||
|
|
||||||
/* find reserve_withdraw command */
|
/* find reserve_withdraw command */
|
||||||
{
|
{
|
||||||
|
// FIXME: use trait!
|
||||||
rms = melt_cmd->cls;
|
rms = melt_cmd->cls;
|
||||||
coin_cmd = TALER_TESTING_interpreter_lookup_command (rls->is,
|
coin_cmd = TALER_TESTING_interpreter_lookup_command (rls->is,
|
||||||
rms->coin_reference);
|
rms->coin_reference);
|
||||||
@ -856,11 +881,6 @@ do_melt_retry (void *cls)
|
|||||||
rms->retry_task = NULL;
|
rms->retry_task = NULL;
|
||||||
rms->is->commands[rms->is->ip].last_req_time
|
rms->is->commands[rms->is->ip].last_req_time
|
||||||
= GNUNET_TIME_absolute_get ();
|
= GNUNET_TIME_absolute_get ();
|
||||||
if (NULL != rms->refresh_data)
|
|
||||||
{
|
|
||||||
json_decref (rms->refresh_data);
|
|
||||||
rms->refresh_data = NULL;
|
|
||||||
}
|
|
||||||
melt_run (rms,
|
melt_run (rms,
|
||||||
NULL,
|
NULL,
|
||||||
rms->is);
|
rms->is);
|
||||||
@ -874,6 +894,9 @@ do_melt_retry (void *cls)
|
|||||||
*
|
*
|
||||||
* @param cls closure.
|
* @param cls closure.
|
||||||
* @param hr HTTP response details
|
* @param hr HTTP response details
|
||||||
|
* @param num_coins number of fresh coins to be created, length of the @a exchange_vals array, 0 if the operation failed
|
||||||
|
* @param alg_values array @a num_coins of exchange values contributed to the refresh operation
|
||||||
|
* @param bks array of @a num_coins blinding keys used to blind the fresh coins
|
||||||
* @param noreveal_index choice by the exchange in the
|
* @param noreveal_index choice by the exchange in the
|
||||||
* cut-and-choose protocol, UINT16_MAX on error.
|
* cut-and-choose protocol, UINT16_MAX on error.
|
||||||
* @param exchange_pub public key the exchange used for signing.
|
* @param exchange_pub public key the exchange used for signing.
|
||||||
@ -881,6 +904,9 @@ do_melt_retry (void *cls)
|
|||||||
static void
|
static void
|
||||||
melt_cb (void *cls,
|
melt_cb (void *cls,
|
||||||
const struct TALER_EXCHANGE_HttpResponse *hr,
|
const struct TALER_EXCHANGE_HttpResponse *hr,
|
||||||
|
unsigned int num_coins,
|
||||||
|
const struct TALER_ExchangeWithdrawValues *alg_values,
|
||||||
|
const union TALER_DenominationBlindingKeyP *bks,
|
||||||
uint32_t noreveal_index,
|
uint32_t noreveal_index,
|
||||||
const struct TALER_ExchangePublicKeyP *exchange_pub)
|
const struct TALER_ExchangePublicKeyP *exchange_pub)
|
||||||
{
|
{
|
||||||
@ -929,7 +955,22 @@ melt_cb (void *cls,
|
|||||||
TALER_TESTING_interpreter_fail (rms->is);
|
TALER_TESTING_interpreter_fail (rms->is);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rms->noreveal_index = noreveal_index;
|
if (MHD_HTTP_OK == hr->http_status)
|
||||||
|
{
|
||||||
|
rms->noreveal_index = noreveal_index;
|
||||||
|
if (num_coins != rms->num_fresh_coins)
|
||||||
|
{
|
||||||
|
GNUNET_break (0);
|
||||||
|
TALER_TESTING_interpreter_fail (rms->is);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
GNUNET_free (rms->alg_values);
|
||||||
|
rms->alg_values = GNUNET_new_array (num_coins,
|
||||||
|
struct TALER_ExchangeWithdrawValues);
|
||||||
|
memcpy (rms->alg_values,
|
||||||
|
alg_values,
|
||||||
|
num_coins * sizeof (struct TALER_ExchangeWithdrawValues));
|
||||||
|
}
|
||||||
if (0 != rms->total_backoff.rel_value_us)
|
if (0 != rms->total_backoff.rel_value_us)
|
||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
@ -943,7 +984,8 @@ melt_cb (void *cls,
|
|||||||
TALER_LOG_DEBUG ("Doubling the melt (%s)\n",
|
TALER_LOG_DEBUG ("Doubling the melt (%s)\n",
|
||||||
rms->is->commands[rms->is->ip].label);
|
rms->is->commands[rms->is->ip].label);
|
||||||
rms->rmh = TALER_EXCHANGE_melt (rms->is->exchange,
|
rms->rmh = TALER_EXCHANGE_melt (rms->is->exchange,
|
||||||
rms->refresh_data,
|
&rms->ps,
|
||||||
|
&rms->refresh_data,
|
||||||
&melt_cb,
|
&melt_cb,
|
||||||
rms);
|
rms);
|
||||||
rms->double_melt = GNUNET_NO;
|
rms->double_melt = GNUNET_NO;
|
||||||
@ -978,6 +1020,7 @@ melt_run (void *cls,
|
|||||||
melt_fresh_amounts = default_melt_fresh_amounts;
|
melt_fresh_amounts = default_melt_fresh_amounts;
|
||||||
rms->is = is;
|
rms->is = is;
|
||||||
rms->noreveal_index = UINT16_MAX;
|
rms->noreveal_index = UINT16_MAX;
|
||||||
|
TALER_planchet_setup_random (&rms->ps);
|
||||||
for (num_fresh_coins = 0;
|
for (num_fresh_coins = 0;
|
||||||
NULL != melt_fresh_amounts[num_fresh_coins];
|
NULL != melt_fresh_amounts[num_fresh_coins];
|
||||||
num_fresh_coins++)
|
num_fresh_coins++)
|
||||||
@ -994,8 +1037,9 @@ melt_run (void *cls,
|
|||||||
const struct TALER_TESTING_Command *coin_command;
|
const struct TALER_TESTING_Command *coin_command;
|
||||||
|
|
||||||
if (NULL == (coin_command
|
if (NULL == (coin_command
|
||||||
= TALER_TESTING_interpreter_lookup_command
|
= TALER_TESTING_interpreter_lookup_command (
|
||||||
(is, rms->coin_reference)))
|
is,
|
||||||
|
rms->coin_reference)))
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
TALER_TESTING_interpreter_fail (rms->is);
|
TALER_TESTING_interpreter_fail (rms->is);
|
||||||
@ -1070,22 +1114,15 @@ melt_run (void *cls,
|
|||||||
TALER_denom_pub_deep_copy (&rms->fresh_pks[i].key,
|
TALER_denom_pub_deep_copy (&rms->fresh_pks[i].key,
|
||||||
&fresh_pk->key);
|
&fresh_pk->key);
|
||||||
} /* end for */
|
} /* end for */
|
||||||
GNUNET_assert (NULL == rms->refresh_data);
|
rms->refresh_data.melt_priv = *rms->melt_priv;
|
||||||
rms->refresh_data
|
rms->refresh_data.melt_amount = melt_amount;
|
||||||
= TALER_EXCHANGE_refresh_prepare (rms->melt_priv,
|
rms->refresh_data.melt_sig = *melt_sig;
|
||||||
&melt_amount,
|
rms->refresh_data.melt_pk = *melt_denom_pub;
|
||||||
melt_sig,
|
rms->refresh_data.fresh_pks = rms->fresh_pks;
|
||||||
melt_denom_pub,
|
rms->refresh_data.fresh_pks_len = num_fresh_coins;
|
||||||
num_fresh_coins,
|
|
||||||
rms->fresh_pks);
|
|
||||||
if (NULL == rms->refresh_data)
|
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
TALER_TESTING_interpreter_fail (rms->is);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
rms->rmh = TALER_EXCHANGE_melt (is->exchange,
|
rms->rmh = TALER_EXCHANGE_melt (is->exchange,
|
||||||
rms->refresh_data,
|
&rms->ps,
|
||||||
|
&rms->refresh_data,
|
||||||
&melt_cb,
|
&melt_cb,
|
||||||
rms);
|
rms);
|
||||||
|
|
||||||
@ -1132,9 +1169,7 @@ melt_cleanup (void *cls,
|
|||||||
TALER_denom_pub_free (&rms->fresh_pks[i].key);
|
TALER_denom_pub_free (&rms->fresh_pks[i].key);
|
||||||
}
|
}
|
||||||
GNUNET_free (rms->fresh_pks);
|
GNUNET_free (rms->fresh_pks);
|
||||||
rms->fresh_pks = NULL;
|
GNUNET_free (rms->alg_values);
|
||||||
json_decref (rms->refresh_data);
|
|
||||||
rms->refresh_data = NULL;
|
|
||||||
GNUNET_free (rms->melt_fresh_amounts);
|
GNUNET_free (rms->melt_fresh_amounts);
|
||||||
GNUNET_free (rms);
|
GNUNET_free (rms);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user