aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-04-24 15:29:50 +0200
committerChristian Grothoff <christian@grothoff.org>2022-04-24 15:29:58 +0200
commitaedd2014ec50e2b52cad76d9c40c218ed0c9ccfc (patch)
tree3b4ef17e90f152a161c6929fbe1da07c366a4268 /src/testing
parent36c568ab8df9b8e523c9ffc45271533af77accc7 (diff)
-misc p2p fixes
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/test_exchange_p2p.c2
-rw-r--r--src/testing/testing_api_cmd_purse_create_deposit.c21
-rw-r--r--src/testing/testing_api_cmd_purse_merge.c9
3 files changed, 14 insertions, 18 deletions
diff --git a/src/testing/test_exchange_p2p.c b/src/testing/test_exchange_p2p.c
index b16b2f0a2..e4b334aa0 100644
--- a/src/testing/test_exchange_p2p.c
+++ b/src/testing/test_exchange_p2p.c
@@ -158,7 +158,7 @@ run (void *cls,
true, /* upload contract */
GNUNET_TIME_UNIT_MINUTES, /* expiration */
"withdraw-coin-1",
- "EUR:1", /* FIXME: check amount vs. fees! */
+ "EUR:1.01", /* FIXME: check amount vs. fees! */
NULL),
TALER_TESTING_cmd_contract_get (
"purse-get-contract",
diff --git a/src/testing/testing_api_cmd_purse_create_deposit.c b/src/testing/testing_api_cmd_purse_create_deposit.c
index 13b2dffa6..ef98c9055 100644
--- a/src/testing/testing_api_cmd_purse_create_deposit.c
+++ b/src/testing/testing_api_cmd_purse_create_deposit.c
@@ -259,17 +259,23 @@ deposit_run (void *cls,
GNUNET_CRYPTO_eddsa_key_create (&ds->purse_priv.eddsa_priv);
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_relative_to_timestamp (ds->rel_expiration);
GNUNET_CRYPTO_eddsa_key_get_public (&ds->purse_priv.eddsa_priv,
&ds->purse_pub.eddsa_pub);
+
+ ds->purse_expiration =
+ GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_relative_to_absolute (ds->rel_expiration));
+ GNUNET_assert (0 ==
+ json_object_set_new (
+ ds->contract_terms,
+ "pay_deadline",
+ GNUNET_JSON_from_timestamp (ds->purse_expiration)));
ds->dh = TALER_EXCHANGE_purse_create_with_deposit (
is->exchange,
&ds->purse_priv,
&ds->merge_priv,
&ds->contract_priv,
ds->contract_terms,
- ds->purse_expiration,
ds->num_coin_references,
deposits,
ds->upload_contract,
@@ -361,7 +367,6 @@ TALER_TESTING_cmd_purse_create_with_deposit (
...)
{
struct PurseCreateDepositState *ds;
- struct GNUNET_TIME_Timestamp pay_deadline;
ds = GNUNET_new (struct PurseCreateDepositState);
ds->rel_expiration = purse_expiration;
@@ -378,14 +383,6 @@ TALER_TESTING_cmd_purse_create_with_deposit (
label);
GNUNET_assert (0);
}
- pay_deadline =
- GNUNET_TIME_absolute_to_timestamp (
- GNUNET_TIME_relative_to_absolute (purse_expiration));
- GNUNET_assert (0 ==
- json_object_set_new (
- ds->contract_terms,
- "pay_deadline",
- GNUNET_JSON_from_timestamp (pay_deadline)));
{
va_list ap;
unsigned int i;
diff --git a/src/testing/testing_api_cmd_purse_merge.c b/src/testing/testing_api_cmd_purse_merge.c
index a17f8a9d7..27aa120ed 100644
--- a/src/testing/testing_api_cmd_purse_merge.c
+++ b/src/testing/testing_api_cmd_purse_merge.c
@@ -128,7 +128,7 @@ merge_run (void *cls,
const struct TALER_PurseMergePrivateKeyP *merge_priv;
const json_t *ct;
struct TALER_PrivateContractHashP h_contract_terms;
- uint32_t min_age;
+ uint32_t min_age = 0;
struct TALER_Amount value_after_fees;
struct GNUNET_TIME_Timestamp purse_expiration;
const struct TALER_TESTING_Command *ref;
@@ -172,6 +172,8 @@ merge_run (void *cls,
}
{
struct GNUNET_JSON_Specification spec[] = {
+ GNUNET_JSON_spec_timestamp ("pay_deadline",
+ &purse_expiration),
TALER_JSON_spec_amount_any ("amount",
&value_after_fees),
GNUNET_JSON_spec_mark_optional (
@@ -192,9 +194,6 @@ merge_run (void *cls,
}
}
- // FIXME: how to get purse_expiration nicely!?!?
- // See create_with_deposit FIXME: from pay deadline?
-
if (NULL == ds->reserve_ref)
{
GNUNET_CRYPTO_eddsa_key_create (&ds->reserve_priv.eddsa_priv);
@@ -204,7 +203,7 @@ merge_run (void *cls,
const struct TALER_ReservePrivateKeyP *rp;
ref = TALER_TESTING_interpreter_lookup_command (ds->is,
- ds->merge_ref);
+ ds->reserve_ref);
GNUNET_assert (NULL != ref);
if (GNUNET_OK !=
TALER_TESTING_get_trait_reserve_priv (ref,