From 753a506f6564a05176864f3ba561e732b85d54a5 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 9 Nov 2023 23:22:55 +0100 Subject: more work on coin history testing --- src/testing/testing_api_cmd_batch_deposit.c | 5 +++-- src/testing/testing_api_cmd_batch_withdraw.c | 10 ++++++++++ src/testing/testing_api_cmd_coin_history.c | 17 ++++++++++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) (limited to 'src/testing') diff --git a/src/testing/testing_api_cmd_batch_deposit.c b/src/testing/testing_api_cmd_batch_deposit.c index d8f8ef3b2..5139d3524 100644 --- a/src/testing/testing_api_cmd_batch_deposit.c +++ b/src/testing/testing_api_cmd_batch_deposit.c @@ -480,7 +480,7 @@ batch_deposit_traits (void *cls, unsigned int index) { struct BatchDepositState *ds = cls; - struct Coin *coin = &ds->coins[index]; + const struct Coin *coin = &ds->coins[index]; /* Will point to coin cmd internals. */ const struct TALER_CoinSpendPrivateKeyP *coin_spent_priv; struct TALER_CoinSpendPublicKeyP coin_spent_pub; @@ -528,6 +528,8 @@ batch_deposit_traits (void *cls, TALER_TESTING_make_trait_merchant_priv (&ds->merchant_priv), TALER_TESTING_make_trait_age_commitment_proof (index, age_commitment_proof), + TALER_TESTING_make_trait_coin_history (index, + &coin->che), TALER_TESTING_make_trait_coin_pub (index, &coin_spent_pub), TALER_TESTING_make_trait_denom_pub (index, @@ -540,7 +542,6 @@ batch_deposit_traits (void *cls, &coin->amount), TALER_TESTING_make_trait_deposit_fee_amount (index, &coin->deposit_fee), - TALER_TESTING_make_trait_timestamp (index, &ds->exchange_timestamp), TALER_TESTING_make_trait_wire_deadline (index, diff --git a/src/testing/testing_api_cmd_batch_withdraw.c b/src/testing/testing_api_cmd_batch_withdraw.c index b455fc062..e4c054c5f 100644 --- a/src/testing/testing_api_cmd_batch_withdraw.c +++ b/src/testing/testing_api_cmd_batch_withdraw.c @@ -56,6 +56,11 @@ struct CoinState */ struct TALER_CoinSpendPrivateKeyP coin_priv; + /** + * Public key of the coin. + */ + struct TALER_CoinSpendPublicKeyP coin_pub; + /** * Blinding key used during the operation. */ @@ -207,6 +212,9 @@ reserve_batch_withdraw_cb (void *cls, TALER_denom_sig_deep_copy (&cs->sig, &pcd->sig); cs->coin_priv = pcd->coin_priv; + GNUNET_CRYPTO_eddsa_key_get_public (&cs->coin_priv.eddsa_priv, + &cs->coin_pub.eddsa_pub); + cs->bks = pcd->bks; cs->exchange_vals = pcd->exchange_vals; } @@ -402,6 +410,8 @@ batch_withdraw_traits (void *cls, &cs->reserve_history), TALER_TESTING_make_trait_coin_priv (index, &cs->coin_priv), + TALER_TESTING_make_trait_coin_pub (index, + &cs->coin_pub), TALER_TESTING_make_trait_planchet_secrets (index, &cs->ps), TALER_TESTING_make_trait_blinding_key (index, diff --git a/src/testing/testing_api_cmd_coin_history.c b/src/testing/testing_api_cmd_coin_history.c index bd0fc4fbd..e10199abd 100644 --- a/src/testing/testing_api_cmd_coin_history.c +++ b/src/testing/testing_api_cmd_coin_history.c @@ -127,6 +127,15 @@ history_entry_cmp ( GNUNET_break (0); break; case TALER_EXCHANGE_CTT_DEPOSIT: + if (0 != GNUNET_memcmp (&h1->details.deposit.h_contract_terms, + &h2->details.deposit.h_contract_terms)) + return 1; + if (0 != GNUNET_memcmp (&h1->details.deposit.merchant_pub, + &h2->details.deposit.merchant_pub)) + return 1; + if (0 != GNUNET_memcmp (&h1->details.deposit.h_wire, + &h2->details.deposit.h_wire)) + return 1; if (0 != GNUNET_memcmp (&h1->details.deposit.sig, &h2->details.deposit.sig)) return 1; @@ -255,7 +264,13 @@ analyze_command (void *cls, if (0 != GNUNET_memcmp (rp, coin_pub)) + { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Command `%s#%u' is about another coin\n", + cmd->label, + j); continue; /* command affects some _other_ coin */ + } if (GNUNET_OK != TALER_TESTING_get_trait_coin_history (cmd, j, @@ -417,7 +432,7 @@ coin_history_cb (void *cls, TALER_TESTING_interpreter_fail (ss->is); return; } -#if FIXME +#if 1 for (unsigned int i = 0; i