diff options
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/testing_api_cmd_coin_history.c | 5 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_recoup.c | 29 |
2 files changed, 31 insertions, 3 deletions
diff --git a/src/testing/testing_api_cmd_coin_history.c b/src/testing/testing_api_cmd_coin_history.c index 38905b353..703465ab0 100644 --- a/src/testing/testing_api_cmd_coin_history.c +++ b/src/testing/testing_api_cmd_coin_history.c @@ -148,9 +148,8 @@ history_entry_cmp ( if (0 != GNUNET_memcmp (&h1->details.recoup.coin_sig, &h2->details.recoup.coin_sig)) return 1; - if (0 != GNUNET_memcmp (&h1->details.recoup.exchange_sig, - &h2->details.recoup.exchange_sig)) - return 1; + /* Note: exchange_sig, exchange_pub and timestamp are + fundamentally not available in the initiating command */ return 0; case TALER_EXCHANGE_CTT_RECOUP_REFRESH: if (0 != GNUNET_memcmp (&h1->details.recoup_refresh.coin_sig, diff --git a/src/testing/testing_api_cmd_recoup.c b/src/testing/testing_api_cmd_recoup.c index c4e72333e..cefcd96bb 100644 --- a/src/testing/testing_api_cmd_recoup.c +++ b/src/testing/testing_api_cmd_recoup.c @@ -59,6 +59,16 @@ struct RecoupState struct TALER_ReservePublicKeyP reserve_pub; /** + * Entry in the coin's history generated by this operation. + */ + struct TALER_EXCHANGE_CoinHistoryEntry che; + + /** + * Public key of the refunded coin. + */ + struct TALER_CoinSpendPublicKeyP coin; + + /** * Reserve history entry, set if this recoup actually filled up a reserve. * Otherwise `reserve_history.type` will be zero. */ @@ -145,6 +155,7 @@ recoup_cb (void *cls, TALER_amount_is_valid (&ps->reserve_history.amount)) ps->reserve_history.type = TALER_EXCHANGE_RTT_RECOUP; /* ps->reserve_history.details.recoup_details.coin_pub; // initialized earlier */ + ps->che.details.recoup.reserve_pub = ps->reserve_pub; } break; case MHD_HTTP_NOT_FOUND: @@ -183,6 +194,7 @@ recoup_run (void *cls, char *cref; unsigned int idx; const struct TALER_ExchangeWithdrawValues *ewv; + struct TALER_DenominationHashP h_denom_pub; ps->is = is; if (GNUNET_OK != @@ -214,6 +226,8 @@ recoup_run (void *cls, TALER_TESTING_interpreter_fail (is); return; } + GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv->eddsa_priv, + &ps->coin.eddsa_pub); if (GNUNET_OK != TALER_TESTING_get_trait_exchange_wd_value (coin_cmd, idx, @@ -256,6 +270,17 @@ recoup_run (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Trying to recoup denomination '%s'\n", TALER_B2S (&denom_pub->h_key)); + ps->che.type = TALER_EXCHANGE_CTT_RECOUP; + ps->che.amount = ps->reserve_history.amount; + TALER_planchet_blinding_secret_create (planchet, + ewv, + &ps->che.details.recoup.coin_bks); + TALER_denom_pub_hash (&denom_pub->key, + &h_denom_pub); + TALER_wallet_recoup_sign (&h_denom_pub, + &ps->che.details.recoup.coin_bks, + coin_priv, + &ps->che.details.recoup.coin_sig); ps->ph = TALER_EXCHANGE_recoup ( TALER_TESTING_interpreter_get_context (is), TALER_TESTING_get_exchange_url (is), @@ -316,6 +341,10 @@ recoup_traits (void *cls, TALER_TESTING_make_trait_reserve_pub (&ps->reserve_pub), TALER_TESTING_make_trait_reserve_history (0, &ps->reserve_history), + TALER_TESTING_make_trait_coin_history (0, + &ps->che), + TALER_TESTING_make_trait_coin_pub (0, + &ps->coin), TALER_TESTING_trait_end () }; |