diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-10-29 20:51:26 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-10-29 20:51:26 +0100 |
commit | 3784541b6c7e178546e91d9cb6579d8643989f59 (patch) | |
tree | db9be98aefc53c63df9df61e827c7f33a4d9d45d /src | |
parent | 9d71f037c015246ff5b2a804771cff9d84eb95dd (diff) |
make replay deposit command not use current time
Diffstat (limited to 'src')
-rw-r--r-- | src/testing/test_exchange_api.c | 15 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_deposit.c | 34 |
2 files changed, 31 insertions, 18 deletions
diff --git a/src/testing/test_exchange_api.c b/src/testing/test_exchange_api.c index b3ea88113..4ae47aff2 100644 --- a/src/testing/test_exchange_api.c +++ b/src/testing/test_exchange_api.c @@ -186,7 +186,12 @@ run (void *cls, GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_OK), - TALER_TESTING_cmd_deposit_replay ("deposit-simple-replay", + TALER_TESTING_cmd_deposit_replay ("deposit-simple-replay-1", + "deposit-simple", + MHD_HTTP_OK), + TALER_TESTING_cmd_sleep ("sleep-before-deposit-replay", + 1), + TALER_TESTING_cmd_deposit_replay ("deposit-simple-replay-2", "deposit-simple", MHD_HTTP_OK), /* This creates a conflict, as we have the same coin public key (reuse!), @@ -405,6 +410,14 @@ run (void *cls, TALER_TESTING_cmd_deposit_replay ("deposit-simple-replay-age", "deposit-simple-age", MHD_HTTP_OK), + TALER_TESTING_cmd_deposit_replay ("deposit-simple-replay-age-1", + "deposit-simple-age", + MHD_HTTP_OK), + TALER_TESTING_cmd_sleep ("sleep-before-age-deposit-replay", + 1), + TALER_TESTING_cmd_deposit_replay ("deposit-simple-replay-age-2", + "deposit-simple-age", + MHD_HTTP_OK), TALER_TESTING_cmd_end () }; diff --git a/src/testing/testing_api_cmd_deposit.c b/src/testing/testing_api_cmd_deposit.c index b7f7c66c5..a80b44868 100644 --- a/src/testing/testing_api_cmd_deposit.c +++ b/src/testing/testing_api_cmd_deposit.c @@ -313,6 +313,22 @@ deposit_run (void *cls, return; } ds->is = is; + if (! GNUNET_TIME_absolute_is_zero (ds->refund_deadline.abs_time)) + { + struct GNUNET_TIME_Relative refund_deadline; + + refund_deadline + = GNUNET_TIME_absolute_get_remaining (ds->refund_deadline.abs_time); + ds->wire_deadline + = GNUNET_TIME_relative_to_timestamp ( + GNUNET_TIME_relative_multiply (refund_deadline, + 2)); + } + else + { + ds->refund_deadline = ds->wallet_timestamp; + ds->wire_deadline = GNUNET_TIME_timestamp_get (); + } if (NULL != ds->deposit_reference) { /* We're copying another deposit operation, initialize here. */ @@ -335,6 +351,7 @@ deposit_run (void *cls, ds->contract_terms = json_incref (ods->contract_terms); ds->wallet_timestamp = ods->wallet_timestamp; ds->refund_deadline = ods->refund_deadline; + ds->wire_deadline = ods->wire_deadline; ds->amount = ods->amount; ds->merchant_priv = ods->merchant_priv; ds->command_initialized = GNUNET_YES; @@ -415,23 +432,6 @@ deposit_run (void *cls, GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv->eddsa_priv, &coin_pub.eddsa_pub); - if (! GNUNET_TIME_absolute_is_zero (ds->refund_deadline.abs_time)) - { - struct GNUNET_TIME_Relative refund_deadline; - - refund_deadline - = GNUNET_TIME_absolute_get_remaining (ds->refund_deadline.abs_time); - ds->wire_deadline - = - GNUNET_TIME_relative_to_timestamp ( - GNUNET_TIME_relative_multiply (refund_deadline, - 2)); - } - else - { - ds->refund_deadline = ds->wallet_timestamp; - ds->wire_deadline = ds->wallet_timestamp; - } GNUNET_CRYPTO_eddsa_key_get_public (&ds->merchant_priv.eddsa_priv, &merchant_pub.eddsa_pub); { |