diff options
Diffstat (limited to 'src/testing/testing_api_cmd_purse_deposit.c')
-rw-r--r-- | src/testing/testing_api_cmd_purse_deposit.c | 67 |
1 files changed, 49 insertions, 18 deletions
diff --git a/src/testing/testing_api_cmd_purse_deposit.c b/src/testing/testing_api_cmd_purse_deposit.c index 8533e25c2..048c6d736 100644 --- a/src/testing/testing_api_cmd_purse_deposit.c +++ b/src/testing/testing_api_cmd_purse_deposit.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2022 Taler Systems SA + Copyright (C) 2022, 2023 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -39,6 +39,16 @@ struct Coin char *command_ref; /** + * Entry in the coin's history generated by this operation. + */ + struct TALER_EXCHANGE_CoinHistoryEntry che; + + /** + * Public key of the deposited coin. + */ + struct TALER_CoinSpendPublicKeyP coin_pub; + + /** * index of the specific coin in the traits of @e command_ref. */ unsigned int coin_index; @@ -274,7 +284,7 @@ deposit_run (void *cls, ds->purse_pub = *purse_pub; for (unsigned int i = 0; i<ds->num_coin_references; i++) { - const struct Coin *cr = &ds->coin_references[i]; + struct Coin *cr = &ds->coin_references[i]; struct TALER_EXCHANGE_PurseDeposit *pd = &deposits[i]; const struct TALER_TESTING_Command *coin_cmd; const struct TALER_CoinSpendPrivateKeyP *coin_priv; @@ -307,6 +317,16 @@ deposit_run (void *cls, TALER_TESTING_interpreter_fail (is); return; } + GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv->eddsa_priv, + &cr->coin_pub.eddsa_pub); + cr->che.type = TALER_EXCHANGE_CTT_PURSE_DEPOSIT; + cr->che.amount = cr->deposit_with_fee; + cr->che.details.purse_deposit.purse_pub = *purse_pub; + cr->che.details.purse_deposit.exchange_base_url + = TALER_TESTING_get_exchange_url (is); + TALER_age_commitment_hash ( + &age_commitment_proof->commitment, + &cr->che.details.purse_deposit.phac); pd->age_commitment_proof = age_commitment_proof; pd->denom_sig = *denom_pub_sig; pd->coin_priv = *coin_priv; @@ -379,21 +399,31 @@ deposit_traits (void *cls, unsigned int index) { struct PurseDepositState *ds = cls; - struct TALER_TESTING_Trait traits[] = { - /* history entry MUST be first due to response code logic below! */ - TALER_TESTING_make_trait_reserve_history (0, - &ds->reserve_history), - TALER_TESTING_make_trait_reserve_pub (&ds->reserve_pub), - TALER_TESTING_make_trait_purse_pub (&ds->purse_pub), - TALER_TESTING_trait_end () - }; - - return TALER_TESTING_get_trait (ds->purse_complete - ? &traits[0] /* we have reserve history */ - : &traits[1], /* skip reserve history */ - ret, - trait, - index); + + if (index >= ds->num_coin_references) + return GNUNET_NO; + { + const struct Coin *co = &ds->coin_references[index]; + struct TALER_TESTING_Trait traits[] = { + /* history entry MUST be first due to response code logic below! */ + TALER_TESTING_make_trait_reserve_history (0, + &ds->reserve_history), + TALER_TESTING_make_trait_coin_history (index, + &co->che), + TALER_TESTING_make_trait_coin_pub (index, + &co->coin_pub), + TALER_TESTING_make_trait_reserve_pub (&ds->reserve_pub), + TALER_TESTING_make_trait_purse_pub (&ds->purse_pub), + TALER_TESTING_trait_end () + }; + + return TALER_TESTING_get_trait (ds->purse_complete + ? &traits[0] /* we have reserve history */ + : &traits[1], /* skip reserve history */ + ret, + trait, + index); + } } @@ -431,7 +461,8 @@ TALER_TESTING_cmd_purse_deposit_coins ( { struct Coin *c = &ds->coin_references[i++]; - GNUNET_assert (NULL != (val = va_arg (ap, const char *))); + GNUNET_assert (NULL != (val = va_arg (ap, + const char *))); GNUNET_assert (GNUNET_OK == TALER_TESTING_parse_coin_reference ( ref, |