summaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-aggregator.c21
-rw-r--r--src/exchange/taler-exchange-closer.c22
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c56
-rw-r--r--src/exchange/taler-exchange-httpd_deposits_get.c14
-rw-r--r--src/exchange/taler-exchange-httpd_keys.c227
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-check.c11
-rw-r--r--src/exchange/taler-exchange-httpd_management_auditors.c12
-rw-r--r--src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c12
-rw-r--r--src/exchange/taler-exchange-httpd_management_wire_disable.c12
-rw-r--r--src/exchange/taler-exchange-httpd_management_wire_enable.c12
-rw-r--r--src/exchange/taler-exchange-httpd_management_wire_fees.c14
-rw-r--r--src/exchange/taler-exchange-httpd_melt.c21
-rw-r--r--src/exchange/taler-exchange-httpd_recoup.c31
-rw-r--r--src/exchange/taler-exchange-httpd_refreshes_reveal.c16
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c61
-rw-r--r--src/exchange/taler-exchange-httpd_responses.h2
-rw-r--r--src/exchange/taler-exchange-httpd_transfers_get.c17
-rw-r--r--src/exchange/taler-exchange-httpd_wire.c12
-rw-r--r--src/exchange/taler-exchange-httpd_withdraw.c33
-rw-r--r--src/exchange/taler-exchange-transfer.c9
20 files changed, 296 insertions, 319 deletions
diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c
index 73bbcc594..32b069f90 100644
--- a/src/exchange/taler-exchange-aggregator.c
+++ b/src/exchange/taler-exchange-aggregator.c
@@ -71,7 +71,7 @@ struct AggregationUnit
* The current time (which triggered the aggregation and
* defines the wire fee).
*/
- struct GNUNET_TIME_Absolute execution_time;
+ struct GNUNET_TIME_Timestamp execution_time;
/**
* Wire details of the merchant.
@@ -116,7 +116,7 @@ struct Shard
/**
* When did we start processing the shard?
*/
- struct GNUNET_TIME_Absolute start_time;
+ struct GNUNET_TIME_Timestamp start_time;
/**
* Starting row of the shard.
@@ -445,12 +445,11 @@ deposit_cb (void *cls,
}
/* make sure we have current fees */
- au->execution_time = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&au->execution_time);
+ au->execution_time = GNUNET_TIME_timestamp_get ();
{
struct TALER_Amount closing_fee;
- struct GNUNET_TIME_Absolute start_date;
- struct GNUNET_TIME_Absolute end_date;
+ struct GNUNET_TIME_Timestamp start_date;
+ struct GNUNET_TIME_Timestamp end_date;
struct TALER_MasterSignatureP master_sig;
enum GNUNET_DB_QueryStatus qs;
@@ -467,7 +466,7 @@ deposit_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not get wire fees for %s at %s. Aborting run.\n",
au->wa->method,
- GNUNET_STRINGS_absolute_time_to_string (au->execution_time));
+ GNUNET_TIME_timestamp2s (au->execution_time));
return GNUNET_DB_STATUS_HARD_ERROR;
}
}
@@ -738,7 +737,7 @@ run_aggregation (void *cls)
{
uint64_t counter = s->work_counter;
struct GNUNET_TIME_Relative duration
- = GNUNET_TIME_absolute_get_duration (s->start_time);
+ = GNUNET_TIME_absolute_get_duration (s->start_time.abs_time);
cleanup_au (&au_active);
db_plugin->rollback (db_plugin->cls);
@@ -746,8 +745,8 @@ run_aggregation (void *cls)
"Completed shard [%u,%u] after %s with %llu deposits\n",
(unsigned int) s->shard_start,
(unsigned int) s->shard_end,
- GNUNET_STRINGS_relative_time_to_string (duration,
- GNUNET_YES),
+ GNUNET_TIME_relative2s (duration,
+ true),
(unsigned long long) counter);
release_shard (s);
if ( (GNUNET_YES == test_mode) &&
@@ -1009,7 +1008,7 @@ run_shard (void *cls)
return;
}
s = GNUNET_new (struct Shard);
- s->start_time = GNUNET_TIME_absolute_get ();
+ s->start_time = GNUNET_TIME_timestamp_get ();
qs = db_plugin->begin_revolving_shard (db_plugin->cls,
"aggregator",
shard_size,
diff --git a/src/exchange/taler-exchange-closer.c b/src/exchange/taler-exchange-closer.c
index 3f30db7ba..3847e05b2 100644
--- a/src/exchange/taler-exchange-closer.c
+++ b/src/exchange/taler-exchange-closer.c
@@ -211,9 +211,9 @@ expired_reserve_cb (void *cls,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_Amount *left,
const char *account_payto_uri,
- struct GNUNET_TIME_Absolute expiration_date)
+ struct GNUNET_TIME_Timestamp expiration_date)
{
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
struct TALER_WireTransferIdentifierRawP wtid;
struct TALER_Amount amount_without_fee;
struct TALER_Amount closing_fee;
@@ -226,9 +226,8 @@ expired_reserve_cb (void *cls,
fetch this: */
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Processing reserve closure at %s\n",
- GNUNET_STRINGS_absolute_time_to_string (expiration_date));
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ GNUNET_TIME_timestamp2s (expiration_date));
+ now = GNUNET_TIME_timestamp_get ();
/* lookup account we should use */
wa = TALER_EXCHANGEDB_find_account_by_payto_uri (account_payto_uri);
@@ -246,8 +245,8 @@ expired_reserve_cb (void *cls,
(we may be lagging behind!) */
{
struct TALER_Amount wire_fee;
- struct GNUNET_TIME_Absolute start_date;
- struct GNUNET_TIME_Absolute end_date;
+ struct GNUNET_TIME_Timestamp start_date;
+ struct GNUNET_TIME_Timestamp end_date;
struct TALER_MasterSignatureP master_sig;
enum GNUNET_DB_QueryStatus qs;
@@ -264,7 +263,7 @@ expired_reserve_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not get wire fees for %s at %s. Aborting run.\n",
wa->method,
- GNUNET_STRINGS_absolute_time_to_string (expiration_date));
+ GNUNET_TIME_timestamp2s (expiration_date));
return GNUNET_DB_STATUS_HARD_ERROR;
}
}
@@ -382,7 +381,7 @@ static void
run_reserve_closures (void *cls)
{
enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
(void) cls;
task = NULL;
@@ -406,11 +405,10 @@ run_reserve_closures (void *cls)
GNUNET_SCHEDULER_shutdown ();
return;
}
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Checking for reserves to close by date %s\n",
- GNUNET_STRINGS_absolute_time_to_string (now));
+ GNUNET_TIME_timestamp2s (now));
qs = db_plugin->get_expired_reserves (db_plugin->cls,
now,
&expired_reserve_cb,
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c
index 43acad44b..11094d11c 100644
--- a/src/exchange/taler-exchange-httpd_deposit.c
+++ b/src/exchange/taler-exchange-httpd_deposit.c
@@ -60,9 +60,9 @@ reply_deposit_success (struct MHD_Connection *connection,
const struct TALER_MerchantWireHash *h_wire,
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_PrivateContractHash *h_contract_terms,
- struct GNUNET_TIME_Absolute exchange_timestamp,
- struct GNUNET_TIME_Absolute refund_deadline,
- struct GNUNET_TIME_Absolute wire_deadline,
+ struct GNUNET_TIME_Timestamp exchange_timestamp,
+ struct GNUNET_TIME_Timestamp refund_deadline,
+ struct GNUNET_TIME_Timestamp wire_deadline,
const struct TALER_MerchantPublicKeyP *merchant,
const struct TALER_Amount *amount_without_fee)
{
@@ -73,9 +73,9 @@ reply_deposit_success (struct MHD_Connection *connection,
.purpose.size = htonl (sizeof (dc)),
.h_contract_terms = *h_contract_terms,
.h_wire = *h_wire,
- .exchange_timestamp = GNUNET_TIME_absolute_hton (exchange_timestamp),
- .refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline),
- .wire_deadline = GNUNET_TIME_absolute_hton (wire_deadline),
+ .exchange_timestamp = GNUNET_TIME_timestamp_hton (exchange_timestamp),
+ .refund_deadline = GNUNET_TIME_timestamp_hton (refund_deadline),
+ .wire_deadline = GNUNET_TIME_timestamp_hton (wire_deadline),
.coin_pub = *coin_pub,
.merchant_pub = *merchant
};
@@ -97,8 +97,8 @@ reply_deposit_success (struct MHD_Connection *connection,
return TALER_MHD_REPLY_JSON_PACK (
connection,
MHD_HTTP_OK,
- GNUNET_JSON_pack_time_abs ("exchange_timestamp",
- exchange_timestamp),
+ GNUNET_JSON_pack_timestamp ("exchange_timestamp",
+ exchange_timestamp),
GNUNET_JSON_pack_data_auto ("exchange_sig",
&sig),
GNUNET_JSON_pack_data_auto ("exchange_pub",
@@ -119,7 +119,7 @@ struct DepositContext
/**
* Our timestamp (when we received the request).
*/
- struct GNUNET_TIME_Absolute exchange_timestamp;
+ struct GNUNET_TIME_Timestamp exchange_timestamp;
/**
* Calculated hash over the wire details.
@@ -281,13 +281,13 @@ TEH_handler_deposit (struct MHD_Connection *connection,
&deposit.h_contract_terms),
GNUNET_JSON_spec_fixed_auto ("coin_sig",
&deposit.csig),
- TALER_JSON_spec_absolute_time ("timestamp",
- &deposit.timestamp),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &deposit.timestamp),
GNUNET_JSON_spec_mark_optional (
- TALER_JSON_spec_absolute_time ("refund_deadline",
- &deposit.refund_deadline)),
- TALER_JSON_spec_absolute_time ("wire_transfer_deadline",
- &deposit.wire_deadline),
+ GNUNET_JSON_spec_timestamp ("refund_deadline",
+ &deposit.refund_deadline)),
+ GNUNET_JSON_spec_timestamp ("wire_transfer_deadline",
+ &deposit.wire_deadline),
GNUNET_JSON_spec_end ()
};
@@ -332,7 +332,9 @@ TEH_handler_deposit (struct MHD_Connection *connection,
}
}
deposit.receiver_wire_account = (char *) dc.payto_uri;
- if (deposit.refund_deadline.abs_value_us > deposit.wire_deadline.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (deposit.refund_deadline,
+ >,
+ deposit.wire_deadline))
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
@@ -347,8 +349,7 @@ TEH_handler_deposit (struct MHD_Connection *connection,
dc.deposit = &deposit;
/* new deposit */
- dc.exchange_timestamp = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&dc.exchange_timestamp);
+ dc.exchange_timestamp = GNUNET_TIME_timestamp_get ();
/* check denomination exists and is valid */
{
struct TEH_DenominationKey *dk;
@@ -362,13 +363,12 @@ TEH_handler_deposit (struct MHD_Connection *connection,
GNUNET_JSON_parse_free (spec);
return mret;
}
- if (GNUNET_TIME_absolute_is_past (dk->meta.expire_deposit))
+ if (GNUNET_TIME_absolute_is_past (dk->meta.expire_deposit.abs_time))
{
/* This denomination is past the expiration time for deposits */
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
@@ -377,13 +377,12 @@ TEH_handler_deposit (struct MHD_Connection *connection,
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_EXPIRED,
"DEPOSIT");
}
- if (GNUNET_TIME_absolute_is_future (dk->meta.start))
+ if (GNUNET_TIME_absolute_is_future (dk->meta.start.abs_time))
{
/* This denomination is not yet valid */
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
@@ -394,10 +393,9 @@ TEH_handler_deposit (struct MHD_Connection *connection,
}
if (dk->recoup_possible)
{
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
/* This denomination has been revoked */
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_expired_denom_pub_hash (
diff --git a/src/exchange/taler-exchange-httpd_deposits_get.c b/src/exchange/taler-exchange-httpd_deposits_get.c
index 3db177015..9a33f2b71 100644
--- a/src/exchange/taler-exchange-httpd_deposits_get.c
+++ b/src/exchange/taler-exchange-httpd_deposits_get.c
@@ -52,7 +52,7 @@ reply_deposit_details (struct MHD_Connection *connection,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *coin_contribution,
const struct TALER_WireTransferIdentifierRawP *wtid,
- struct GNUNET_TIME_Absolute exec_time)
+ struct GNUNET_TIME_Timestamp exec_time)
{
struct TALER_ExchangePublicKeyP pub;
struct TALER_ExchangeSignatureP sig;
@@ -63,7 +63,7 @@ reply_deposit_details (struct MHD_Connection *connection,
.h_contract_terms = *h_contract_terms,
.wtid = *wtid,
.coin_pub = *coin_pub,
- .execution_time = GNUNET_TIME_absolute_hton (exec_time)
+ .execution_time = GNUNET_TIME_timestamp_hton (exec_time)
};
enum TALER_ErrorCode ec;
@@ -83,8 +83,8 @@ reply_deposit_details (struct MHD_Connection *connection,
MHD_HTTP_OK,
GNUNET_JSON_pack_data_auto ("wtid",
wtid),
- GNUNET_JSON_pack_time_abs ("execution_time",
- exec_time),
+ GNUNET_JSON_pack_timestamp ("execution_time",
+ exec_time),
TALER_JSON_pack_amount ("coin_contribution",
coin_contribution),
GNUNET_JSON_pack_data_auto ("exchange_sig",
@@ -128,7 +128,7 @@ struct DepositWtidContext
/**
* Set by #handle_wtid data to the wire transfer execution time.
*/
- struct GNUNET_TIME_Absolute execution_time;
+ struct GNUNET_TIME_Timestamp execution_time;
/**
* Set by #handle_wtid to the coin contribution to the transaction
@@ -264,8 +264,8 @@ handle_track_transaction_request (
ctx.kyc.payment_target_uuid),
GNUNET_JSON_pack_bool ("kyc_ok",
ctx.kyc.ok),
- GNUNET_JSON_pack_time_abs ("execution_time",
- ctx.execution_time));
+ GNUNET_JSON_pack_timestamp ("execution_time",
+ ctx.execution_time));
return reply_deposit_details (connection,
&tps->h_contract_terms,
&tps->h_wire,
diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c
index 29d964c6b..231a2715b 100644
--- a/src/exchange/taler-exchange-httpd_keys.c
+++ b/src/exchange/taler-exchange-httpd_keys.c
@@ -57,7 +57,7 @@
* #TALER_PROTOCOL_CURRENT and #TALER_PROTOCOL_AGE in
* exchange_api_handle.c!
*/
-#define EXCHANGE_PROTOCOL_VERSION "10:0:0"
+#define EXCHANGE_PROTOCOL_VERSION "11:0:0"
/**
@@ -69,7 +69,7 @@ struct HelperDenomination
/**
* When will the helper start to use this key for signing?
*/
- struct GNUNET_TIME_Absolute start_time;
+ struct GNUNET_TIME_Timestamp start_time;
/**
* For how long will the helper allow signing? 0 if
@@ -150,7 +150,7 @@ struct HelperSignkey
/**
* When will the helper start to use this key for signing?
*/
- struct GNUNET_TIME_Absolute start_time;
+ struct GNUNET_TIME_Timestamp start_time;
/**
* For how long will the helper allow signing? 0 if
@@ -234,7 +234,7 @@ struct KeysResponseData
* The client's request must include this date or a higher one
* for this response to be applicable.
*/
- struct GNUNET_TIME_Absolute cherry_pick_date;
+ struct GNUNET_TIME_Timestamp cherry_pick_date;
};
@@ -319,7 +319,7 @@ struct TEH_KeyStateHandle
/**
* When did we initiate the key reloading?
*/
- struct GNUNET_TIME_Absolute reload_time;
+ struct GNUNET_TIME_Timestamp reload_time;
/**
* What is the period at which we rotate keys
@@ -331,7 +331,7 @@ struct TEH_KeyStateHandle
* When does our online signing key expire and we
* thus need to re-generate this response?
*/
- struct GNUNET_TIME_Absolute signature_expires;
+ struct GNUNET_TIME_Timestamp signature_expires;
/**
* True if #finish_keys_response() was not yet run and this key state
@@ -808,7 +808,7 @@ static void
helper_rsa_cb (
void *cls,
const char *section_name,
- struct GNUNET_TIME_Absolute start_time,
+ struct GNUNET_TIME_Timestamp start_time,
struct GNUNET_TIME_Relative validity_duration,
const struct TALER_RsaPubHashP *h_rsa,
const struct TALER_DenominationPublicKey *denom_pub,
@@ -885,7 +885,7 @@ helper_rsa_cb (
static void
helper_esign_cb (
void *cls,
- struct GNUNET_TIME_Absolute start_time,
+ struct GNUNET_TIME_Timestamp start_time,
struct GNUNET_TIME_Relative validity_duration,
const struct TALER_ExchangePublicKeyP *exchange_pub,
const struct TALER_SecurityModulePublicKeyP *sm_pub,
@@ -1173,10 +1173,10 @@ denomination_info_cb (
struct TEH_DenominationKey *dk;
GNUNET_assert (TALER_DENOMINATION_INVALID != denom_pub->cipher);
- if ( (0 == meta->start.abs_value_us) ||
- (0 == meta->expire_withdraw.abs_value_us) ||
- (0 == meta->expire_deposit.abs_value_us) ||
- (0 == meta->expire_legal.abs_value_us) )
+ if (GNUNET_TIME_absolute_is_zero (meta->start.abs_time) ||
+ GNUNET_TIME_absolute_is_zero (meta->expire_withdraw.abs_time) ||
+ GNUNET_TIME_absolute_is_zero (meta->expire_deposit.abs_time) ||
+ GNUNET_TIME_absolute_is_zero (meta->expire_legal.abs_time) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Database contains invalid denomination key %s\n",
@@ -1400,25 +1400,25 @@ add_sign_key_cb (void *cls,
struct SigningKey *sk = value;
(void) pid;
- if (GNUNET_TIME_absolute_is_future (sk->meta.expire_sign))
+ if (GNUNET_TIME_absolute_is_future (sk->meta.expire_sign.abs_time))
{
ctx->min_sk_frequency =
GNUNET_TIME_relative_min (ctx->min_sk_frequency,
GNUNET_TIME_absolute_get_difference (
- sk->meta.start,
- sk->meta.expire_sign));
+ sk->meta.start.abs_time,
+ sk->meta.expire_sign.abs_time));
}
GNUNET_assert (
0 ==
json_array_append_new (
ctx->signkeys,
GNUNET_JSON_PACK (
- GNUNET_JSON_pack_time_abs ("stamp_start",
- sk->meta.start),
- GNUNET_JSON_pack_time_abs ("stamp_expire",
- sk->meta.expire_sign),
- GNUNET_JSON_pack_time_abs ("stamp_end",
- sk->meta.expire_legal),
+ GNUNET_JSON_pack_timestamp ("stamp_start",
+ sk->meta.start),
+ GNUNET_JSON_pack_timestamp ("stamp_expire",
+ sk->meta.expire_sign),
+ GNUNET_JSON_pack_timestamp ("stamp_end",
+ sk->meta.expire_legal),
GNUNET_JSON_pack_data_auto ("master_sig",
&sk->master_sig),
GNUNET_JSON_pack_data_auto ("key",
@@ -1481,17 +1481,17 @@ add_denom_key_cb (void *cls,
}
else
{
- if (GNUNET_TIME_absolute_is_future (dk->meta.start))
+ if (GNUNET_TIME_absolute_is_future (dk->meta.start.abs_time))
{
dkc->min_dk_frequency =
GNUNET_TIME_relative_min (dkc->min_dk_frequency,
GNUNET_TIME_absolute_get_difference (
- dk->meta.start,
- dk->meta.expire_withdraw));
+ dk->meta.start.abs_time,
+ dk->meta.expire_withdraw.abs_time));
}
(void) GNUNET_CONTAINER_heap_insert (dkc->heap,
dk,
- dk->meta.start.abs_value_us);
+ dk->meta.start.abs_time.abs_value_us);
}
return GNUNET_OK;
}
@@ -1567,7 +1567,7 @@ setup_general_response_headers (struct TEH_KeyStateHandle *ksh,
MHD_add_response_header (response,
MHD_HTTP_HEADER_CONTENT_TYPE,
"application/json"));
- get_date_string (ksh->reload_time,
+ get_date_string (ksh->reload_time.abs_time,
dat);
GNUNET_break (MHD_YES ==
MHD_add_response_header (response,
@@ -1576,12 +1576,14 @@ setup_general_response_headers (struct TEH_KeyStateHandle *ksh,
if (! GNUNET_TIME_relative_is_zero (ksh->rekey_frequency))
{
struct GNUNET_TIME_Relative r;
- struct GNUNET_TIME_Absolute m;
+ struct GNUNET_TIME_Absolute a;
+ struct GNUNET_TIME_Timestamp m;
r = GNUNET_TIME_relative_min (TEH_max_keys_caching,
ksh->rekey_frequency);
- m = GNUNET_TIME_relative_to_absolute (r);
- get_date_string (m,
+ a = GNUNET_TIME_relative_to_absolute (r);
+ m = GNUNET_TIME_absolute_to_timestamp (a);
+ get_date_string (m.abs_time,
dat);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Setting /keys 'Expires' header to '%s'\n",
@@ -1591,8 +1593,8 @@ setup_general_response_headers (struct TEH_KeyStateHandle *ksh,
MHD_HTTP_HEADER_EXPIRES,
dat));
ksh->signature_expires
- = GNUNET_TIME_absolute_min (m,
- ksh->signature_expires);
+ = GNUNET_TIME_timestamp_min (m,
+ ksh->signature_expires);
}
return GNUNET_OK;
}
@@ -1613,7 +1615,7 @@ setup_general_response_headers (struct TEH_KeyStateHandle *ksh,
static enum GNUNET_GenericReturnValue
create_krd (struct TEH_KeyStateHandle *ksh,
const struct GNUNET_HashCode *denom_keys_hash,
- struct GNUNET_TIME_Absolute last_cpd,
+ struct GNUNET_TIME_Timestamp last_cpd,
json_t *signkeys,
json_t *recoup,
json_t *denoms)
@@ -1623,7 +1625,7 @@ create_krd (struct TEH_KeyStateHandle *ksh,
struct TALER_ExchangeSignatureP exchange_sig;
json_t *keys;
- GNUNET_assert (0 != last_cpd.abs_value_us);
+ GNUNET_assert (! GNUNET_TIME_absolute_is_zero (last_cpd.abs_time));
GNUNET_assert (NULL != signkeys);
GNUNET_assert (NULL != recoup);
GNUNET_assert (NULL != denoms);
@@ -1631,13 +1633,13 @@ create_krd (struct TEH_KeyStateHandle *ksh,
GNUNET_assert (NULL != TEH_currency);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Creating /keys at cherry pick date %s\n",
- GNUNET_STRINGS_absolute_time_to_string (last_cpd));
+ GNUNET_TIME_timestamp2s (last_cpd));
/* Sign hash over denomination keys */
{
struct TALER_ExchangeKeySetPS ks = {
.purpose.size = htonl (sizeof (ks)),
.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_KEY_SET),
- .list_issue_date = GNUNET_TIME_absolute_hton (last_cpd),
+ .list_issue_date = GNUNET_TIME_timestamp_hton (last_cpd),
.hc = *denom_keys_hash
};
enum TALER_ErrorCode ec;
@@ -1660,8 +1662,8 @@ create_krd (struct TEH_KeyStateHandle *ksh,
sk = GNUNET_CONTAINER_multipeermap_get (
ksh->signkey_map,
(const struct GNUNET_PeerIdentity *) &exchange_pub);
- ksh->signature_expires = GNUNET_TIME_absolute_min (sk->meta.expire_sign,
- ksh->signature_expires);
+ ksh->signature_expires = GNUNET_TIME_timestamp_min (sk->meta.expire_sign,
+ ksh->signature_expires);
}
keys = GNUNET_JSON_PACK (
@@ -1681,8 +1683,8 @@ create_krd (struct TEH_KeyStateHandle *ksh,
denoms),
GNUNET_JSON_pack_array_incref ("auditors",
ksh->auditors),
- GNUNET_JSON_pack_time_abs ("list_issue_date",
- last_cpd),
+ GNUNET_JSON_pack_timestamp ("list_issue_date",
+ last_cpd),
GNUNET_JSON_pack_data_auto ("eddsa_pub",
&exchange_pub),
GNUNET_JSON_pack_data_auto ("eddsa_sig",
@@ -1768,7 +1770,7 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
json_t *recoup;
struct SignKeyCtx sctx;
json_t *denoms;
- struct GNUNET_TIME_Absolute last_cpd;
+ struct GNUNET_TIME_Timestamp last_cpd;
struct GNUNET_CONTAINER_Heap *heap;
struct GNUNET_HashContext *hash_context;
@@ -1797,7 +1799,7 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
}
denoms = json_array ();
GNUNET_assert (NULL != denoms);
- last_cpd = GNUNET_TIME_UNIT_ZERO_ABS;
+ last_cpd = GNUNET_TIME_UNIT_ZERO_TS;
hash_context = GNUNET_CRYPTO_hash_context_start ();
{
struct TEH_DenominationKey *dk;
@@ -1805,8 +1807,10 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
/* heap = min heap, sorted by start time */
while (NULL != (dk = GNUNET_CONTAINER_heap_remove_root (heap)))
{
- if ( (last_cpd.abs_value_us != dk->meta.start.abs_value_us) &&
- (0 != last_cpd.abs_value_us) )
+ if (GNUNET_TIME_timestamp_cmp (last_cpd,
+ !=,
+ dk->meta.start) &&
+ (! GNUNET_TIME_absolute_is_zero (last_cpd.abs_time)) )
{
struct GNUNET_HashCode hc;
@@ -1823,7 +1827,7 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Failed to generate key response data for %s\n",
- GNUNET_STRINGS_absolute_time_to_string (last_cpd));
+ GNUNET_TIME_timestamp2s (last_cpd));
GNUNET_CRYPTO_hash_context_abort (hash_context);
/* drain heap before destroying it */
while (NULL != (dk = GNUNET_CONTAINER_heap_remove_root (heap)))
@@ -1846,14 +1850,14 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("master_sig",
&dk->master_sig),
- GNUNET_JSON_pack_time_abs ("stamp_start",
- dk->meta.start),
- GNUNET_JSON_pack_time_abs ("stamp_expire_withdraw",
- dk->meta.expire_withdraw),
- GNUNET_JSON_pack_time_abs ("stamp_expire_deposit",
- dk->meta.expire_deposit),
- GNUNET_JSON_pack_time_abs ("stamp_expire_legal",
- dk->meta.expire_legal),
+ GNUNET_JSON_pack_timestamp ("stamp_start",
+ dk->meta.start),
+ GNUNET_JSON_pack_timestamp ("stamp_expire_withdraw",
+ dk->meta.expire_withdraw),
+ GNUNET_JSON_pack_timestamp ("stamp_expire_deposit",
+ dk->meta.expire_deposit),
+ GNUNET_JSON_pack_timestamp ("stamp_expire_legal",
+ dk->meta.expire_legal),
TALER_JSON_pack_denom_pub ("denom_pub",
&dk->denom_pub),
TALER_JSON_pack_amount ("value",
@@ -1869,7 +1873,7 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
}
}
GNUNET_CONTAINER_heap_destroy (heap);
- if (0 != last_cpd.abs_value_us)
+ if (! GNUNET_TIME_absolute_is_zero (last_cpd.abs_time))
{
struct GNUNET_HashCode hc;
@@ -1885,7 +1889,7 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Failed to generate key response data for %s\n",
- GNUNET_STRINGS_absolute_time_to_string (last_cpd));
+ GNUNET_TIME_timestamp2s (last_cpd));
json_decref (denoms);
json_decref (sctx.signkeys);
json_decref (recoup);
@@ -1922,9 +1926,8 @@ build_key_state (struct HelperState *hs,
enum GNUNET_DB_QueryStatus qs;
ksh = GNUNET_new (struct TEH_KeyStateHandle);
- ksh->signature_expires = GNUNET_TIME_UNIT_FOREVER_ABS;
- ksh->reload_time = GNUNET_TIME_absolute_get ();
- GNUNET_TIME_round_abs (&ksh->reload_time);
+ ksh->signature_expires = GNUNET_TIME_UNIT_FOREVER_TS;
+ ksh->reload_time = GNUNET_TIME_timestamp_get ();
/* We must use the key_generation from when we STARTED the process! */
ksh->key_generation = key_generation;
if (NULL == hs)
@@ -2054,7 +2057,7 @@ get_key_state (bool management_only)
return ksh;
}
if ( (old_ksh->key_generation < key_generation) ||
- (GNUNET_TIME_absolute_is_past (old_ksh->signature_expires)) )
+ (GNUNET_TIME_absolute_is_past (old_ksh->signature_expires.abs_time)) )
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Rebuilding /keys, generation upgrade from %llu to %llu\n",
@@ -2298,7 +2301,7 @@ TEH_keys_exchange_revoke (const struct TALER_ExchangePublicKeyP *exchange_pub)
* Comparator used for a binary search by cherry_pick_date for @a key in the
* `struct KeysResponseData` array. See libc's qsort() and bsearch() functions.
*
- * @param key pointer to a `struct GNUNET_TIME_Absolute`
+ * @param key pointer to a `struct GNUNET_TIME_Timestamp`
* @param value pointer to a `struct KeysResponseData` array entry
* @return 0 if time matches, -1 if key is smaller, 1 if key is larger
*/
@@ -2306,12 +2309,16 @@ static int
krd_search_comparator (const void *key,
const void *value)
{
- const struct GNUNET_TIME_Absolute *kd = key;
+ const struct GNUNET_TIME_Timestamp *kd = key;
const struct KeysResponseData *krd = value;
- if (kd->abs_value_us > krd->cherry_pick_date.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (*kd,
+ >,
+ krd->cherry_pick_date))
return -1;
- if (kd->abs_value_us < krd->cherry_pick_date.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (*kd,
+ <,
+ krd->cherry_pick_date))
return 1;
return 0;
}
@@ -2321,7 +2328,7 @@ MHD_RESULT
TEH_keys_get_handler (struct TEH_RequestContext *rc,
const char *const args[])
{
- struct GNUNET_TIME_Absolute last_issue_date;
+ struct GNUNET_TIME_Timestamp last_issue_date;
(void) args;
{
@@ -2349,11 +2356,11 @@ TEH_keys_get_handler (struct TEH_RequestContext *rc,
be a problem, as giving back 'older' data than what the client asks for
(given that the client asks for data in the distant future) is not
problematic */
- last_issue_date = GNUNET_TIME_absolute_from_s (cherrypickn);
+ last_issue_date = GNUNET_TIME_timestamp_from_s (cherrypickn);
}
else
{
- last_issue_date.abs_value_us = 0LLU;
+ last_issue_date = GNUNET_TIME_UNIT_ZERO_TS;
}
}
@@ -2385,16 +2392,16 @@ TEH_keys_get_handler (struct TEH_RequestContext *rc,
&krd_search_comparator);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Filtering /keys by cherry pick date %s found entry %u/%u\n",
- GNUNET_STRINGS_absolute_time_to_string (last_issue_date),
+ GNUNET_TIME_timestamp2s (last_issue_date),
(unsigned int) (krd - ksh->krd_array),
ksh->krd_array_length);
if ( (NULL == krd) &&
(ksh->krd_array_length > 0) )
{
- if (0 != last_issue_date.abs_value_us)
+ if (! GNUNET_TIME_absolute_is_zero (last_issue_date.abs_time))
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Client provided invalid cherry picking timestamp %s, returning full response\n",
- GNUNET_STRINGS_absolute_time_to_string (last_issue_date));
+ GNUNET_TIME_timestamp2s (last_issue_date));
krd = &ksh->krd_array[ksh->krd_array_length - 1];
}
if (NULL == krd)
@@ -2430,7 +2437,7 @@ load_extension_data (const char *section_name,
struct GNUNET_TIME_Relative deposit_duration;
struct GNUNET_TIME_Relative legal_duration;
- GNUNET_assert (0 != meta->start.abs_value_us); /* caller bug */
+ GNUNET_assert (! GNUNET_TIME_absolute_is_zero (meta->start.abs_time)); /* caller bug */
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (TEH_cfg,
section_name,
@@ -2453,14 +2460,13 @@ load_extension_data (const char *section_name,
"DURATION_LEGAL");
return GNUNET_SYSERR;
}
- /* NOTE: this is a change from the 0.8 semantics of the configuration:
- before duration_spend was relative to 'start', not to 'expire_withdraw'.
- But doing it this way avoids the error case where previously
- duration_spend < duration_withdraw was not allowed. */
- meta->expire_deposit = GNUNET_TIME_absolute_add (meta->expire_withdraw,
- deposit_duration);
- meta->expire_legal = GNUNET_TIME_absolute_add (meta->expire_deposit,
- legal_duration);
+ meta->expire_deposit
+ = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (meta->expire_withdraw.abs_time,
+ deposit_duration));
+ meta->expire_legal = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (meta->expire_deposit.abs_time,
+ legal_duration));
if (GNUNET_OK !=
TALER_config_get_amount (TEH_cfg,
section_name,
@@ -2569,8 +2575,9 @@ TEH_keys_load_fees (const struct TALER_DenominationHash *h_denom_pub,
return GNUNET_NO;
}
meta->start = hd->start_time;
- meta->expire_withdraw = GNUNET_TIME_absolute_add (meta->start,
- hd->validity_duration);
+ meta->expire_withdraw = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (meta->start.abs_time,
+ hd->validity_duration));
ok = load_extension_data (hd->section_name,
meta);
if (GNUNET_OK == ok)
@@ -2611,10 +2618,13 @@ TEH_keys_get_timing (const struct TALER_ExchangePublicKeyP *exchange_pub,
hsk = GNUNET_CONTAINER_multipeermap_get (ksh->helpers->esign_keys,
&pid);
meta->start = hsk->start_time;
- meta->expire_sign = GNUNET_TIME_absolute_add (meta->start,
- hsk->validity_duration);
- meta->expire_legal = GNUNET_TIME_absolute_add (meta->expire_sign,
- signkey_legal_duration);
+
+ meta->expire_sign = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (meta->start.abs_time,
+ hsk->validity_duration));
+ meta->expire_legal = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (meta->expire_sign.abs_time,
+ signkey_legal_duration));
return GNUNET_OK;
}
@@ -2653,7 +2663,7 @@ struct FutureBuilderContext
* @param value a `struct HelperDenomination`
* @return #GNUNET_OK (continue to iterate)
*/
-static int
+static enum GNUNET_GenericReturnValue
add_future_denomkey_cb (void *cls,
const struct GNUNET_HashCode *h_denom_pub,
void *value)
@@ -2670,8 +2680,9 @@ add_future_denomkey_cb (void *cls,
if (GNUNET_TIME_relative_is_zero (hd->validity_duration))
return GNUNET_OK; /* this key already expired! */
meta.start = hd->start_time;
- meta.expire_withdraw = GNUNET_TIME_absolute_add (meta.start,
- hd->validity_duration);
+ meta.expire_withdraw = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (meta.start.abs_time,
+ hd->validity_duration));
if (GNUNET_OK !=
load_extension_data (hd->section_name,
&meta))
@@ -2686,14 +2697,14 @@ add_future_denomkey_cb (void *cls,
GNUNET_JSON_PACK (
TALER_JSON_pack_amount ("value",
&meta.value),
- GNUNET_JSON_pack_time_abs ("stamp_start",
- meta.start),
- GNUNET_JSON_pack_time_abs ("stamp_expire_withdraw",
- meta.expire_withdraw),
- GNUNET_JSON_pack_time_abs ("stamp_expire_deposit",
- meta.expire_deposit),
- GNUNET_JSON_pack_time_abs ("stamp_expire_legal",
- meta.expire_legal),
+ GNUNET_JSON_pack_timestamp ("stamp_start",
+ meta.start),
+ GNUNET_JSON_pack_timestamp ("stamp_expire_withdraw",
+ meta.expire_withdraw),
+ GNUNET_JSON_pack_timestamp ("stamp_expire_deposit",
+ meta.expire_deposit),
+ GNUNET_JSON_pack_timestamp ("stamp_expire_legal",
+ meta.expire_legal),
TALER_JSON_pack_denom_pub ("denom_pub",
&hd->denom_pub),
TALER_JSON_pack_amount ("fee_withdraw",
@@ -2723,7 +2734,7 @@ add_future_denomkey_cb (void *cls,
* @param value a `struct HelperDenomination`
* @return #GNUNET_OK (continue to iterate)
*/
-static int
+static enum GNUNET_GenericReturnValue
add_future_signkey_cb (void *cls,
const struct GNUNET_PeerIdentity *pid,
void *value)
@@ -2731,8 +2742,8 @@ add_future_signkey_cb (void *cls,
struct FutureBuilderContext *fbc = cls;
struct HelperSignkey *hsk = value;
struct SigningKey *sk;
- struct GNUNET_TIME_Absolute stamp_expire;
- struct GNUNET_TIME_Absolute legal_end;
+ struct GNUNET_TIME_Timestamp stamp_expire;
+ struct GNUNET_TIME_Timestamp legal_end;
sk = GNUNET_CONTAINER_multipeermap_get (fbc->ksh->signkey_map,
pid);
@@ -2740,22 +2751,24 @@ add_future_signkey_cb (void *cls,
return GNUNET_OK; /* skip: this key is already active */
if (GNUNET_TIME_relative_is_zero (hsk->validity_duration))
return GNUNET_OK; /* this key already expired! */
- stamp_expire = GNUNET_TIME_absolute_add (hsk->start_time,
- hsk->validity_duration);
- legal_end = GNUNET_TIME_absolute_add (stamp_expire,
- signkey_legal_duration);
+ stamp_expire = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (hsk->start_time.abs_time,
+ hsk->validity_duration));
+ legal_end = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (stamp_expire.abs_time,
+ signkey_legal_duration));
GNUNET_assert (0 ==
json_array_append_new (
fbc->signkeys,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("key",
&hsk->exchange_pub),
- GNUNET_JSON_pack_time_abs ("stamp_start",
- hsk->start_time),
- GNUNET_JSON_pack_time_abs ("stamp_expire",
- stamp_expire),
- GNUNET_JSON_pack_time_abs ("stamp_end",
- legal_end),
+ GNUNET_JSON_pack_timestamp ("stamp_start",
+ hsk->start_time),
+ GNUNET_JSON_pack_timestamp ("stamp_expire",
+ stamp_expire),
+ GNUNET_JSON_pack_timestamp ("stamp_end",
+ legal_end),
GNUNET_JSON_pack_data_auto ("signkey_secmod_sig",
&hsk->sm_sig))));
return GNUNET_OK;
diff --git a/src/exchange/taler-exchange-httpd_kyc-check.c b/src/exchange/taler-exchange-httpd_kyc-check.c
index 1edbbf2aa..7560d6262 100644
--- a/src/exchange/taler-exchange-httpd_kyc-check.c
+++ b/src/exchange/taler-exchange-httpd_kyc-check.c
@@ -236,7 +236,7 @@ TEH_handler_kyc_check (
struct KycPoller *kyp = rc->rh_ctx;
MHD_RESULT res;
enum GNUNET_GenericReturnValue ret;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
if (NULL == kyp)
{
@@ -347,8 +347,7 @@ TEH_handler_kyc_check (
rc);
}
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
ret = TEH_DB_run_transaction (rc->connection,
"kyc check",
TEH_MT_OTHER,
@@ -420,7 +419,7 @@ TEH_handler_kyc_check (
TALER_SIGNATURE_EXCHANGE_ACCOUNT_SETUP_SUCCESS),
.purpose.size = htonl (sizeof (as)),
.h_payto = kyp->h_payto,
- .timestamp = GNUNET_TIME_absolute_hton (now)
+ .timestamp = GNUNET_TIME_timestamp_hton (now)
};
enum TALER_ErrorCode ec;
@@ -440,8 +439,8 @@ TEH_handler_kyc_check (
&sig),
GNUNET_JSON_pack_data_auto ("exchange_pub",
&pub),
- GNUNET_JSON_pack_time_abs ("now",
- now));
+ GNUNET_JSON_pack_timestamp ("now",
+ now));
}
}
diff --git a/src/exchange/taler-exchange-httpd_management_auditors.c b/src/exchange/taler-exchange-httpd_management_auditors.c
index f9092c53b..6096cc98b 100644
--- a/src/exchange/taler-exchange-httpd_management_auditors.c
+++ b/src/exchange/taler-exchange-httpd_management_auditors.c
@@ -59,7 +59,7 @@ struct AddAuditorContext
/**
* Timestamp for checking against replay attacks.
*/
- struct GNUNET_TIME_Absolute validity_start;
+ struct GNUNET_TIME_Timestamp validity_start;
};
@@ -84,7 +84,7 @@ add_auditor (void *cls,
MHD_RESULT *mhd_ret)
{
struct AddAuditorContext *aac = cls;
- struct GNUNET_TIME_Absolute last_date;
+ struct GNUNET_TIME_Timestamp last_date;
enum GNUNET_DB_QueryStatus qs;
qs = TEH_plugin->lookup_auditor_timestamp (TEH_plugin->cls,
@@ -102,7 +102,9 @@ add_auditor (void *cls,
return qs;
}
if ( (0 < qs) &&
- (last_date.abs_value_us > aac->validity_start.abs_value_us) )
+ (GNUNET_TIME_timestamp_cmp (last_date,
+ >,
+ aac->validity_start) ) )
{
*mhd_ret = TALER_MHD_reply_with_error (
connection,
@@ -155,8 +157,8 @@ TEH_handler_management_auditors (
&aac.auditor_url),
GNUNET_JSON_spec_string ("auditor_name",
&aac.auditor_name),
- TALER_JSON_spec_absolute_time ("validity_start",
- &aac.validity_start),
+ GNUNET_JSON_spec_timestamp ("validity_start",
+ &aac.validity_start),
GNUNET_JSON_spec_end ()
};
MHD_RESULT res;
diff --git a/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c b/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c
index 8b31fb139..5ae0cbd07 100644
--- a/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c
+++ b/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c
@@ -50,7 +50,7 @@ struct DelAuditorContext
/**
* Timestamp for checking against replay attacks.
*/
- struct GNUNET_TIME_Absolute validity_end;
+ struct GNUNET_TIME_Timestamp validity_end;
};
@@ -75,7 +75,7 @@ del_auditor (void *cls,
MHD_RESULT *mhd_ret)
{
struct DelAuditorContext *dac = cls;
- struct GNUNET_TIME_Absolute last_date;
+ struct GNUNET_TIME_Timestamp last_date;
enum GNUNET_DB_QueryStatus qs;
qs = TEH_plugin->lookup_auditor_timestamp (TEH_plugin->cls,
@@ -92,7 +92,9 @@ del_auditor (void *cls,
"lookup auditor");
return qs;
}
- if (last_date.abs_value_us > dac->validity_end.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (last_date,
+ >,
+ dac->validity_end))
{
*mhd_ret = TALER_MHD_reply_with_error (
connection,
@@ -145,8 +147,8 @@ TEH_handler_management_auditors_AP_disable (
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("master_sig",
&master_sig),
- TALER_JSON_spec_absolute_time ("validity_end",
- &dac.validity_end),
+ GNUNET_JSON_spec_timestamp ("validity_end",
+ &dac.validity_end),
GNUNET_JSON_spec_end ()
};
MHD_RESULT res;
diff --git a/src/exchange/taler-exchange-httpd_management_wire_disable.c b/src/exchange/taler-exchange-httpd_management_wire_disable.c
index 2d37a7204..d776bc353 100644
--- a/src/exchange/taler-exchange-httpd_management_wire_disable.c
+++ b/src/exchange/taler-exchange-httpd_management_wire_disable.c
@@ -50,7 +50,7 @@ struct DelWireContext
/**
* Timestamp for checking against replay attacks.
*/
- struct GNUNET_TIME_Absolute validity_end;
+ struct GNUNET_TIME_Timestamp validity_end;
};
@@ -75,7 +75,7 @@ del_wire (void *cls,
MHD_RESULT *mhd_ret)
{
struct DelWireContext *awc = cls;
- struct GNUNET_TIME_Absolute last_date;
+ struct GNUNET_TIME_Timestamp last_date;
enum GNUNET_DB_QueryStatus qs;
qs = TEH_plugin->lookup_wire_timestamp (TEH_plugin->cls,
@@ -92,7 +92,9 @@ del_wire (void *cls,
"lookup wire");
return qs;
}
- if (last_date.abs_value_us > awc->validity_end.abs_value_us)
+ if (GNUNET_TIME_timestamp_cmp (last_date,
+ >,
+ awc->validity_end))
{
*mhd_ret = TALER_MHD_reply_with_error (
connection,
@@ -140,8 +142,8 @@ TEH_handler_management_post_wire_disable (
&awc.master_sig),
GNUNET_JSON_spec_string ("payto_uri",
&awc.payto_uri),
- TALER_JSON_spec_absolute_time ("validity_end",
- &awc.validity_end),
+ GNUNET_JSON_spec_timestamp ("validity_end",
+ &awc.validity_end),
GNUNET_JSON_spec_end ()
};
diff --git a/src/exchange/taler-exchange-httpd_management_wire_enable.c b/src/exchange/taler-exchange-httpd_management_wire_enable.c
index 165c5183d..56828eb5e 100644
--- a/src/exchange/taler-exchange-httpd_management_wire_enable.c
+++ b/src/exchange/taler-exchange-httpd_management_wire_enable.c
@@ -57,7 +57,7 @@ struct AddWireContext
/**
* Timestamp for checking against replay attacks.
*/
- struct GNUNET_TIME_Absolute validity_start;
+ struct GNUNET_TIME_Timestamp validity_start;
};
@@ -82,7 +82,7 @@ add_wire (void *cls,
MHD_RESULT *mhd_ret)
{
struct AddWireContext *awc = cls;
- struct GNUNET_TIME_Absolute last_date;
+ struct GNUNET_TIME_Timestamp last_date;
enum GNUNET_DB_QueryStatus qs;
qs = TEH_plugin->lookup_wire_timestamp (TEH_plugin->cls,
@@ -100,7 +100,9 @@ add_wire (void *cls,
return qs;
}
if ( (0 < qs) &&
- (last_date.abs_value_us > awc->validity_start.abs_value_us) )
+ (GNUNET_TIME_timestamp_cmp (last_date,
+ >,
+ awc->validity_start)) )
{
*mhd_ret = TALER_MHD_reply_with_error (
connection,
@@ -147,8 +149,8 @@ TEH_handler_management_post_wire (
&awc.master_sig_add),
GNUNET_JSON_spec_string ("payto_uri",
&awc.payto_uri),
- TALER_JSON_spec_absolute_time ("validity_start",
- &awc.validity_start),
+ GNUNET_JSON_spec_timestamp ("validity_start",
+ &awc.validity_start),
GNUNET_JSON_spec_end ()
};
diff --git a/src/exchange/taler-exchange-httpd_management_wire_fees.c b/src/exchange/taler-exchange-httpd_management_wire_fees.c
index 180149042..c14500e8d 100644
--- a/src/exchange/taler-exchange-httpd_management_wire_fees.c
+++ b/src/exchange/taler-exchange-httpd_management_wire_fees.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2020 Taler Systems SA
+ Copyright (C) 2020, 2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
@@ -50,12 +50,12 @@ struct AddFeeContext
/**
* Starting period.
*/
- struct GNUNET_TIME_Absolute start_time;
+ struct GNUNET_TIME_Timestamp start_time;
/**
* End of period.
*/
- struct GNUNET_TIME_Absolute end_time;
+ struct GNUNET_TIME_Timestamp end_time;
/**
* Wire fee amount.
@@ -171,10 +171,10 @@ TEH_handler_management_post_wire_fees (
&afc.master_sig),
GNUNET_JSON_spec_string ("wire_method",
&afc.wire_method),
- TALER_JSON_spec_absolute_time ("fee_start",
- &afc.start_time),
- TALER_JSON_spec_absolute_time ("fee_end",
- &afc.end_time),
+ GNUNET_JSON_spec_timestamp ("fee_start",
+ &afc.start_time),
+ GNUNET_JSON_spec_timestamp ("fee_end",
+ &afc.end_time),
TALER_JSON_spec_amount ("closing_fee",
TEH_currency,
&afc.closing_fee),
diff --git a/src/exchange/taler-exchange-httpd_melt.c b/src/exchange/taler-exchange-httpd_melt.c
index ab7bed295..e4b2af290 100644
--- a/src/exchange/taler-exchange-httpd_melt.c
+++ b/src/exchange/taler-exchange-httpd_melt.c
@@ -319,12 +319,11 @@ check_for_denomination_key (struct MHD_Connection *connection,
&mret);
if (NULL == dk)
return mret;
- if (GNUNET_TIME_absolute_is_past (dk->meta.expire_legal))
+ if (GNUNET_TIME_absolute_is_past (dk->meta.expire_legal.abs_time))
{
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
/* Way too late now, even zombies have expired */
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
@@ -333,12 +332,11 @@ check_for_denomination_key (struct MHD_Connection *connection,
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_EXPIRED,
"MELT");
}
- if (GNUNET_TIME_absolute_is_future (dk->meta.start))
+ if (GNUNET_TIME_absolute_is_future (dk->meta.start.abs_time))
{
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
/* This denomination is not yet valid */
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
@@ -347,7 +345,7 @@ check_for_denomination_key (struct MHD_Connection *connection,
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_VALIDITY_IN_FUTURE,
"MELT");
}
- if (GNUNET_TIME_absolute_is_past (dk->meta.expire_deposit))
+ if (GNUNET_TIME_absolute_is_past (dk->meta.expire_deposit.abs_time))
{
/* We are past deposit expiration time, but maybe this is a zombie? */
struct TALER_DenominationHash denom_hash;
@@ -371,10 +369,9 @@ check_for_denomination_key (struct MHD_Connection *connection,
}
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
/* We never saw this coin before, so _this_ justification is not OK */
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
diff --git a/src/exchange/taler-exchange-httpd_recoup.c b/src/exchange/taler-exchange-httpd_recoup.c
index c2cae0861..ec67efc26 100644
--- a/src/exchange/taler-exchange-httpd_recoup.c
+++ b/src/exchange/taler-exchange-httpd_recoup.c
@@ -92,7 +92,7 @@ struct RecoupContext
* Set by #recoup_transaction to the timestamp when the recoup
* was accepted.
*/
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
/**
* true if the client claims the coin originated from a refresh.
@@ -233,8 +233,7 @@ recoup_transaction (void *cls,
}
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
- pc->now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&pc->now);
+ pc->now = GNUNET_TIME_timestamp_get ();
/* add coin to list of wire transfers for recoup */
if (pc->refreshed)
@@ -307,45 +306,33 @@ verify_and_execute_recoup (
&mret);
if (NULL == dk)
return mret;
- if (GNUNET_TIME_absolute_is_past (dk->meta.expire_deposit))
+ if (GNUNET_TIME_absolute_is_past (dk->meta.expire_deposit.abs_time))
{
- struct GNUNET_TIME_Absolute now;
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
/* This denomination is past the expiration time for recoup */
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
&coin->denom_pub_hash,
- now,
+ GNUNET_TIME_timestamp_get (),
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_EXPIRED,
"RECOUP");
}
- if (GNUNET_TIME_absolute_is_future (dk->meta.start))
+ if (GNUNET_TIME_absolute_is_future (dk->meta.start.abs_time))
{
- struct GNUNET_TIME_Absolute now;
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
/* This denomination is not yet valid */
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
&coin->denom_pub_hash,
- now,
+ GNUNET_TIME_timestamp_get (),
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_VALIDITY_IN_FUTURE,
"RECOUP");
}
if (! dk->recoup_possible)
{
- struct GNUNET_TIME_Absolute now;
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
/* This denomination is not eligible for recoup */
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
&coin->denom_pub_hash,
- now,
+ GNUNET_TIME_timestamp_get (),
TALER_EC_EXCHANGE_RECOUP_NOT_ELIGIBLE,
"RECOUP");
}
@@ -530,6 +517,7 @@ TEH_handler_recoup (struct MHD_Connection *connection,
struct TALER_CoinPublicInfo coin;
union TALER_DenominationBlindingKeyP coin_bks;
struct TALER_CoinSpendSignatureP coin_sig;
+ struct TALER_Amount amount;
bool refreshed = false;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("denom_pub_hash",
@@ -540,6 +528,9 @@ TEH_handler_recoup (struct MHD_Connection *connection,
&coin_bks),
GNUNET_JSON_spec_fixed_auto ("coin_sig",
&coin_sig),
+ TALER_JSON_spec_amount ("amount",
+ TEH_currency,
+ &amount),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("refreshed",
&refreshed)),
diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
index 6c1766feb..36362a234 100644
--- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c
+++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
@@ -519,31 +519,23 @@ resolve_refreshes_reveal_denominations (struct MHD_Connection *connection,
if (NULL == dks[i])
return mret;
- if (GNUNET_TIME_absolute_is_past (dks[i]->meta.expire_withdraw))
+ if (GNUNET_TIME_absolute_is_past (dks[i]->meta.expire_withdraw.abs_time))
{
- struct GNUNET_TIME_Absolute now;
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
/* This denomination is past the expiration time for withdraws */
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
&dk_h[i],
- now,
+ GNUNET_TIME_timestamp_get (),
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_EXPIRED,
"REVEAL");
}
- if (GNUNET_TIME_absolute_is_future (dks[i]->meta.start))
+ if (GNUNET_TIME_absolute_is_future (dks[i]->meta.start.abs_time))
{
- struct GNUNET_TIME_Absolute now;
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
/* This denomination is not yet valid */
return TEH_RESPONSE_reply_expired_denom_pub_hash (
connection,
&dk_h[i],
- now,
+ GNUNET_TIME_timestamp_get (),
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_VALIDITY_IN_FUTURE,
"REVEAL");
}
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c
index cb1179d6d..8c24efc9d 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -96,11 +96,11 @@ TEH_RESPONSE_compile_transaction_history (
&deposit->amount_with_fee),
TALER_JSON_pack_amount ("deposit_fee",
&deposit->deposit_fee),
- GNUNET_JSON_pack_time_abs ("timestamp",
- deposit->timestamp),
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ deposit->timestamp),
GNUNET_JSON_pack_allow_null (
- GNUNET_JSON_pack_time_abs ("refund_deadline",
- deposit->refund_deadline)),
+ GNUNET_JSON_pack_timestamp ("refund_deadline",
+ deposit->refund_deadline)),
GNUNET_JSON_pack_data_auto ("merchant_pub",
&deposit->merchant_pub),
GNUNET_JSON_pack_data_auto ("h_contract_terms",
@@ -243,7 +243,7 @@ TEH_RESPONSE_compile_transaction_history (
.purpose.purpose = htonl (
TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH),
.purpose.size = htonl (sizeof (pc)),
- .timestamp = GNUNET_TIME_absolute_hton (pr->timestamp),
+ .timestamp = GNUNET_TIME_timestamp_hton (pr->timestamp),
.coin_pub = pr->coin.coin_pub,
.old_coin_pub = pr->old_coin_pub
};
@@ -278,8 +278,8 @@ TEH_RESPONSE_compile_transaction_history (
&epub),
GNUNET_JSON_pack_data_auto ("coin_pub",
&pr->coin.coin_pub),
- GNUNET_JSON_pack_time_abs ("timestamp",
- pr->timestamp))))
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ pr->timestamp))))
{
GNUNET_break (0);
json_decref (history);
@@ -296,7 +296,7 @@ TEH_RESPONSE_compile_transaction_history (
struct TALER_RecoupConfirmationPS pc = {
.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP),
.purpose.size = htonl (sizeof (pc)),
- .timestamp = GNUNET_TIME_absolute_hton (recoup->timestamp),
+ .timestamp = GNUNET_TIME_timestamp_hton (recoup->timestamp),
.coin_pub = *coin_pub,
.reserve_pub = recoup->reserve_pub
};
@@ -334,8 +334,8 @@ TEH_RESPONSE_compile_transaction_history (
&recoup->coin_blind),
GNUNET_JSON_pack_data_auto ("reserve_pub",
&recoup->reserve_pub),
- GNUNET_JSON_pack_time_abs ("timestamp",
- recoup->timestamp))))
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ recoup->timestamp))))
{
GNUNET_break (0);
json_decref (history);
@@ -353,7 +353,7 @@ TEH_RESPONSE_compile_transaction_history (
.purpose.purpose = htonl (
TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH),
.purpose.size = htonl (sizeof (pc)),
- .timestamp = GNUNET_TIME_absolute_hton (pr->timestamp),
+ .timestamp = GNUNET_TIME_timestamp_hton (pr->timestamp),
.coin_pub = *coin_pub,
.old_coin_pub = pr->old_coin_pub
};
@@ -394,8 +394,8 @@ TEH_RESPONSE_compile_transaction_history (
&pr->coin_sig),
GNUNET_JSON_pack_data_auto ("coin_blind",
&pr->coin_blind),
- GNUNET_JSON_pack_time_abs ("timestamp",
- pr->timestamp))))
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ pr->timestamp))))
{
GNUNET_break (0);
json_decref (history);
@@ -418,16 +418,15 @@ TEH_RESPONSE_reply_unknown_denom_pub_hash (
{
struct TALER_ExchangePublicKeyP epub;
struct TALER_ExchangeSignatureP esig;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
enum TALER_ErrorCode ec;
- now = GNUNET_TIME_absolute_get ();
- GNUNET_TIME_round_abs (&now);
+ now = GNUNET_TIME_timestamp_get ();
{
struct TALER_DenominationUnknownAffirmationPS dua = {
.purpose.size = htonl (sizeof (dua)),
.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_AFFIRM_DENOM_UNKNOWN),
- .timestamp = GNUNET_TIME_absolute_hton (now),
+ .timestamp = GNUNET_TIME_timestamp_hton (now),
.h_denom_pub = *dph,
};
@@ -447,8 +446,8 @@ TEH_RESPONSE_reply_unknown_denom_pub_hash (
connection,
MHD_HTTP_NOT_FOUND,
TALER_JSON_pack_ec (TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN),
- GNUNET_JSON_pack_time_abs ("timestamp",
- now),
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ now),
GNUNET_JSON_pack_data_auto ("exchange_pub",
&epub),
GNUNET_JSON_pack_data_auto ("exchange_sig",
@@ -462,7 +461,7 @@ MHD_RESULT
TEH_RESPONSE_reply_expired_denom_pub_hash (
struct MHD_Connection *connection,
const struct TALER_DenominationHash *dph,
- struct GNUNET_TIME_Absolute now,
+ struct GNUNET_TIME_Timestamp now,
enum TALER_ErrorCode ec,
const char *oper)
{
@@ -473,7 +472,7 @@ TEH_RESPONSE_reply_expired_denom_pub_hash (
.purpose.size = htonl (sizeof (dua)),
.purpose.purpose = htonl (
TALER_SIGNATURE_EXCHANGE_AFFIRM_DENOM_EXPIRED),
- .timestamp = GNUNET_TIME_absolute_hton (now),
+ .timestamp = GNUNET_TIME_timestamp_hton (now),
.h_denom_pub = *dph,
};
@@ -499,8 +498,8 @@ TEH_RESPONSE_reply_expired_denom_pub_hash (
TALER_JSON_pack_ec (ec),
GNUNET_JSON_pack_string ("oper",
oper),
- GNUNET_JSON_pack_time_abs ("timestamp",
- now),
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ now),
GNUNET_JSON_pack_data_auto ("exchange_pub",
&epub),
GNUNET_JSON_pack_data_auto ("exchange_sig",
@@ -607,8 +606,8 @@ TEH_RESPONSE_compile_reserve_history (
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("type",
"CREDIT"),
- GNUNET_JSON_pack_time_abs ("timestamp",
- bank->execution_date),
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ bank->execution_date),
GNUNET_JSON_pack_string ("sender_account_url",
bank->sender_account_details),
GNUNET_JSON_pack_uint64 ("wire_reference",
@@ -694,7 +693,7 @@ TEH_RESPONSE_compile_reserve_history (
struct TALER_RecoupConfirmationPS pc = {
.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP),
.purpose.size = htonl (sizeof (pc)),
- .timestamp = GNUNET_TIME_absolute_hton (recoup->timestamp),
+ .timestamp = GNUNET_TIME_timestamp_hton (recoup->timestamp),
.coin_pub = recoup->coin.coin_pub,
.reserve_pub = recoup->reserve_pub
};
@@ -722,8 +721,8 @@ TEH_RESPONSE_compile_reserve_history (
&pub),
GNUNET_JSON_pack_data_auto ("exchange_sig",
&sig),
- GNUNET_JSON_pack_time_abs ("timestamp",
- recoup->timestamp),
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ recoup->timestamp),
TALER_JSON_pack_amount ("amount",
&recoup->value),
GNUNET_JSON_pack_data_auto ("coin_pub",
@@ -765,7 +764,7 @@ TEH_RESPONSE_compile_reserve_history (
struct TALER_ReserveCloseConfirmationPS rcc = {
.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED),
.purpose.size = htonl (sizeof (rcc)),
- .timestamp = GNUNET_TIME_absolute_hton (closing->execution_date),
+ .timestamp = GNUNET_TIME_timestamp_hton (closing->execution_date),
.reserve_pub = pos->details.closing->reserve_pub,
.wtid = closing->wtid
};
@@ -800,8 +799,8 @@ TEH_RESPONSE_compile_reserve_history (
&pub),
GNUNET_JSON_pack_data_auto ("exchange_sig",
&sig),
- GNUNET_JSON_pack_time_abs ("timestamp",
- closing->execution_date),
+ GNUNET_JSON_pack_timestamp ("timestamp",
+ closing->execution_date),
TALER_JSON_pack_amount ("amount",
&value),
TALER_JSON_pack_amount ("closing_fee",
diff --git a/src/exchange/taler-exchange-httpd_responses.h b/src/exchange/taler-exchange-httpd_responses.h
index 09d566af8..15fc57a58 100644
--- a/src/exchange/taler-exchange-httpd_responses.h
+++ b/src/exchange/taler-exchange-httpd_responses.h
@@ -77,7 +77,7 @@ MHD_RESULT
TEH_RESPONSE_reply_expired_denom_pub_hash (
struct MHD_Connection *connection,
const struct TALER_DenominationHash *dph,
- struct GNUNET_TIME_Absolute now,
+ struct GNUNET_TIME_Timestamp now,
enum TALER_ErrorCode ec,
const char *oper);
diff --git a/src/exchange/taler-exchange-httpd_transfers_get.c b/src/exchange/taler-exchange-httpd_transfers_get.c
index 38a5c211d..7ca0da974 100644
--- a/src/exchange/taler-exchange-httpd_transfers_get.c
+++ b/src/exchange/taler-exchange-httpd_transfers_get.c
@@ -89,7 +89,7 @@ reply_transfer_details (struct MHD_Connection *connection,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *payto_uri,
const struct TALER_Amount *wire_fee,
- struct GNUNET_TIME_Absolute exec_time,
+ struct GNUNET_TIME_Timestamp exec_time,
const struct AggregatedDepositDetail *wdd_head)
{
json_t *deposits;
@@ -99,7 +99,6 @@ reply_transfer_details (struct MHD_Connection *connection,
struct TALER_ExchangePublicKeyP pub;
struct TALER_ExchangeSignatureP sig;
- GNUNET_TIME_round_abs (&exec_time);
deposits = json_array ();
GNUNET_assert (NULL != deposits);
hash_context = GNUNET_CRYPTO_hash_context_start ();
@@ -108,7 +107,7 @@ reply_transfer_details (struct MHD_Connection *connection,
wdd_pos = wdd_pos->next)
{
dd.h_contract_terms = wdd_pos->h_contract_terms;
- dd.execution_time = GNUNET_TIME_absolute_hton (exec_time);
+ dd.execution_time = GNUNET_TIME_timestamp_hton (exec_time);
dd.coin_pub = wdd_pos->coin_pub;
TALER_amount_hton (&dd.deposit_value,
&wdd_pos->deposit_value);
@@ -175,8 +174,8 @@ reply_transfer_details (struct MHD_Connection *connection,
merchant_pub),
GNUNET_JSON_pack_data_auto ("h_payto",
&wdp.h_payto),
- GNUNET_JSON_pack_time_abs ("execution_time",
- exec_time),
+ GNUNET_JSON_pack_timestamp ("execution_time",
+ exec_time),
GNUNET_JSON_pack_array_steal ("deposits",
deposits),
GNUNET_JSON_pack_data_auto ("exchange_sig",
@@ -219,7 +218,7 @@ struct WtidTransactionContext
/**
* Execution time of the wire transfer
*/
- struct GNUNET_TIME_Absolute exec_time;
+ struct GNUNET_TIME_Timestamp exec_time;
/**
* Head of DLL with deposit details for transfers GET response.
@@ -273,7 +272,7 @@ handle_deposit_data (void *cls,
uint64_t rowid,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *account_payto_uri,
- struct GNUNET_TIME_Absolute exec_time,
+ struct GNUNET_TIME_Timestamp exec_time,
const struct TALER_PrivateContractHash *h_contract_terms,
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
@@ -397,8 +396,8 @@ get_transfer_deposits (void *cls,
{
struct WtidTransactionContext *ctx = cls;
enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_TIME_Absolute wire_fee_start_date;
- struct GNUNET_TIME_Absolute wire_fee_end_date;
+ struct GNUNET_TIME_Timestamp wire_fee_start_date;
+ struct GNUNET_TIME_Timestamp wire_fee_end_date;
struct TALER_MasterSignatureP wire_fee_master_sig;
struct TALER_Amount closing_fee;
diff --git a/src/exchange/taler-exchange-httpd_wire.c b/src/exchange/taler-exchange-httpd_wire.c
index 802204e30..911100583 100644
--- a/src/exchange/taler-exchange-httpd_wire.c
+++ b/src/exchange/taler-exchange-httpd_wire.c
@@ -212,8 +212,8 @@ static void
add_wire_fee (void *cls,
const struct TALER_Amount *wire_fee,
const struct TALER_Amount *closing_fee,
- struct GNUNET_TIME_Absolute start_date,
- struct GNUNET_TIME_Absolute end_date,
+ struct GNUNET_TIME_Timestamp start_date,
+ struct GNUNET_TIME_Timestamp end_date,
const struct TALER_MasterSignatureP *master_sig)
{
json_t *a = cls;
@@ -226,10 +226,10 @@ add_wire_fee (void *cls,
wire_fee),
TALER_JSON_pack_amount ("closing_fee",
closing_fee),
- GNUNET_JSON_pack_time_abs ("start_date",
- start_date),
- GNUNET_JSON_pack_time_abs ("end_date",
- end_date),
+ GNUNET_JSON_pack_timestamp ("start_date",
+ start_date),
+ GNUNET_JSON_pack_timestamp ("end_date",
+ end_date),
GNUNET_JSON_pack_data_auto ("sig",
master_sig))))
{
diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c
index 9a45271bb..2c5cb4d75 100644
--- a/src/exchange/taler-exchange-httpd_withdraw.c
+++ b/src/exchange/taler-exchange-httpd_withdraw.c
@@ -141,11 +141,9 @@ withdraw_transaction (void *cls,
bool found = false;
bool balance_ok = false;
uint64_t reserve_uuid;
- struct GNUNET_TIME_Absolute now;
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
+ struct GNUNET_TIME_Timestamp now;
+ now = GNUNET_TIME_timestamp_get ();
wc->collectable.reserve_pub = wc->wsrd.reserve_pub;
wc->collectable.h_coin_envelope = wc->wsrd.h_coin_envelope;
qs = TEH_plugin->do_withdraw (TEH_plugin->cls,
@@ -237,7 +235,7 @@ withdraw_transaction (void *cls,
qs2 = TEH_plugin->do_withdraw_limit_check (
TEH_plugin->cls,
reserve_uuid,
- GNUNET_TIME_absolute_subtract (now,
+ GNUNET_TIME_absolute_subtract (now.abs_time,
TEH_kyc_config.withdraw_period),
&TEH_kyc_config.withdraw_limit,
&below_limit);
@@ -355,7 +353,6 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc,
}
{
MHD_RESULT mret;
- struct GNUNET_TIME_Absolute now;
struct TEH_KeyStateHandle *ksh;
ksh = TEH_keys_get_state ();
@@ -392,14 +389,8 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc,
GNUNET_JSON_parse_free (spec);
return mret;
}
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
- if (GNUNET_TIME_absolute_is_past (dk->meta.expire_withdraw))
+ if (GNUNET_TIME_absolute_is_past (dk->meta.expire_withdraw.abs_time))
{
- struct GNUNET_TIME_Absolute now;
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
/* This denomination is past the expiration time for withdraws */
if (! check_request_idempotent (rc,
&wc,
@@ -409,35 +400,27 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc,
return TEH_RESPONSE_reply_expired_denom_pub_hash (
rc->connection,
&wc.collectable.denom_pub_hash,
- now,
+ GNUNET_TIME_timestamp_get (),
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_EXPIRED,
"WITHDRAW");
}
GNUNET_JSON_parse_free (spec);
return mret;
}
- if (GNUNET_TIME_absolute_is_future (dk->meta.start))
+ if (GNUNET_TIME_absolute_is_future (dk->meta.start.abs_time))
{
- struct GNUNET_TIME_Absolute now;
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
/* This denomination is not yet valid, no need to check
for idempotency! */
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_expired_denom_pub_hash (
rc->connection,
&wc.collectable.denom_pub_hash,
- now,
+ GNUNET_TIME_timestamp_get (),
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_VALIDITY_IN_FUTURE,
"WITHDRAW");
}
if (dk->recoup_possible)
{
- struct GNUNET_TIME_Absolute now;
-
- now = GNUNET_TIME_absolute_get ();
- (void) GNUNET_TIME_round_abs (&now);
/* This denomination has been revoked */
if (! check_request_idempotent (rc,
&wc,
@@ -447,7 +430,7 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc,
return TEH_RESPONSE_reply_expired_denom_pub_hash (
rc->connection,
&wc.collectable.denom_pub_hash,
- now,
+ GNUNET_TIME_timestamp_get (),
TALER_EC_EXCHANGE_GENERIC_DENOMINATION_REVOKED,
"WITHDRAW");
}
diff --git a/src/exchange/taler-exchange-transfer.c b/src/exchange/taler-exchange-transfer.c
index c2ad59ae5..261b4006f 100644
--- a/src/exchange/taler-exchange-transfer.c
+++ b/src/exchange/taler-exchange-transfer.c
@@ -407,7 +407,7 @@ wire_confirm_cb (void *cls,
unsigned int http_status_code,
enum TALER_ErrorCode ec,
uint64_t row_id,
- struct GNUNET_TIME_Absolute wire_timestamp)
+ struct GNUNET_TIME_Timestamp wire_timestamp)
{
struct WirePrepareData *wpd = cls;
enum GNUNET_DB_QueryStatus qs;
@@ -642,7 +642,8 @@ run_transfers (void *cls)
/* normal case */
break;
}
- shard_delay = GNUNET_TIME_absolute_get_duration (shard->shard_start_time);
+ shard_delay = GNUNET_TIME_absolute_get_duration (
+ shard->shard_start_time);
GNUNET_free (shard);
GNUNET_assert (NULL == task);
task = GNUNET_SCHEDULER_add_now (&select_shard,
@@ -776,8 +777,8 @@ select_shard (void *cls)
GNUNET_assert (NULL == task);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Serialization failure, trying again in %s!\n",
- GNUNET_STRINGS_relative_time_to_string (serialization_delay,
- GNUNET_YES));
+ GNUNET_TIME_relative2s (serialization_delay,
+ true));
task = GNUNET_SCHEDULER_add_delayed (serialization_delay,
&select_shard,
NULL);