exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 63a4bf4d691304daf9586023e24412701d869a6f
parent b82a40e73234024746e2672e36d706db41437087
Author: Özgür Kesim <oec@codeblau.de>
Date:   Wed,  7 May 2025 10:12:19 +0200

[testing] adjust idempotency withdraw scenario for CS case

In case of CS denominations, the key reuse test does only reuse
the private key material, but _not_ the blinding seed for the withdraw
operation.  Therefore, the exchange does _not_ detect a idempotent
withdrawal.

We have to accomodate for this difference and alter the expected
HTTP status.

Diffstat:
Msrc/testing/test_exchange_api.c | 8++++++--
Msrc/testing/testing_api_cmd_withdraw.c | 14++++++++------
2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/testing/test_exchange_api.c b/src/testing/test_exchange_api.c @@ -145,14 +145,18 @@ run (void *cls, 0, /* age restriction off */ MHD_HTTP_OK), /** - * Idempotent withdrawal + * Idempotent withdrawal. Note that in the case of CS, this is _not_ + * idempotent because the blinding nonces still differ, so instead, + * it is an overcharging of the reserve. */ TALER_TESTING_cmd_withdraw_amount_reuse_key ("withdraw-coin-1-idem", "create-reserve-1", "EUR:5", 0, /* age restriction off */ "withdraw-coin-1", - MHD_HTTP_OK), + (uses_cs) + ? MHD_HTTP_CONFLICT + : MHD_HTTP_OK), /** * Withdraw EUR:1 using the SAME private coin key as for the previous coin * (in violation of the specification, to be detected on spending!). diff --git a/src/testing/testing_api_cmd_withdraw.c b/src/testing/testing_api_cmd_withdraw.c @@ -404,7 +404,15 @@ withdraw_run (void *cls, = TALER_reserve_make_payto (ws->exchange_url, &ws->reserve_pub); + TALER_withdraw_master_seed_setup_random (&ws->seed); + TALER_cs_withdraw_seed_to_blinding_seed (&ws->seed, + &ws->blinding_seed); + /** + * In case of coin key material reuse, we _only_ reuse the + * master seed, but the blinding seed is still randomly chosen, + * see the lines prior to this. + */ if (NULL != ws->reuse_coin_key_ref) { const struct TALER_WithdrawMasterSeedP *seed; @@ -426,12 +434,6 @@ withdraw_run (void *cls, &seed)); ws->seed = *seed; } - else - { - TALER_withdraw_master_seed_setup_random (&ws->seed); - } - TALER_cs_withdraw_seed_to_blinding_seed (&ws->seed, - &ws->blinding_seed); if (NULL == ws->pk) {