aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-04-26 17:46:36 +0200
committerChristian Grothoff <christian@grothoff.org>2022-04-26 17:46:36 +0200
commit336f2d8991fe4b77b625415c179f68b387a2719b (patch)
treefe89fc465d87535339bf627c159ded1eff371599 /src/testing
parent25aa208d122f8967d7821222a7809acfaf57abd3 (diff)
-misc. minor fixes
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/test_exchange_p2p.c1
-rw-r--r--src/testing/testing_api_cmd_reserve_purse.c19
2 files changed, 20 insertions, 0 deletions
diff --git a/src/testing/test_exchange_p2p.c b/src/testing/test_exchange_p2p.c
index 6d4017c1d..c70fe9d8b 100644
--- a/src/testing/test_exchange_p2p.c
+++ b/src/testing/test_exchange_p2p.c
@@ -176,6 +176,7 @@ run (void *cls,
MHD_HTTP_OK,
"{\"amount\":\"EUR:1\",\"summary\":\"ice cream\"}",
true /* upload contract */,
+ GNUNET_TIME_UNIT_MINUTES, /* expiration */
"create-reserve-1"),
TALER_TESTING_cmd_contract_get (
"pull-get-contract",
diff --git a/src/testing/testing_api_cmd_reserve_purse.c b/src/testing/testing_api_cmd_reserve_purse.c
index 8f44692fd..ada803d3d 100644
--- a/src/testing/testing_api_cmd_reserve_purse.c
+++ b/src/testing/testing_api_cmd_reserve_purse.c
@@ -72,6 +72,16 @@ struct ReservePurseState
struct TALER_EXCHANGE_PurseCreateMergeHandle *dh;
/**
+ * When will the purse expire?
+ */
+ struct GNUNET_TIME_Relative expiration_rel;
+
+ /**
+ * When will the purse expire?
+ */
+ struct GNUNET_TIME_Timestamp purse_expiration;
+
+ /**
* Contract terms for the purse.
*/
json_t *contract_terms;
@@ -161,6 +171,13 @@ purse_run (void *cls,
&ds->purse_pub.eddsa_pub);
GNUNET_CRYPTO_eddsa_key_create (&ds->merge_priv.eddsa_priv);
GNUNET_CRYPTO_ecdhe_key_create (&ds->contract_priv.ecdhe_priv);
+ ds->purse_expiration = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_relative_to_absolute (ds->expiration_rel));
+ GNUNET_assert (0 ==
+ json_object_set_new (
+ ds->contract_terms,
+ "pay_deadline",
+ GNUNET_JSON_from_timestamp (ds->purse_expiration)));
ds->merge_timestamp = GNUNET_TIME_timestamp_get ();
ds->dh = TALER_EXCHANGE_purse_create_with_merge (
is->exchange,
@@ -252,12 +269,14 @@ TALER_TESTING_cmd_purse_create_with_reserve (
unsigned int expected_http_status,
const char *contract_terms,
bool upload_contract,
+ struct GNUNET_TIME_Relative expiration,
const char *reserve_ref)
{
struct ReservePurseState *ds;
json_error_t err;
ds = GNUNET_new (struct ReservePurseState);
+ ds->expiration_rel = expiration;
ds->contract_terms = json_loads (contract_terms,
0 /* flags */,
&err);