summaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-12-14 16:04:32 +0100
committerChristian Grothoff <christian@grothoff.org>2021-12-14 16:04:40 +0100
commit1a1fafbd438f3f21a15c990d904e192b045d2391 (patch)
treecdd32023fd1d7c530caeae0487528d7eaac2aa29 /src/testing
parentbf54ee30d4727217264f470321cc2f91facf63cc (diff)
downloadexchange-1a1fafbd438f3f21a15c990d904e192b045d2391.tar.gz
exchange-1a1fafbd438f3f21a15c990d904e192b045d2391.tar.bz2
exchange-1a1fafbd438f3f21a15c990d904e192b045d2391.zip
introducing GNUNET_TIME_Timestamp, recoup now with amounts
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/test_taler_exchange_aggregator.c48
-rw-r--r--src/testing/testing_api_cmd_auditor_add.c5
-rw-r--r--src/testing/testing_api_cmd_auditor_del.c5
-rw-r--r--src/testing/testing_api_cmd_auditor_deposit_confirmation.c26
-rw-r--r--src/testing/testing_api_cmd_bank_admin_add_incoming.c8
-rw-r--r--src/testing/testing_api_cmd_bank_transfer.c6
-rw-r--r--src/testing/testing_api_cmd_check_keys.c23
-rw-r--r--src/testing/testing_api_cmd_deposit.c48
-rw-r--r--src/testing/testing_api_cmd_insert_deposit.c35
-rw-r--r--src/testing/testing_api_cmd_recoup.c8
-rw-r--r--src/testing/testing_api_cmd_set_wire_fee.c15
-rw-r--r--src/testing/testing_api_cmd_status.c5
-rw-r--r--src/testing/testing_api_cmd_wire_add.c5
-rw-r--r--src/testing/testing_api_cmd_wire_del.c5
-rw-r--r--src/testing/testing_api_helpers_exchange.c29
15 files changed, 129 insertions, 142 deletions
diff --git a/src/testing/test_taler_exchange_aggregator.c b/src/testing/test_taler_exchange_aggregator.c
index 684fe9697..bf28375b2 100644
--- a/src/testing/test_taler_exchange_aggregator.c
+++ b/src/testing/test_taler_exchange_aggregator.c
@@ -111,7 +111,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
"EUR:0.1"),
@@ -130,7 +130,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
"EUR:0.1"),
@@ -139,7 +139,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
"EUR:0.1"),
@@ -159,7 +159,7 @@ run (void *cls,
&dbc,
"bob",
"4",
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
"EUR:0.1"),
@@ -167,7 +167,7 @@ run (void *cls,
&dbc,
"bob",
"5",
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
"EUR:0.1"),
@@ -175,7 +175,7 @@ run (void *cls,
&dbc,
"alice",
"4",
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
"EUR:0.1"),
@@ -204,7 +204,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
5),
@@ -214,7 +214,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
5),
@@ -240,7 +240,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
10),
@@ -251,7 +251,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
5),
@@ -276,7 +276,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.102",
"EUR:0.1"),
@@ -288,7 +288,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.102",
"EUR:0.1"),
@@ -296,7 +296,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.102",
"EUR:0.1"),
@@ -308,7 +308,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.102",
"EUR:0.1"),
@@ -320,7 +320,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.112",
"EUR:0.1"),
@@ -337,7 +337,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.109",
"EUR:0.1"),
@@ -349,7 +349,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.119",
"EUR:0.1"),
@@ -366,7 +366,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.122",
"EUR:0.1"),
@@ -383,7 +383,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
5),
@@ -397,7 +397,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
5),
@@ -413,7 +413,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.122",
"EUR:0.1"),
@@ -430,7 +430,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
5),
@@ -444,7 +444,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
5),
@@ -460,7 +460,7 @@ run (void *cls,
&dbc,
"bob",
USER42_ACCOUNT,
- GNUNET_TIME_absolute_get (),
+ GNUNET_TIME_timestamp_get (),
GNUNET_TIME_UNIT_ZERO,
"EUR:0.112",
"EUR:0.1"),
diff --git a/src/testing/testing_api_cmd_auditor_add.c b/src/testing/testing_api_cmd_auditor_add.c
index e40e13194..8362b66c9 100644
--- a/src/testing/testing_api_cmd_auditor_add.c
+++ b/src/testing/testing_api_cmd_auditor_add.c
@@ -102,12 +102,11 @@ auditor_add_run (void *cls,
struct TALER_TESTING_Interpreter *is)
{
struct AuditorAddState *ds = cls;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
struct TALER_MasterSignatureP master_sig;
(void) cmd;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
ds->is = is;
if (ds->bad_sig)
{
diff --git a/src/testing/testing_api_cmd_auditor_del.c b/src/testing/testing_api_cmd_auditor_del.c
index dc31b72b6..de03d1632 100644
--- a/src/testing/testing_api_cmd_auditor_del.c
+++ b/src/testing/testing_api_cmd_auditor_del.c
@@ -103,11 +103,10 @@ auditor_del_run (void *cls,
{
struct AuditorDelState *ds = cls;
struct TALER_MasterSignatureP master_sig;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
(void) cmd;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
ds->is = is;
if (ds->bad_sig)
{
diff --git a/src/testing/testing_api_cmd_auditor_deposit_confirmation.c b/src/testing/testing_api_cmd_auditor_deposit_confirmation.c
index df32b352b..debf343cc 100644
--- a/src/testing/testing_api_cmd_auditor_deposit_confirmation.c
+++ b/src/testing/testing_api_cmd_auditor_deposit_confirmation.c
@@ -204,11 +204,11 @@ deposit_confirmation_run (void *cls,
const struct TALER_TESTING_Command *deposit_cmd;
struct TALER_MerchantWireHash h_wire;
struct TALER_PrivateContractHash h_contract_terms;
- const struct GNUNET_TIME_Absolute *exchange_timestamp = NULL;
- struct GNUNET_TIME_Absolute timestamp;
- const struct GNUNET_TIME_Absolute *wire_deadline;
- struct GNUNET_TIME_Absolute refund_deadline
- = GNUNET_TIME_UNIT_ZERO_ABS;
+ const struct GNUNET_TIME_Timestamp *exchange_timestamp = NULL;
+ struct GNUNET_TIME_Timestamp timestamp;
+ const struct GNUNET_TIME_Timestamp *wire_deadline;
+ struct GNUNET_TIME_Timestamp refund_deadline
+ = GNUNET_TIME_UNIT_ZERO_TS;
struct TALER_Amount amount_without_fee;
struct TALER_CoinSpendPublicKeyP coin_pub;
const struct TALER_MerchantPrivateKeyP *merchant_priv;
@@ -243,9 +243,9 @@ deposit_confirmation_run (void *cls,
dcs->coin_index,
&exchange_sig));
GNUNET_assert (GNUNET_OK ==
- TALER_TESTING_get_trait_absolute_time (deposit_cmd,
- dcs->coin_index,
- &exchange_timestamp));
+ TALER_TESTING_get_trait_timestamp (deposit_cmd,
+ dcs->coin_index,
+ &exchange_timestamp));
GNUNET_assert (GNUNET_OK ==
TALER_TESTING_get_trait_wire_deadline (deposit_cmd,
dcs->coin_index,
@@ -287,11 +287,11 @@ deposit_confirmation_run (void *cls,
{
struct GNUNET_JSON_Specification spec[] = {
/* timestamp is mandatory */
- TALER_JSON_spec_absolute_time ("timestamp",
- &timestamp),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &timestamp),
GNUNET_JSON_spec_mark_optional (
- TALER_JSON_spec_absolute_time ("refund_deadline",
- &refund_deadline)),
+ GNUNET_JSON_spec_timestamp ("refund_deadline",
+ &refund_deadline)),
GNUNET_JSON_spec_end ()
};
@@ -304,7 +304,7 @@ deposit_confirmation_run (void *cls,
TALER_TESTING_interpreter_fail (is);
return;
}
- if (0 == refund_deadline.abs_value_us)
+ if (GNUNET_TIME_absolute_is_zero (refund_deadline.abs_time))
refund_deadline = timestamp;
}
dcs->dc = TALER_AUDITOR_deposit_confirmation (dcs->auditor,
diff --git a/src/testing/testing_api_cmd_bank_admin_add_incoming.c b/src/testing/testing_api_cmd_bank_admin_add_incoming.c
index 58089f429..64e010efa 100644
--- a/src/testing/testing_api_cmd_bank_admin_add_incoming.c
+++ b/src/testing/testing_api_cmd_bank_admin_add_incoming.c
@@ -117,7 +117,7 @@ struct AdminAddIncomingState
/**
* Timestamp of the transaction (as returned from the bank).
*/
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
/**
* Merchant instance. Sometimes used to get the tip reserve
@@ -207,7 +207,7 @@ confirmation_cb (void *cls,
unsigned int http_status,
enum TALER_ErrorCode ec,
uint64_t serial_id,
- struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Timestamp timestamp,
const json_t *json)
{
struct AdminAddIncomingState *fts = cls;
@@ -432,7 +432,7 @@ admin_add_incoming_traits (void *cls,
TALER_TESTING_make_trait_exchange_bank_account_url (
&fts->exchange_credit_url),
TALER_TESTING_make_trait_amount (&fts->amount),
- TALER_TESTING_make_trait_absolute_time (0, &fts->timestamp),
+ TALER_TESTING_make_trait_timestamp (0, &fts->timestamp),
TALER_TESTING_make_trait_reserve_priv (&fts->reserve_priv),
TALER_TESTING_make_trait_reserve_pub (&fts->reserve_pub),
TALER_TESTING_make_trait_reserve_history (&fts->reserve_history),
@@ -454,7 +454,7 @@ admin_add_incoming_traits (void *cls,
TALER_TESTING_make_trait_exchange_bank_account_url (
&fts->exchange_credit_url),
TALER_TESTING_make_trait_amount (&fts->amount),
- TALER_TESTING_make_trait_absolute_time (0, &fts->timestamp),
+ TALER_TESTING_make_trait_timestamp (0, &fts->timestamp),
TALER_TESTING_make_trait_reserve_pub (&fts->reserve_pub),
TALER_TESTING_make_trait_reserve_history (&fts->reserve_history),
TALER_TESTING_trait_end ()
diff --git a/src/testing/testing_api_cmd_bank_transfer.c b/src/testing/testing_api_cmd_bank_transfer.c
index 0755a71d2..8c14aac19 100644
--- a/src/testing/testing_api_cmd_bank_transfer.c
+++ b/src/testing/testing_api_cmd_bank_transfer.c
@@ -97,7 +97,7 @@ struct TransferState
/**
* Timestamp of the transaction (as returned from the bank).
*/
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Timestamp timestamp;
/**
* Configuration filename. Used to get the tip reserve key
@@ -175,7 +175,7 @@ confirmation_cb (void *cls,
unsigned int http_status,
enum TALER_ErrorCode ec,
uint64_t serial_id,
- struct GNUNET_TIME_Absolute timestamp)
+ struct GNUNET_TIME_Timestamp timestamp)
{
struct TransferState *fts = cls;
struct TALER_TESTING_Interpreter *is = fts->is;
@@ -326,7 +326,7 @@ transfer_traits (void *cls,
TALER_TESTING_make_trait_debit_payto_uri (
(const char **) &fts->payto_debit_account),
TALER_TESTING_make_trait_amount (&fts->amount),
- TALER_TESTING_make_trait_absolute_time (0, &fts->timestamp),
+ TALER_TESTING_make_trait_timestamp (0, &fts->timestamp),
TALER_TESTING_make_trait_wtid (&fts->wtid),
TALER_TESTING_trait_end ()
};
diff --git a/src/testing/testing_api_cmd_check_keys.c b/src/testing/testing_api_cmd_check_keys.c
index 5645bb9be..0dee8be3a 100644
--- a/src/testing/testing_api_cmd_check_keys.c
+++ b/src/testing/testing_api_cmd_check_keys.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- (C) 2018, 2020 Taler Systems SA
+ (C) 2018, 2020, 2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -55,7 +55,7 @@ struct CheckKeysState
/**
* Last denomination date we received when doing this request.
*/
- struct GNUNET_TIME_Absolute my_denom_date;
+ struct GNUNET_TIME_Timestamp my_denom_date;
};
@@ -80,7 +80,7 @@ check_keys_run (void *cls,
is->key_generation);
if (is->key_generation < cks->generation)
{
- struct GNUNET_TIME_Absolute rdate;
+ struct GNUNET_TIME_Timestamp rdate;
is->working = GNUNET_NO;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -93,11 +93,11 @@ check_keys_run (void *cls,
{
TALER_LOG_DEBUG ("Forcing last_denom_date URL argument set to zero\n");
TALER_EXCHANGE_set_last_denom (is->exchange,
- GNUNET_TIME_UNIT_ZERO_ABS);
+ GNUNET_TIME_UNIT_ZERO_TS);
}
else
{
- const struct GNUNET_TIME_Absolute *last_denom_date;
+ const struct GNUNET_TIME_Timestamp *last_denom_date;
const struct TALER_TESTING_Command *ref;
ref = TALER_TESTING_interpreter_lookup_command (is,
@@ -109,9 +109,9 @@ check_keys_run (void *cls,
return;
}
if (GNUNET_OK !=
- TALER_TESTING_get_trait_absolute_time (ref,
- 0,
- &last_denom_date))
+ TALER_TESTING_get_trait_timestamp (ref,
+ 0,
+ &last_denom_date))
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (is);
@@ -130,8 +130,7 @@ check_keys_run (void *cls,
? TALER_EXCHANGE_CKF_FORCE_ALL_NOW
: TALER_EXCHANGE_CKF_FORCE_DOWNLOAD);
/* Redownload /keys. */
- GNUNET_break (0 ==
- rdate.abs_value_us);
+ GNUNET_break (GNUNET_TIME_absolute_is_zero (rdate.abs_time));
return;
}
{
@@ -186,8 +185,8 @@ check_keys_traits (void *cls,
struct CheckKeysState *cks = cls;
struct TALER_TESTING_Trait traits[] = {
/* history entry MUST be first due to response code logic below! */
- TALER_TESTING_make_trait_absolute_time (0,
- &cks->my_denom_date),
+ TALER_TESTING_make_trait_timestamp (0,
+ &cks->my_denom_date),
TALER_TESTING_trait_end ()
};
diff --git a/src/testing/testing_api_cmd_deposit.c b/src/testing/testing_api_cmd_deposit.c
index cb6dfc0b2..a0eb35f19 100644
--- a/src/testing/testing_api_cmd_deposit.c
+++ b/src/testing/testing_api_cmd_deposit.c
@@ -82,12 +82,12 @@ struct DepositState
/**
* Refund deadline. Zero for no refunds.
*/
- struct GNUNET_TIME_Absolute refund_deadline;
+ struct GNUNET_TIME_Timestamp refund_deadline;
/**
* Wire deadline.
*/
- struct GNUNET_TIME_Absolute wire_deadline;
+ struct GNUNET_TIME_Timestamp wire_deadline;
/**
* Set (by the interpreter) to a fresh private key. This
@@ -103,7 +103,7 @@ struct DepositState
/**
* Timestamp of the /deposit operation in the wallet (contract signing time).
*/
- struct GNUNET_TIME_Absolute wallet_timestamp;
+ struct GNUNET_TIME_Timestamp wallet_timestamp;
/**
* Interpreter state.
@@ -139,7 +139,7 @@ struct DepositState
/**
* When did the exchange receive the deposit?
*/
- struct GNUNET_TIME_Absolute exchange_timestamp;
+ struct GNUNET_TIME_Timestamp exchange_timestamp;
/**
* Signing key used by the exchange to sign the
@@ -402,27 +402,25 @@ deposit_run (void *cls,
GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv->eddsa_priv,
&coin_pub.eddsa_pub);
- if (0 != ds->refund_deadline.abs_value_us)
+ 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);
+ = GNUNET_TIME_absolute_get_remaining (ds->refund_deadline.abs_time);
ds->wire_deadline
- = GNUNET_TIME_relative_to_absolute (
+ =
+ GNUNET_TIME_relative_to_timestamp (
GNUNET_TIME_relative_multiply (refund_deadline,
2));
}
else
{
ds->refund_deadline = ds->wallet_timestamp;
- ds->wire_deadline
- = GNUNET_TIME_relative_to_absolute (
- GNUNET_TIME_UNIT_ZERO);
+ ds->wire_deadline = GNUNET_TIME_timestamp_get ();
}
GNUNET_CRYPTO_eddsa_key_get_public (&ds->merchant_priv.eddsa_priv,
&merchant_pub.eddsa_pub);
- (void) GNUNET_TIME_round_abs (&ds->wire_deadline);
{
struct TALER_MerchantWireHash h_wire;
@@ -562,8 +560,8 @@ deposit_traits (void *cls,
TALER_TESTING_make_trait_merchant_priv (&ds->merchant_priv),
TALER_TESTING_make_trait_deposit_amount (&ds->amount),
TALER_TESTING_make_trait_deposit_fee_amount (&ds->deposit_fee),
- TALER_TESTING_make_trait_absolute_time (0,
- &ds->exchange_timestamp),
+ TALER_TESTING_make_trait_timestamp (0,
+ &ds->exchange_timestamp),
TALER_TESTING_make_trait_wire_deadline (0,
&ds->wire_deadline),
TALER_TESTING_make_trait_refund_deadline (0,
@@ -610,22 +608,19 @@ TALER_TESTING_cmd_deposit (const char *label,
label);
GNUNET_assert (0);
}
- ds->wallet_timestamp = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&ds->wallet_timestamp);
-
+ ds->wallet_timestamp = GNUNET_TIME_timestamp_get ();
GNUNET_assert (0 ==
json_object_set_new (ds->contract_terms,
"timestamp",
- GNUNET_JSON_from_time_abs (
+ GNUNET_JSON_from_timestamp (
ds->wallet_timestamp)));
- if (0 != refund_deadline.rel_value_us)
+ if (! GNUNET_TIME_relative_is_zero (refund_deadline))
{
- ds->refund_deadline = GNUNET_TIME_relative_to_absolute (refund_deadline);
- (void) GNUNET_TIME_round_abs (&ds->refund_deadline);
+ ds->refund_deadline = GNUNET_TIME_relative_to_timestamp (refund_deadline);
GNUNET_assert (0 ==
json_object_set_new (ds->contract_terms,
"refund_deadline",
- GNUNET_JSON_from_time_abs (
+ GNUNET_JSON_from_timestamp (
ds->refund_deadline)));
}
GNUNET_assert (GNUNET_OK ==
@@ -677,19 +672,16 @@ TALER_TESTING_cmd_deposit_with_ref (const char *label,
label);
GNUNET_assert (0);
}
- ds->wallet_timestamp = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&ds->wallet_timestamp);
-
+ ds->wallet_timestamp = GNUNET_TIME_timestamp_get ();
json_object_set_new (ds->contract_terms,
"timestamp",
- GNUNET_JSON_from_time_abs (ds->wallet_timestamp));
+ GNUNET_JSON_from_timestamp (ds->wallet_timestamp));
if (0 != refund_deadline.rel_value_us)
{
- ds->refund_deadline = GNUNET_TIME_relative_to_absolute (refund_deadline);
- (void) GNUNET_TIME_round_abs (&ds->refund_deadline);
+ ds->refund_deadline = GNUNET_TIME_relative_to_timestamp (refund_deadline);
json_object_set_new (ds->contract_terms,
"refund_deadline",
- GNUNET_JSON_from_time_abs (ds->refund_deadline));
+ GNUNET_JSON_from_timestamp (ds->refund_deadline));
}
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (amount,
diff --git a/src/testing/testing_api_cmd_insert_deposit.c b/src/testing/testing_api_cmd_insert_deposit.c
index 0001da223..276907e14 100644
--- a/src/testing/testing_api_cmd_insert_deposit.c
+++ b/src/testing/testing_api_cmd_insert_deposit.c
@@ -60,7 +60,7 @@ struct InsertDepositState
/**
* When did the exchange receive the deposit?
*/
- struct GNUNET_TIME_Absolute exchange_timestamp;
+ struct GNUNET_TIME_Timestamp exchange_timestamp;
/**
* Amount to deposit, inclusive of deposit fee.
@@ -81,27 +81,23 @@ struct InsertDepositState
static void
fake_issue (struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue)
{
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
memset (issue,
0,
sizeof (struct TALER_EXCHANGEDB_DenominationKeyInformationP));
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
issue->properties.start
- = GNUNET_TIME_absolute_hton (now);
+ = GNUNET_TIME_timestamp_hton (now);
issue->properties.expire_withdraw
- = GNUNET_TIME_absolute_hton (
- GNUNET_TIME_absolute_add (now,
- GNUNET_TIME_UNIT_MINUTES));
+ = GNUNET_TIME_timestamp_hton (
+ GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_MINUTES));
issue->properties.expire_deposit
- = GNUNET_TIME_absolute_hton (
- GNUNET_TIME_absolute_add (now,
- GNUNET_TIME_UNIT_HOURS));
+ = GNUNET_TIME_timestamp_hton (
+ GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_HOURS));
issue->properties.expire_legal
- = GNUNET_TIME_absolute_hton (
- GNUNET_TIME_absolute_add (now,
- GNUNET_TIME_UNIT_DAYS));
+ = GNUNET_TIME_timestamp_hton (
+ GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_DAYS));
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount_nbo ("EUR:1",
&issue->properties.value));
@@ -235,11 +231,9 @@ insert_deposit_run (void *cls,
memset (&deposit.wire_salt,
46,
sizeof (deposit.wire_salt));
- deposit.timestamp = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&deposit.timestamp);
- deposit.wire_deadline = GNUNET_TIME_relative_to_absolute (ids->wire_deadline);
- (void) GNUNET_TIME_round_abs (&deposit.wire_deadline);
-
+ deposit.timestamp = GNUNET_TIME_timestamp_get ();
+ deposit.wire_deadline = GNUNET_TIME_relative_to_timestamp (
+ ids->wire_deadline);
/* finally, actually perform the DB operation */
if ( (GNUNET_OK !=
ids->dbc->plugin->start (ids->dbc->plugin->cls,
@@ -295,14 +289,13 @@ TALER_TESTING_cmd_insert_deposit (
const struct TALER_TESTING_DatabaseConnection *dbc,
const char *merchant_name,
const char *merchant_account,
- struct GNUNET_TIME_Absolute exchange_timestamp,
+ struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Relative wire_deadline,
const char *amount_with_fee,
const char *deposit_fee)
{
struct InsertDepositState *ids;
- GNUNET_TIME_round_abs (&exchange_timestamp);
ids = GNUNET_new (struct InsertDepositState);
ids->dbc = dbc;
ids->merchant_name = merchant_name;
diff --git a/src/testing/testing_api_cmd_recoup.c b/src/testing/testing_api_cmd_recoup.c
index fe97edb76..379304d01 100644
--- a/src/testing/testing_api_cmd_recoup.c
+++ b/src/testing/testing_api_cmd_recoup.c
@@ -364,6 +364,7 @@ recoup_run (void *cls,
denom_pub,
coin_sig,
&planchet,
+ &ps->reserve_history.amount,
NULL != ps->melt_reference,
recoup_cb,
ps);
@@ -440,10 +441,9 @@ TALER_TESTING_cmd_recoup (const char *label,
ps->expected_response_code = expected_response_code;
ps->coin_reference = coin_reference;
ps->melt_reference = melt_reference;
- if ( (NULL != amount) &&
- (GNUNET_OK !=
- TALER_string_to_amount (amount,
- &ps->reserve_history.amount)) )
+ if (GNUNET_OK !=
+ TALER_string_to_amount (amount,
+ &ps->reserve_history.amount))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to parse amount `%s' at %s\n",
diff --git a/src/testing/testing_api_cmd_set_wire_fee.c b/src/testing/testing_api_cmd_set_wire_fee.c
index 9b5f6258d..b458d10c1 100644
--- a/src/testing/testing_api_cmd_set_wire_fee.c
+++ b/src/testing/testing_api_cmd_set_wire_fee.c
@@ -119,19 +119,20 @@ wire_add_run (void *cls,
struct WireFeeState *ds = cls;
struct TALER_MasterSignatureP master_sig;
struct GNUNET_TIME_Absolute now;
- struct GNUNET_TIME_Absolute start_time;
- struct GNUNET_TIME_Absolute end_time;
+ struct GNUNET_TIME_Timestamp start_time;
+ struct GNUNET_TIME_Timestamp end_time;
struct TALER_Amount wire_fee;
struct TALER_Amount closing_fee;
(void) cmd;
ds->is = is;
now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
- start_time = GNUNET_TIME_absolute_subtract (now,
- GNUNET_TIME_UNIT_HOURS);
- end_time = GNUNET_TIME_absolute_add (now,
- GNUNET_TIME_UNIT_HOURS);
+ start_time = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_subtract (now,
+ GNUNET_TIME_UNIT_HOURS));
+ end_time = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (now,
+ GNUNET_TIME_UNIT_HOURS));
if ( (GNUNET_OK !=
TALER_string_to_amount (ds->closing_fee,
&closing_fee)) ||
diff --git a/src/testing/testing_api_cmd_status.c b/src/testing/testing_api_cmd_status.c
index 1424eb6a5..f13f60073 100644
--- a/src/testing/testing_api_cmd_status.c
+++ b/src/testing/testing_api_cmd_status.c
@@ -88,8 +88,9 @@ history_entry_cmp (const struct TALER_EXCHANGE_ReserveHistory *h1,
h2->details.in_details.sender_url)) &&
(h1->details.in_details.wire_reference ==
h2->details.in_details.wire_reference) &&
- (h1->details.in_details.timestamp.abs_value_us ==
- h2->details.in_details.timestamp.abs_value_us) )
+ (GNUNET_TIME_timestamp_cmp (h1->details.in_details.timestamp,
+ ==,
+ h2->details.in_details.timestamp)) )
return 0;
return 1;
case TALER_EXCHANGE_RTT_WITHDRAWAL:
diff --git a/src/testing/testing_api_cmd_wire_add.c b/src/testing/testing_api_cmd_wire_add.c
index f36eaa85b..c07e9bba6 100644
--- a/src/testing/testing_api_cmd_wire_add.c
+++ b/src/testing/testing_api_cmd_wire_add.c
@@ -109,11 +109,10 @@ wire_add_run (void *cls,
struct WireAddState *ds = cls;
struct TALER_MasterSignatureP master_sig1;
struct TALER_MasterSignatureP master_sig2;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
(void) cmd;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
ds->is = is;
if (ds->bad_sig)
{
diff --git a/src/testing/testing_api_cmd_wire_del.c b/src/testing/testing_api_cmd_wire_del.c
index fa8c9bcd2..15d29d727 100644
--- a/src/testing/testing_api_cmd_wire_del.c
+++ b/src/testing/testing_api_cmd_wire_del.c
@@ -108,11 +108,10 @@ wire_del_run (void *cls,
{
struct WireDelState *ds = cls;
struct TALER_MasterSignatureP master_sig;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
(void) cmd;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
ds->is = is;
if (ds->bad_sig)
{
diff --git a/src/testing/testing_api_helpers_exchange.c b/src/testing/testing_api_helpers_exchange.c
index 0f50aabb8..fe7588107 100644
--- a/src/testing/testing_api_helpers_exchange.c
+++ b/src/testing/testing_api_helpers_exchange.c
@@ -422,19 +422,22 @@ const struct TALER_EXCHANGE_DenomPublicKey *
TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys,
const struct TALER_Amount *amount)
{
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
struct TALER_EXCHANGE_DenomPublicKey *pk;
char *str;
- now = GNUNET_TIME_absolute_get ();
+ now = GNUNET_TIME_timestamp_get ();
for (unsigned int i = 0; i<keys->num_denom_keys; i++)
{
pk = &keys->denom_keys[i];
if ( (0 == TALER_amount_cmp (amount,
&pk->value)) &&
- (now.abs_value_us >= pk->valid_from.abs_value_us) &&
- (now.abs_value_us <
- pk->withdraw_valid_until.abs_value_us) )
+ (GNUNET_TIME_timestamp_cmp (now,
+ >=,
+ pk->valid_from)) &&
+ (GNUNET_TIME_timestamp_cmp (now,
+ <,
+ pk->withdraw_valid_until)) )
return pk;
}
/* do 2nd pass to check if expiration times are to blame for
@@ -445,19 +448,21 @@ TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys,
pk = &keys->denom_keys[i];
if ( (0 == TALER_amount_cmp (amount,
&pk->value)) &&
- ( (now.abs_value_us < pk->valid_from.abs_value_us) ||
- (now.abs_value_us >
- pk->withdraw_valid_until.abs_value_us) ) )
+ (GNUNET_TIME_timestamp_cmp (now,
+ <,
+ pk->valid_from) ||
+ GNUNET_TIME_timestamp_cmp (now,
+ >,
+ pk->withdraw_valid_until) ) )
{
GNUNET_log
(GNUNET_ERROR_TYPE_WARNING,
"Have denomination key for `%s', but with wrong"
" expiration range %llu vs [%llu,%llu)\n",
str,
- (unsigned long long) now.abs_value_us,
- (unsigned long long) pk->valid_from.abs_value_us,
- (unsigned long long)
- pk->withdraw_valid_until.abs_value_us);
+ (unsigned long long) now.abs_time.abs_value_us,
+ (unsigned long long) pk->valid_from.abs_time.abs_value_us,
+ (unsigned long long) pk->withdraw_valid_until.abs_time.abs_value_us);
GNUNET_free (str);
return NULL;
}