This commit is contained in:
Christian Grothoff 2021-11-01 22:57:46 +01:00
parent 8df5fba56a
commit 9358b886f1
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
4 changed files with 49 additions and 83 deletions

@ -1 +1 @@
Subproject commit 17555514bd2866e0d45b23e4a1c198415205c8f2 Subproject commit 8c7d9be40ba627348da3e01b91b4f1d3cc78631f

View File

@ -122,7 +122,8 @@ run (void *cls,
MHD_HTTP_OK), MHD_HTTP_OK),
/** /**
* Melt SOME of the rest of the coin's value * Melt SOME of the rest of the coin's value
* (EUR:3.17 = 3x EUR:1.03 + 7x EUR:0.13) */ * (EUR:3.17 = 3x EUR:1.03 + 7x EUR:0.13)
*/
TALER_TESTING_cmd_melt ("refresh-melt-1", TALER_TESTING_cmd_melt ("refresh-melt-1",
"withdraw-revocation-coin-1", "withdraw-revocation-coin-1",
MHD_HTTP_OK, MHD_HTTP_OK,

View File

@ -166,6 +166,7 @@ recoup_cb (void *cls,
TALER_TESTING_interpreter_fail (is); TALER_TESTING_interpreter_fail (is);
return; return;
} }
(void) idx; /* do NOT use! We ignore 'idx', must be 0 for melt! */
reserve_cmd = TALER_TESTING_interpreter_lookup_command (is, reserve_cmd = TALER_TESTING_interpreter_lookup_command (is,
cref); cref);
@ -198,9 +199,13 @@ recoup_cb (void *cls,
} }
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_get_trait_coin_priv (melt_cmd, TALER_TESTING_get_trait_coin_priv (melt_cmd,
idx, 0,
&dirty_priv)) &dirty_priv))
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Coin %u not found in command %s\n",
0,
ps->melt_reference);
GNUNET_break (0); GNUNET_break (0);
TALER_TESTING_interpreter_fail (is); TALER_TESTING_interpreter_fail (is);
return; return;

View File

@ -994,8 +994,10 @@ melt_run (void *cls,
return; return;
} }
if (GNUNET_OK != TALER_TESTING_get_trait_coin_priv if (GNUNET_OK !=
(coin_command, 0, &rms->melt_priv)) TALER_TESTING_get_trait_coin_priv (coin_command,
0,
&rms->melt_priv))
{ {
GNUNET_break (0); GNUNET_break (0);
TALER_TESTING_interpreter_fail (rms->is); TALER_TESTING_interpreter_fail (rms->is);
@ -1011,8 +1013,10 @@ melt_run (void *cls,
TALER_TESTING_interpreter_fail (rms->is); TALER_TESTING_interpreter_fail (rms->is);
return; return;
} }
if (GNUNET_OK != TALER_TESTING_get_trait_denom_pub if (GNUNET_OK !=
(coin_command, 0, &melt_denom_pub)) TALER_TESTING_get_trait_denom_pub (coin_command,
0,
&melt_denom_pub))
{ {
GNUNET_break (0); GNUNET_break (0);
TALER_TESTING_interpreter_fail (rms->is); TALER_TESTING_interpreter_fail (rms->is);
@ -1134,7 +1138,7 @@ melt_cleanup (void *cls,
* @param index index number of the object to offer. * @param index index number of the object to offer.
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.
*/ */
static int static enum GNUNET_GenericReturnValue
melt_traits (void *cls, melt_traits (void *cls,
const void **ret, const void **ret,
const char *trait, const char *trait,
@ -1149,8 +1153,10 @@ melt_traits (void *cls,
} }
{ {
struct TALER_TESTING_Trait traits[] = { struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_denom_pub (index, &rms->fresh_pks[index]), TALER_TESTING_make_trait_denom_pub (index,
TALER_TESTING_make_trait_coin_priv (0, rms->melt_priv), &rms->fresh_pks[index]),
TALER_TESTING_make_trait_coin_priv (0,
rms->melt_priv),
TALER_TESTING_trait_end () TALER_TESTING_trait_end ()
}; };
@ -1169,7 +1175,7 @@ melt_traits (void *cls,
* @param ap NULL-termianted list of amounts to be melted (one per fresh coin) * @param ap NULL-termianted list of amounts to be melted (one per fresh coin)
* @return #GNUNET_OK on success * @return #GNUNET_OK on success
*/ */
static int static enum GNUNET_GenericReturnValue
parse_amounts (struct RefreshMeltState *rms, parse_amounts (struct RefreshMeltState *rms,
va_list ap) va_list ap)
{ {
@ -1212,16 +1218,6 @@ parse_amounts (struct RefreshMeltState *rms,
} }
/**
* Create a "refresh melt" command.
*
* @param label command label.
* @param coin_reference reference to a command
* that will provide a coin to refresh.
* @param expected_response_code expected HTTP code.
* @param ... NULL-terminated list of amounts to be melted
* @return the command.
*/
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_melt (const char *label, TALER_TESTING_cmd_melt (const char *label,
const char *coin_reference, const char *coin_reference,
@ -1252,18 +1248,6 @@ TALER_TESTING_cmd_melt (const char *label,
} }
/**
* Create a "refresh melt" CMD that does TWO /refresh/melt
* requests. This was needed to test the replay of a valid melt
* request, see #5312.
*
* @param label command label
* @param coin_reference reference to a command that will provide
* a coin to refresh
* @param expected_response_code expected HTTP code
* @param ... NULL-terminated list of amounts to be melted
* @return the command.
*/
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_melt_double (const char *label, TALER_TESTING_cmd_melt_double (const char *label,
const char *coin_reference, const char *coin_reference,
@ -1295,12 +1279,6 @@ TALER_TESTING_cmd_melt_double (const char *label,
} }
/**
* Modify a "refresh melt" command to enable retries.
*
* @param cmd command
* @return modified command.
*/
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_melt_with_retry (struct TALER_TESTING_Command cmd) TALER_TESTING_cmd_melt_with_retry (struct TALER_TESTING_Command cmd)
{ {
@ -1329,54 +1307,36 @@ refresh_reveal_traits (void *cls,
unsigned int index) unsigned int index)
{ {
struct RefreshRevealState *rrs = cls; struct RefreshRevealState *rrs = cls;
unsigned int num_coins = rrs->num_fresh_coins;
#define NUM_TRAITS ((num_coins * 4) + 3)
struct TALER_TESTING_Trait traits[NUM_TRAITS];
/* Making coin privs traits */ if (index >= rrs->num_fresh_coins)
for (unsigned int i = 0; i<num_coins; i++) return GNUNET_SYSERR;
traits[i] = TALER_TESTING_make_trait_coin_priv ( {
i, struct TALER_TESTING_Trait traits[] = {
&rrs->fresh_coins[i].coin_priv); TALER_TESTING_make_trait_coin_priv (
index,
/* Making denom pubs traits */ &rrs->fresh_coins[index].coin_priv),
for (unsigned int i = 0; i<num_coins; i++) TALER_TESTING_make_trait_denom_pub (
traits[num_coins + i] index,
= TALER_TESTING_make_trait_denom_pub ( rrs->fresh_coins[index].pk),
i, TALER_TESTING_make_trait_denom_sig (
rrs->fresh_coins[i].pk); index,
&rrs->fresh_coins[index].sig),
/* Making denom sigs traits */ TALER_TESTING_make_trait_blinding_key (
for (unsigned int i = 0; i<num_coins; i++) index,
traits[(num_coins * 2) + i] &rrs->fresh_coins[index].blinding_key),
= TALER_TESTING_make_trait_denom_sig ( TALER_TESTING_make_trait_array_length (
i, &rrs->num_fresh_coins),
&rrs->fresh_coins[i].sig); TALER_TESTING_make_trait_fresh_coins (
/* blinding key traits */
for (unsigned int i = 0; i<num_coins; i++)
traits[(num_coins * 3) + i]
= TALER_TESTING_make_trait_blinding_key (
i,
&rrs->fresh_coins[i].blinding_key);
/* number of fresh coins */
traits[(num_coins * 4)]
= TALER_TESTING_make_trait_array_length (
&rrs->num_fresh_coins);
/* whole array of fresh coins */
traits[(num_coins * 4) + 1]
= TALER_TESTING_make_trait_fresh_coins (
(const struct TALER_TESTING_FreshCoinData **) &rrs->fresh_coins), (const struct TALER_TESTING_FreshCoinData **) &rrs->fresh_coins),
TALER_TESTING_trait_end ()
/* end of traits */ };
traits[(num_coins * 4) + 2] = TALER_TESTING_trait_end ();
return TALER_TESTING_get_trait (traits, return TALER_TESTING_get_trait (traits,
ret, ret,
trait, trait,
index); index);
} }
}
struct TALER_TESTING_Command struct TALER_TESTING_Command