Compare commits

...

7 Commits

Author SHA1 Message Date
76c2b758a1
Merge branch 'master' into ar 2021-12-15 14:37:50 +01:00
Christian Grothoff
110fe5b640
-fix FTBFS 2021-12-15 11:38:57 +01:00
Christian Grothoff
fdfcb29027
-fix FTBFS 2021-12-15 11:36:36 +01:00
Christian Grothoff
8cb0b890d3
fix test_sq: 2021-12-15 10:28:52 +01:00
Christian Grothoff
f4e3d9f716
-die pthread.h 2021-12-14 17:01:52 +01:00
Christian Grothoff
4cd70bc0a7
fix shard delay calculation also for 'transfer' tool 2021-12-14 16:26:10 +01:00
Christian Grothoff
1a1fafbd43
introducing GNUNET_TIME_Timestamp, recoup now with amounts 2021-12-14 16:04:40 +01:00
118 changed files with 2321 additions and 3368 deletions

View File

@ -54,13 +54,12 @@ libauditorreport_la_LIBADD = \
taler_auditor_dbinit_SOURCES = \
taler-auditor-dbinit.c
taler_auditor_dbinit_LDADD = \
$(LIBGCRYPT_LIBS) \
$(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/pq/libtalerpq.la \
$(top_builddir)/src/auditordb/libtalerauditordb.la \
-lgnunetutil $(XLIB)
taler_auditor_dbinit_LDFLAGS = \
$(POSTGRESQL_LDFLAGS)
$(top_builddir)/src/pq/libtalerpq.la \
$(top_builddir)/src/util/libtalerutil.la \
-lgnunetutil \
$(LIBGCRYPT_LIBS) \
$(XLIB)
taler_auditor_dbinit_CPPFLAGS = \
-I$(top_srcdir)/src/include \
-I$(top_srcdir)/src/pq/ \
@ -182,8 +181,6 @@ taler_auditor_sync_LDADD = \
-lgnunetutil \
$(LIBGCRYPT_LIBS) \
$(XLIB)
taler_auditor_sync_LDFLAGS = \
$(POSTGRESQL_LDFLAGS)
taler_auditor_sync_CPPFLAGS = \
-I$(top_srcdir)/src/include \
-I$(top_srcdir)/src/pq/ \

View File

@ -160,12 +160,12 @@ add_denomination (
TALER_amount2s (&value));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Start time is %s\n",
GNUNET_STRINGS_absolute_time_to_string
(GNUNET_TIME_absolute_ntoh (issue->start)));
GNUNET_TIME_timestamp2s
(GNUNET_TIME_timestamp_ntoh (issue->start)));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Expire deposit time is %s\n",
GNUNET_STRINGS_absolute_time_to_string
(GNUNET_TIME_absolute_ntoh (issue->expire_deposit)));
GNUNET_TIME_timestamp2s
(GNUNET_TIME_timestamp_ntoh (issue->expire_deposit)));
}
#endif
{

View File

@ -63,21 +63,19 @@ verify_and_execute_deposit_confirmation (
const struct TALER_AUDITORDB_ExchangeSigningKey *es)
{
enum GNUNET_DB_QueryStatus qs;
struct GNUNET_TIME_Absolute now;
struct GNUNET_HashCode h;
const char *cached;
struct TALER_ExchangeSigningKeyValidityPS skv = {
.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY),
.purpose.size = htonl (sizeof (struct TALER_ExchangeSigningKeyValidityPS)),
.start = GNUNET_TIME_absolute_hton (es->ep_start),
.expire = GNUNET_TIME_absolute_hton (es->ep_expire),
.end = GNUNET_TIME_absolute_hton (es->ep_end),
.start = GNUNET_TIME_timestamp_hton (es->ep_start),
.expire = GNUNET_TIME_timestamp_hton (es->ep_expire),
.end = GNUNET_TIME_timestamp_hton (es->ep_end),
.signkey_pub = es->exchange_pub
};
now = GNUNET_TIME_absolute_get ();
if ( (es->ep_start.abs_value_us > now.abs_value_us) ||
(es->ep_expire.abs_value_us < now.abs_value_us) )
if (GNUNET_TIME_absolute_is_future (es->ep_start.abs_time) ||
GNUNET_TIME_absolute_is_past (es->ep_expire.abs_time) )
{
/* Signing key expired */
TALER_LOG_WARNING ("Expired exchange signing key\n");
@ -253,12 +251,12 @@ TAH_DEPOSIT_CONFIRMATION_handler (struct TAH_RequestHandler *rh,
&dc.h_extensions),
GNUNET_JSON_spec_fixed_auto ("h_wire",
&dc.h_wire),
TALER_JSON_spec_absolute_time ("exchange_timestamp",
&dc.exchange_timestamp),
TALER_JSON_spec_absolute_time ("refund_deadline",
&dc.refund_deadline),
TALER_JSON_spec_absolute_time ("wire_deadline",
&dc.wire_deadline),
GNUNET_JSON_spec_timestamp ("exchange_timestamp",
&dc.exchange_timestamp),
GNUNET_JSON_spec_timestamp ("refund_deadline",
&dc.refund_deadline),
GNUNET_JSON_spec_timestamp ("wire_deadline",
&dc.wire_deadline),
TALER_JSON_spec_amount ("amount_without_fee",
TAH_currency,
&dc.amount_without_fee),
@ -272,12 +270,12 @@ TAH_DEPOSIT_CONFIRMATION_handler (struct TAH_RequestHandler *rh,
&dc.exchange_pub),
GNUNET_JSON_spec_fixed_auto ("master_pub",
&es.master_public_key),
TALER_JSON_spec_absolute_time ("ep_start",
&es.ep_start),
TALER_JSON_spec_absolute_time ("ep_expire",
&es.ep_expire),
TALER_JSON_spec_absolute_time ("ep_end",
&es.ep_end),
GNUNET_JSON_spec_timestamp ("ep_start",
&es.ep_start),
GNUNET_JSON_spec_timestamp ("ep_expire",
&es.ep_expire),
GNUNET_JSON_spec_timestamp ("ep_end",
&es.ep_end),
GNUNET_JSON_spec_fixed_auto ("master_sig",
&es.master_sig),
GNUNET_JSON_spec_end ()

View File

@ -297,12 +297,12 @@ struct WireFeeInfo
/**
* When does the fee go into effect (inclusive).
*/
struct GNUNET_TIME_Absolute start_date;
struct GNUNET_TIME_Timestamp start_date;
/**
* When does the fee stop being in effect (exclusive).
*/
struct GNUNET_TIME_Absolute end_date;
struct GNUNET_TIME_Timestamp end_date;
/**
* How high is the wire fee.
@ -365,7 +365,7 @@ struct WireCheckContext
/**
* Execution time of the wire transfer.
*/
struct GNUNET_TIME_Absolute date;
struct GNUNET_TIME_Timestamp date;
/**
* Database transaction status.
@ -698,7 +698,7 @@ wire_transfer_information_cb (
uint64_t rowid,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *account_pay_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,
@ -849,7 +849,9 @@ wire_transfer_information_cb (
rowid,
"target of outgoing wire transfer do not match hash of wire from deposit");
}
if (exec_time.abs_value_us != wcc->date.abs_value_us)
if (GNUNET_TIME_timestamp_cmp (exec_time,
!=,
wcc->date) )
{
/* This should be impossible from database constraints */
GNUNET_break (0);
@ -881,7 +883,7 @@ wire_transfer_information_cb (
static const struct TALER_Amount *
get_wire_fee (struct AggregationContext *ac,
const char *method,
struct GNUNET_TIME_Absolute timestamp)
struct GNUNET_TIME_Timestamp timestamp)
{
struct WireFeeInfo *wfi;
struct WireFeeInfo *pos;
@ -890,10 +892,16 @@ get_wire_fee (struct AggregationContext *ac,
/* Check if fee is already loaded in cache */
for (pos = ac->fee_head; NULL != pos; pos = pos->next)
{
if ( (pos->start_date.abs_value_us <= timestamp.abs_value_us) &&
(pos->end_date.abs_value_us > timestamp.abs_value_us) )
if (GNUNET_TIME_timestamp_cmp (pos->start_date,
<=,
timestamp) &&
GNUNET_TIME_timestamp_cmp (pos->end_date,
>,
timestamp) )
return &pos->wire_fee;
if (pos->start_date.abs_value_us > timestamp.abs_value_us)
if (GNUNET_TIME_timestamp_cmp (pos->start_date,
>,
timestamp))
break;
}
@ -929,7 +937,7 @@ get_wire_fee (struct AggregationContext *ac,
&master_sig))
{
report_row_inconsistency ("wire-fee",
timestamp.abs_value_us,
timestamp.abs_time.abs_value_us,
"wire fee signature invalid at given time");
}
}
@ -938,7 +946,7 @@ get_wire_fee (struct AggregationContext *ac,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Wire fee is %s starting at %s\n",
TALER_amount2s (&wfi->wire_fee),
GNUNET_STRINGS_absolute_time_to_string (wfi->start_date));
GNUNET_TIME_timestamp2s (wfi->start_date));
if ( (NULL == pos) ||
(NULL == pos->prev) )
GNUNET_CONTAINER_DLL_insert (ac->fee_head,
@ -951,7 +959,9 @@ get_wire_fee (struct AggregationContext *ac,
wfi);
/* Check non-overlaping fee invariant */
if ( (NULL != wfi->prev) &&
(wfi->prev->end_date.abs_value_us > wfi->start_date.abs_value_us) )
GNUNET_TIME_timestamp_cmp (wfi->prev->end_date,
>,
wfi->start_date) )
{
TALER_ARL_report (report_fee_time_inconsistencies,
GNUNET_JSON_PACK (
@ -960,10 +970,12 @@ get_wire_fee (struct AggregationContext *ac,
GNUNET_JSON_pack_string ("diagnostic",
"start date before previous end date"),
TALER_JSON_pack_time_abs_human ("time",
wfi->start_date)));
wfi->start_date.abs_time)));
}
if ( (NULL != wfi->next) &&
(wfi->next->start_date.abs_value_us >= wfi->end_date.abs_value_us) )
GNUNET_TIME_timestamp_cmp (wfi->next->start_date,
>=,
wfi->end_date) )
{
TALER_ARL_report (report_fee_time_inconsistencies,
GNUNET_JSON_PACK (
@ -972,7 +984,7 @@ get_wire_fee (struct AggregationContext *ac,
GNUNET_JSON_pack_string ("diagnostic",
"end date date after next start date"),
TALER_JSON_pack_time_abs_human ("time",
wfi->end_date)));
wfi->end_date.abs_time)));
}
return &wfi->wire_fee;
}
@ -993,7 +1005,7 @@ get_wire_fee (struct AggregationContext *ac,
static enum GNUNET_GenericReturnValue
check_wire_out_cb (void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute date,
struct GNUNET_TIME_Timestamp date,
const struct TALER_WireTransferIdentifierRawP *wtid,
const char *payto_uri,
const struct TALER_Amount *amount)
@ -1013,7 +1025,7 @@ check_wire_out_cb (void *cls,
"Checking wire transfer %s over %s performed on %s\n",
TALER_B2S (wtid),
TALER_amount2s (amount),
GNUNET_STRINGS_absolute_time_to_string (date));
GNUNET_TIME_timestamp2s (date));
if (NULL == (method = TALER_payto_get_method (payto_uri)))
{
report_row_inconsistency ("wire_out",
@ -1062,7 +1074,7 @@ check_wire_out_cb (void *cls,
if (NULL == wire_fee)
{
report_row_inconsistency ("wire-fee",
date.abs_value_us,
date.abs_time.abs_value_us,
"wire fee unavailable for given time");
/* If fee is unknown, we just assume the fee is zero */
final_amount = wcc.total_deposits;

View File

@ -284,20 +284,21 @@ report_emergency_by_amount (
"Reporting emergency on denomination `%s' over loss of %s\n",
GNUNET_h2s (&issue->denom_hash.hash),
TALER_amount2s (loss));
TALER_ARL_report (report_emergencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("denompub_hash",
&issue->denom_hash),
TALER_JSON_pack_amount ("denom_risk",
risk),
TALER_JSON_pack_amount ("denom_loss",
loss),
TALER_JSON_pack_time_abs_nbo_human ("start",
issue->start),
TALER_JSON_pack_time_abs_nbo_human ("deposit_end",
issue->expire_deposit),
TALER_JSON_pack_amount_nbo ("value",
&issue->value)));
TALER_ARL_report (
report_emergencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("denompub_hash",
&issue->denom_hash),
TALER_JSON_pack_amount ("denom_risk",
risk),
TALER_JSON_pack_amount ("denom_loss",
loss),
TALER_JSON_pack_time_abs_nbo_human ("start",
issue->start.abs_time_nbo),
TALER_JSON_pack_time_abs_nbo_human ("deposit_end",
issue->expire_deposit.abs_time_nbo),
TALER_JSON_pack_amount_nbo ("value",
&issue->value)));
TALER_ARL_amount_add (&reported_emergency_risk_by_amount,
&reported_emergency_risk_by_amount,
risk);
@ -330,22 +331,23 @@ report_emergency_by_count (
{
struct TALER_Amount denom_value;
TALER_ARL_report (report_emergencies_by_count,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("denompub_hash",
&issue->denom_hash),
GNUNET_JSON_pack_uint64 ("num_issued",
num_issued),
GNUNET_JSON_pack_uint64 ("num_known",
num_known),
TALER_JSON_pack_amount ("denom_risk",
risk),
TALER_JSON_pack_time_abs_nbo_human ("start",
issue->start),
TALER_JSON_pack_time_abs_nbo_human ("deposit_end",
issue->expire_deposit),
TALER_JSON_pack_amount_nbo ("value",
&issue->value)));
TALER_ARL_report (
report_emergencies_by_count,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("denompub_hash",
&issue->denom_hash),
GNUNET_JSON_pack_uint64 ("num_issued",
num_issued),
GNUNET_JSON_pack_uint64 ("num_known",
num_known),
TALER_JSON_pack_amount ("denom_risk",
risk),
TALER_JSON_pack_time_abs_nbo_human ("start",
issue->start.abs_time_nbo),
TALER_JSON_pack_time_abs_nbo_human ("deposit_end",
issue->expire_deposit.abs_time_nbo),
TALER_JSON_pack_amount_nbo ("value",
&issue->value)));
TALER_ARL_amount_add (&reported_emergency_risk_by_count,
&reported_emergency_risk_by_count,
risk);
@ -794,7 +796,7 @@ get_denomination_summary (struct CoinContext *cc,
* @param value a `struct DenominationSummary`
* @return #GNUNET_OK (continue to iterate)
*/
static int
static enum GNUNET_GenericReturnValue
sync_denomination (void *cls,
const struct GNUNET_HashCode *denom_hash,
void *value)
@ -806,16 +808,18 @@ sync_denomination (void *cls,
struct DenominationSummary *ds = value;
const struct TALER_DenominationKeyValidityPS *issue = ds->issue;
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Absolute expire_deposit;
struct GNUNET_TIME_Timestamp expire_deposit;
struct GNUNET_TIME_Absolute expire_deposit_grace;
enum GNUNET_DB_QueryStatus qs;
now = GNUNET_TIME_absolute_get ();
expire_deposit = GNUNET_TIME_absolute_ntoh (issue->expire_deposit);
expire_deposit = GNUNET_TIME_timestamp_ntoh (issue->expire_deposit);
/* add day grace period to deal with clocks not being perfectly synchronized */
expire_deposit_grace = GNUNET_TIME_absolute_add (expire_deposit,
expire_deposit_grace = GNUNET_TIME_absolute_add (expire_deposit.abs_time,
DEPOSIT_GRACE_PERIOD);
if (now.abs_value_us > expire_deposit_grace.abs_value_us)
if (GNUNET_TIME_absolute_cmp (now,
>,
expire_deposit_grace) )
{
/* Denomination key has expired, book remaining balance of
outstanding coins as revenue; and reduce cc->risk exposure. */
@ -963,7 +967,7 @@ withdraw_cb (void *cls,
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_ReserveSignatureP *reserve_sig,
struct GNUNET_TIME_Absolute execution_date,
struct GNUNET_TIME_Timestamp execution_date,
const struct TALER_Amount *amount_with_fee)
{
struct CoinContext *cc = cls;
@ -1564,7 +1568,7 @@ refresh_session_cb (void *cls,
static enum GNUNET_GenericReturnValue
deposit_cb (void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute exchange_timestamp,
struct GNUNET_TIME_Timestamp exchange_timestamp,
const struct TALER_EXCHANGEDB_Deposit *deposit,
const struct TALER_DenominationPublicKey *denom_pub,
bool done)
@ -1591,8 +1595,9 @@ deposit_cb (void *cls,
return GNUNET_SYSERR;
return GNUNET_OK;
}
if (deposit->refund_deadline.abs_value_us >
deposit->wire_deadline.abs_value_us)
if (GNUNET_TIME_timestamp_cmp (deposit->refund_deadline,
>,
deposit->wire_deadline))
{
report_row_inconsistency ("deposits",
rowid,
@ -2071,7 +2076,7 @@ check_recoup (struct CoinContext *cc,
static int
recoup_cb (void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute timestamp,
struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_Amount *amount,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_CoinPublicInfo *coin,
@ -2115,7 +2120,7 @@ recoup_cb (void *cls,
static int
recoup_refresh_cb (void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute timestamp,
struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_Amount *amount,
const struct TALER_CoinSpendPublicKeyP *old_coin_pub,
const struct TALER_DenominationHash *old_denom_pub_hash,
@ -2211,8 +2216,8 @@ check_denomination (
struct TALER_Amount fee_deposit;
struct TALER_Amount fee_refresh;
struct TALER_Amount fee_refund;
struct GNUNET_TIME_Absolute start;
struct GNUNET_TIME_Absolute end;
struct GNUNET_TIME_Timestamp start;
struct GNUNET_TIME_Timestamp end;
(void) cls;
(void) denom_pub;
@ -2226,8 +2231,8 @@ check_denomination (
&issue->fee_refresh);
TALER_amount_ntoh (&fee_refund,
&issue->fee_refund);
start = GNUNET_TIME_absolute_ntoh (issue->start);
end = GNUNET_TIME_absolute_ntoh (issue->expire_legal);
start = GNUNET_TIME_timestamp_ntoh (issue->start);
end = GNUNET_TIME_timestamp_ntoh (issue->expire_legal);
qs = TALER_ARL_edb->select_auditor_denom_sig (TALER_ARL_edb->cls,
&issue->denom_hash,
&TALER_ARL_auditor_pub,
@ -2238,9 +2243,9 @@ check_denomination (
"Encountered denomination `%s' (%s) valid from %s (%llu-%llu) that this auditor is not auditing!\n",
GNUNET_h2s (&issue->denom_hash.hash),
TALER_amount2s (&coin_value),
GNUNET_STRINGS_absolute_time_to_string (start),
(unsigned long long) start.abs_value_us,
(unsigned long long) end.abs_value_us);
GNUNET_TIME_timestamp2s (start),
(unsigned long long) start.abs_time.abs_value_us,
(unsigned long long) end.abs_time.abs_value_us);
return; /* skip! */
}
if (GNUNET_OK !=
@ -2249,8 +2254,8 @@ check_denomination (
&issue->denom_hash,
&TALER_ARL_master_pub,
start,
GNUNET_TIME_absolute_ntoh (issue->expire_withdraw),
GNUNET_TIME_absolute_ntoh (issue->expire_deposit),
GNUNET_TIME_timestamp_ntoh (issue->expire_withdraw),
GNUNET_TIME_timestamp_ntoh (issue->expire_deposit),
end,
&coin_value,
&fee_withdraw,
@ -2267,9 +2272,9 @@ check_denomination (
TALER_JSON_pack_amount ("value",
&coin_value),
TALER_JSON_pack_time_abs_human ("start_time",
start),
start.abs_time),
TALER_JSON_pack_time_abs_human ("end_time",
end)));
end.abs_time)));
}
}

View File

@ -112,7 +112,7 @@ test_dc (void *cls,
dcc->last_seen_coin_serial = serial_id;
{
enum GNUNET_DB_QueryStatus qs;
struct GNUNET_TIME_Absolute exchange_timestamp;
struct GNUNET_TIME_Timestamp exchange_timestamp;
struct TALER_Amount deposit_fee;
qs = TALER_ARL_edb->have_deposit2 (TALER_ARL_edb->cls,
@ -140,16 +140,17 @@ test_dc (void *cls,
}
}
/* deposit confirmation missing! report! */
TALER_ARL_report (report_deposit_confirmation_inconsistencies,
GNUNET_JSON_PACK (
TALER_JSON_pack_time_abs_human ("timestamp",
dc->exchange_timestamp),
TALER_JSON_pack_amount ("amount",
&dc->amount_without_fee),
GNUNET_JSON_pack_uint64 ("rowid",
serial_id),
GNUNET_JSON_pack_data_auto ("account",
&dc->h_wire)));
TALER_ARL_report (
report_deposit_confirmation_inconsistencies,
GNUNET_JSON_PACK (
TALER_JSON_pack_time_abs_human ("timestamp",
dc->exchange_timestamp.abs_time),
TALER_JSON_pack_amount ("amount",
&dc->amount_without_fee),
GNUNET_JSON_pack_uint64 ("rowid",
serial_id),
GNUNET_JSON_pack_data_auto ("account",
&dc->h_wire)));
dcc->first_missed_coin_serial = GNUNET_MIN (dcc->first_missed_coin_serial,
serial_id);
dcc->missed_count++;

View File

@ -284,7 +284,7 @@ struct ReserveSummary
* Previous reserve expiration data, as remembered by the auditor.
* (updated on-the-fly in #handle_reserve_in()).
*/
struct GNUNET_TIME_Absolute a_expiration_date;
struct GNUNET_TIME_Timestamp a_expiration_date;
/**
* Which account did originally put money into the reserve?
@ -408,12 +408,12 @@ handle_reserve_in (void *cls,
const struct TALER_Amount *credit,
const char *sender_account_details,
uint64_t wire_reference,
struct GNUNET_TIME_Absolute execution_date)
struct GNUNET_TIME_Timestamp execution_date)
{
struct ReserveContext *rc = cls;
struct GNUNET_HashCode key;
struct ReserveSummary *rs;
struct GNUNET_TIME_Absolute expiry;
struct GNUNET_TIME_Timestamp expiry;
enum GNUNET_DB_QueryStatus qs;
(void) wire_reference;
@ -463,10 +463,11 @@ handle_reserve_in (void *cls,
"Additional incoming wire transfer for reserve `%s' of %s\n",
TALER_B2S (reserve_pub),
TALER_amount2s (credit));
expiry = GNUNET_TIME_absolute_add (execution_date,
idle_reserve_expiration_time);
rs->a_expiration_date = GNUNET_TIME_absolute_max (rs->a_expiration_date,
expiry);
expiry = GNUNET_TIME_absolute_to_timestamp (
GNUNET_TIME_absolute_add (execution_date.abs_time,
idle_reserve_expiration_time));
rs->a_expiration_date = GNUNET_TIME_timestamp_max (rs->a_expiration_date,
expiry);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
@ -494,7 +495,7 @@ handle_reserve_out (void *cls,
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_ReserveSignatureP *reserve_sig,
struct GNUNET_TIME_Absolute execution_date,
struct GNUNET_TIME_Timestamp execution_date,
const struct TALER_Amount *amount_with_fee)
{
struct ReserveContext *rc = cls;
@ -504,8 +505,8 @@ handle_reserve_out (void *cls,
struct TALER_Amount withdraw_fee;
struct TALER_Amount auditor_value;
struct TALER_Amount auditor_amount_with_fee;
struct GNUNET_TIME_Absolute valid_start;
struct GNUNET_TIME_Absolute expire_withdraw;
struct GNUNET_TIME_Timestamp valid_start;
struct GNUNET_TIME_Timestamp expire_withdraw;
enum GNUNET_DB_QueryStatus qs;
struct TALER_WithdrawRequestPS wsrd = {
.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW),
@ -545,22 +546,26 @@ handle_reserve_out (void *cls,
}
/* check that execution date is within withdraw range for denom_pub */
valid_start = GNUNET_TIME_absolute_ntoh (issue->start);
expire_withdraw = GNUNET_TIME_absolute_ntoh (issue->expire_withdraw);
valid_start = GNUNET_TIME_timestamp_ntoh (issue->start);
expire_withdraw = GNUNET_TIME_timestamp_ntoh (issue->expire_withdraw);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Checking withdraw timing: %llu, expire: %llu, timing: %llu\n",
(unsigned long long) valid_start.abs_value_us,
(unsigned long long) expire_withdraw.abs_value_us,
(unsigned long long) execution_date.abs_value_us);
if ( (valid_start.abs_value_us > execution_date.abs_value_us) ||
(expire_withdraw.abs_value_us < execution_date.abs_value_us) )
(unsigned long long) valid_start.abs_time.abs_value_us,
(unsigned long long) expire_withdraw.abs_time.abs_value_us,
(unsigned long long) execution_date.abs_time.abs_value_us);
if (GNUNET_TIME_timestamp_cmp (valid_start,
>,
execution_date) ||
GNUNET_TIME_timestamp_cmp (expire_withdraw,
<,
execution_date))
{
TALER_ARL_report (denomination_key_validity_withdraw_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rowid),
TALER_JSON_pack_time_abs_human ("execution_date",
execution_date),
execution_date.abs_time),
GNUNET_JSON_pack_data_auto ("reserve_pub",
reserve_pub),
GNUNET_JSON_pack_data_auto ("denompub_h",
@ -683,7 +688,7 @@ static int
handle_recoup_by_reserve (
void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute timestamp,
struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_Amount *amount,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_CoinPublicInfo *coin,
@ -694,7 +699,7 @@ handle_recoup_by_reserve (
struct ReserveContext *rc = cls;
struct GNUNET_HashCode key;
struct ReserveSummary *rs;
struct GNUNET_TIME_Absolute expiry;
struct GNUNET_TIME_Timestamp expiry;
struct TALER_MasterSignatureP msig;
uint64_t rev_rowid;
enum GNUNET_DB_QueryStatus qs;
@ -845,10 +850,11 @@ handle_recoup_by_reserve (
"Additional /recoup value to for reserve `%s' of %s\n",
TALER_B2S (reserve_pub),
TALER_amount2s (amount));
expiry = GNUNET_TIME_absolute_add (timestamp,
idle_reserve_expiration_time);
rs->a_expiration_date = GNUNET_TIME_absolute_max (rs->a_expiration_date,
expiry);
expiry = GNUNET_TIME_absolute_to_timestamp (
GNUNET_TIME_absolute_add (timestamp.abs_time,
idle_reserve_expiration_time));
rs->a_expiration_date = GNUNET_TIME_timestamp_max (rs->a_expiration_date,
expiry);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
@ -864,14 +870,14 @@ handle_recoup_by_reserve (
* @param[out] fee set to the closing fee
* @return #GNUNET_OK on success
*/
static int
static enum GNUNET_GenericReturnValue
get_closing_fee (const char *receiver_account,
struct GNUNET_TIME_Absolute atime,
struct GNUNET_TIME_Timestamp atime,
struct TALER_Amount *fee)
{
struct TALER_MasterSignatureP master_sig;
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_Amount wire_fee;
char *method;
@ -894,9 +900,9 @@ get_closing_fee (const char *receiver_account,
GNUNET_asprintf (&diag,
"closing fee for `%s' unavailable at %s\n",
method,
GNUNET_STRINGS_absolute_time_to_string (atime));
GNUNET_TIME_timestamp2s (atime));
report_row_inconsistency ("closing-fee",
atime.abs_value_us,
atime.abs_time.abs_value_us,
diag);
GNUNET_free (diag);
GNUNET_free (method);
@ -925,7 +931,7 @@ static int
handle_reserve_closed (
void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute execution_date,
struct GNUNET_TIME_Timestamp execution_date,
const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_ReservePublicKeyP *reserve_pub,
@ -1155,8 +1161,10 @@ verify_reserve_balance (void *cls,
/* Check that reserve is being closed if it is past its expiration date
(and the closing fee would not exceed the remaining balance) */
if (CLOSING_GRACE_PERIOD.rel_value_us <
GNUNET_TIME_absolute_get_duration (rs->a_expiration_date).rel_value_us)
if (GNUNET_TIME_relative_cmp (CLOSING_GRACE_PERIOD,
<,
GNUNET_TIME_absolute_get_duration (
rs->a_expiration_date.abs_time)))
{
/* Reserve is expired */
struct TALER_Amount cfee;
@ -1183,7 +1191,7 @@ verify_reserve_balance (void *cls,
TALER_JSON_pack_amount ("balance",
&nbalance),
TALER_JSON_pack_time_abs_human ("expiration_time",
rs->a_expiration_date)));
rs->a_expiration_date.abs_time)));
}
}
else
@ -1192,16 +1200,17 @@ verify_reserve_balance (void *cls,
TALER_ARL_amount_add (&total_balance_reserve_not_closed,
&total_balance_reserve_not_closed,
&nbalance);
TALER_ARL_report (report_reserve_not_closed_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("reserve_pub",
&rs->reserve_pub),
TALER_JSON_pack_amount ("balance",
&nbalance),
TALER_JSON_pack_time_abs_human ("expiration_time",
rs->a_expiration_date),
GNUNET_JSON_pack_string ("diagnostic",
"could not determine closing fee")));
TALER_ARL_report (
report_reserve_not_closed_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("reserve_pub",
&rs->reserve_pub),
TALER_JSON_pack_amount ("balance",
&nbalance),
TALER_JSON_pack_time_abs_human ("expiration_time",
rs->a_expiration_date.abs_time),
GNUNET_JSON_pack_string ("diagnostic",
"could not determine closing fee")));
}
}

View File

@ -122,7 +122,7 @@ struct ReserveClosure
/**
* When was the reserve closed?
*/
struct GNUNET_TIME_Absolute execution_date;
struct GNUNET_TIME_Timestamp execution_date;
/**
* Amount transferred (amount remaining minus fee).
@ -500,9 +500,9 @@ do_shutdown (void *cls)
GNUNET_JSON_pack_uint64 ("end_pp_reserve_close_uuid",
pp.last_reserve_close_uuid),
TALER_JSON_pack_time_abs_human ("start_pp_last_timestamp",
start_pp.last_timestamp),
start_pp.last_timestamp.abs_time),
TALER_JSON_pack_time_abs_human ("end_pp_last_timestamp",
pp.last_timestamp),
pp.last_timestamp.abs_time),
GNUNET_JSON_pack_array_steal ("account_progress",
report_account_progress)));
report_wire_out_inconsistencies = NULL;
@ -599,18 +599,19 @@ check_pending_rc (void *cls,
&rc->amount);
if ( (0 != rc->amount.value) ||
(0 != rc->amount.fraction) )
TALER_ARL_report (report_closure_lags,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rc->rowid),
TALER_JSON_pack_amount ("amount",
&rc->amount),
TALER_JSON_pack_time_abs_human ("deadline",
rc->execution_date),
GNUNET_JSON_pack_data_auto ("wtid",
&rc->wtid),
GNUNET_JSON_pack_string ("account",
rc->receiver_account)));
TALER_ARL_report (
report_closure_lags,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rc->rowid),
TALER_JSON_pack_amount ("amount",
&rc->amount),
TALER_JSON_pack_time_abs_human ("deadline",
rc->execution_date.abs_time),
GNUNET_JSON_pack_data_auto ("wtid",
&rc->wtid),
GNUNET_JSON_pack_string ("account",
rc->receiver_account)));
pp.last_reserve_close_uuid
= GNUNET_MIN (pp.last_reserve_close_uuid,
rc->rowid);
@ -731,7 +732,7 @@ commit (enum GNUNET_DB_QueryStatus qs)
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Concluded audit step at %s\n",
GNUNET_STRINGS_absolute_time_to_string (pp.last_timestamp));
GNUNET_TIME_timestamp2s (pp.last_timestamp));
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
{
@ -788,7 +789,7 @@ wire_missing_cb (void *cls,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *amount,
const char *payto_uri,
struct GNUNET_TIME_Absolute deadline,
struct GNUNET_TIME_Timestamp deadline,
bool tiny,
bool done)
{
@ -821,7 +822,7 @@ wire_missing_cb (void *cls,
TALER_JSON_pack_amount ("amount",
amount),
TALER_JSON_pack_time_abs_human ("deadline",
deadline),
deadline.abs_time),
GNUNET_JSON_pack_data_auto ("coin_pub",
coin_pub),
GNUNET_JSON_pack_string ("account",
@ -846,18 +847,17 @@ wire_missing_cb (void *cls,
static void
check_for_required_transfers (void)
{
struct GNUNET_TIME_Absolute next_timestamp;
struct GNUNET_TIME_Timestamp next_timestamp;
enum GNUNET_DB_QueryStatus qs;
next_timestamp = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&next_timestamp);
/* Subtract #GRACE_PERIOD, so we can be a bit behind in processing
without immediately raising undue concern */
next_timestamp = GNUNET_TIME_absolute_subtract (next_timestamp,
GRACE_PERIOD);
next_timestamp = GNUNET_TIME_absolute_to_timestamp (
GNUNET_TIME_absolute_subtract (GNUNET_TIME_absolute_get (),
GRACE_PERIOD));
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Analyzing exchange's unfinished deposits (deadline: %s)\n",
GNUNET_STRINGS_absolute_time_to_string (next_timestamp));
GNUNET_TIME_timestamp2s (next_timestamp));
qs = TALER_ARL_edb->select_deposits_missing_wire (TALER_ARL_edb->cls,
pp.last_timestamp,
next_timestamp,
@ -903,25 +903,27 @@ conclude_wire_out (void)
static void
check_time_difference (const char *table,
uint64_t rowid,
struct GNUNET_TIME_Absolute want,
struct GNUNET_TIME_Absolute have)
struct GNUNET_TIME_Timestamp want,
struct GNUNET_TIME_Timestamp have)
{
struct GNUNET_TIME_Relative delta;
char *details;
if (have.abs_value_us > want.abs_value_us)
delta = GNUNET_TIME_absolute_get_difference (want,
have);
if (GNUNET_TIME_timestamp_cmp (have, >, want))
delta = GNUNET_TIME_absolute_get_difference (want.abs_time,
have.abs_time);
else
delta = GNUNET_TIME_absolute_get_difference (have,
want);
if (delta.rel_value_us <= TIME_TOLERANCE.rel_value_us)
delta = GNUNET_TIME_absolute_get_difference (have.abs_time,
want.abs_time);
if (GNUNET_TIME_relative_cmp (delta,
<=,
TIME_TOLERANCE))
return;
GNUNET_asprintf (&details,
"execution date mismatch (%s)",
GNUNET_STRINGS_relative_time_to_string (delta,
GNUNET_YES));
GNUNET_TIME_relative2s (delta,
true));
TALER_ARL_report (report_row_minor_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("table",
@ -949,7 +951,7 @@ check_time_difference (const char *table,
static enum GNUNET_GenericReturnValue
wire_out_cb (void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute date,
struct GNUNET_TIME_Timestamp date,
const struct TALER_WireTransferIdentifierRawP *wtid,
const char *payto_uri,
const struct TALER_Amount *amount)
@ -960,7 +962,7 @@ wire_out_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Exchange wire OUT at %s of %s with WTID %s\n",
GNUNET_STRINGS_absolute_time_to_string (date),
GNUNET_TIME_timestamp2s (date),
TALER_amount2s (amount),
TALER_B2S (wtid));
GNUNET_CRYPTO_hash (wtid,
@ -974,22 +976,23 @@ wire_out_cb (void *cls,
justified), so the entire amount is missing / still to be done.
This is moderately harmless, it might just be that the aggreator
has not yet fully caught up with the transfers it should do. */
TALER_ARL_report (report_wire_out_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rowid),
TALER_JSON_pack_amount ("amount_wired",
&zero),
TALER_JSON_pack_amount ("amount_justified",
amount),
GNUNET_JSON_pack_data_auto ("wtid",
wtid),
TALER_JSON_pack_time_abs_human ("timestamp",
date),
GNUNET_JSON_pack_string ("diagnostic",
"wire transfer not made (yet?)"),
GNUNET_JSON_pack_string ("account_section",
wa->ai->section_name)));
TALER_ARL_report (
report_wire_out_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rowid),
TALER_JSON_pack_amount ("amount_wired",
&zero),
TALER_JSON_pack_amount ("amount_justified",
amount),
GNUNET_JSON_pack_data_auto ("wtid",
wtid),
TALER_JSON_pack_time_abs_human ("timestamp",
date.abs_time),
GNUNET_JSON_pack_string ("diagnostic",
"wire transfer not made (yet?)"),
GNUNET_JSON_pack_string ("account_section",
wa->ai->section_name)));
TALER_ARL_amount_add (&total_bad_amount_out_minus,
&total_bad_amount_out_minus,
amount);
@ -1003,45 +1006,48 @@ wire_out_cb (void *cls,
/* Destination bank account is wrong in actual wire transfer, so
we should count the wire transfer as entirely spurious, and
additionally consider the justified wire transfer as missing. */
TALER_ARL_report (report_wire_out_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rowid),
TALER_JSON_pack_amount ("amount_wired",
&roi->details.amount),
TALER_JSON_pack_amount ("amount_justified",
&zero),
GNUNET_JSON_pack_data_auto ("wtid", wtid),
TALER_JSON_pack_time_abs_human ("timestamp",
date),
GNUNET_JSON_pack_string ("diagnostic",
"receiver account mismatch"),
GNUNET_JSON_pack_string ("target",
payto_uri),
GNUNET_JSON_pack_string ("account_section",
wa->ai->section_name)));
TALER_ARL_report (
report_wire_out_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rowid),
TALER_JSON_pack_amount ("amount_wired",
&roi->details.amount),
TALER_JSON_pack_amount ("amount_justified",
&zero),
GNUNET_JSON_pack_data_auto ("wtid",
wtid),
TALER_JSON_pack_time_abs_human ("timestamp",
date.abs_time),
GNUNET_JSON_pack_string ("diagnostic",
"receiver account mismatch"),
GNUNET_JSON_pack_string ("target",
payto_uri),
GNUNET_JSON_pack_string ("account_section",
wa->ai->section_name)));
TALER_ARL_amount_add (&total_bad_amount_out_plus,
&total_bad_amount_out_plus,
&roi->details.amount);
TALER_ARL_report (report_wire_out_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rowid),
TALER_JSON_pack_amount ("amount_wired",
&zero),
TALER_JSON_pack_amount ("amount_justified",
amount),
GNUNET_JSON_pack_data_auto ("wtid",
wtid),
TALER_JSON_pack_time_abs_human ("timestamp",
date),
GNUNET_JSON_pack_string ("diagnostic",
"receiver account mismatch"),
GNUNET_JSON_pack_string ("target",
roi->details.
credit_account_uri),
GNUNET_JSON_pack_string ("account_section",
wa->ai->section_name)));
TALER_ARL_report (
report_wire_out_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rowid),
TALER_JSON_pack_amount ("amount_wired",
&zero),
TALER_JSON_pack_amount ("amount_justified",
amount),
GNUNET_JSON_pack_data_auto ("wtid",
wtid),
TALER_JSON_pack_time_abs_human ("timestamp",
date.abs_time),
GNUNET_JSON_pack_string ("diagnostic",
"receiver account mismatch"),
GNUNET_JSON_pack_string ("target",
roi->details.
credit_account_uri),
GNUNET_JSON_pack_string ("account_section",
wa->ai->section_name)));
TALER_ARL_amount_add (&total_bad_amount_out_minus,
&total_bad_amount_out_minus,
amount);
@ -1050,22 +1056,23 @@ wire_out_cb (void *cls,
if (0 != TALER_amount_cmp (&roi->details.amount,
amount))
{
TALER_ARL_report (report_wire_out_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rowid),
TALER_JSON_pack_amount ("amount_justified",
amount),
TALER_JSON_pack_amount ("amount_wired",
&roi->details.amount),
GNUNET_JSON_pack_data_auto ("wtid",
wtid),
TALER_JSON_pack_time_abs_human ("timestamp",
date),
GNUNET_JSON_pack_string ("diagnostic",
"wire amount does not match"),
GNUNET_JSON_pack_string ("account_section",
wa->ai->section_name)));
TALER_ARL_report (
report_wire_out_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rowid),
TALER_JSON_pack_amount ("amount_justified",
amount),
TALER_JSON_pack_amount ("amount_wired",
&roi->details.amount),
GNUNET_JSON_pack_data_auto ("wtid",
wtid),
TALER_JSON_pack_time_abs_human ("timestamp",
date.abs_time),
GNUNET_JSON_pack_string ("diagnostic",
"wire amount does not match"),
GNUNET_JSON_pack_string ("account_section",
wa->ai->section_name)));
if (0 < TALER_amount_cmp (amount,
&roi->details.amount))
{
@ -1197,23 +1204,23 @@ complain_out_not_found (void *cls,
&ctx);
if (ctx.found)
return GNUNET_OK;
TALER_ARL_report (report_wire_out_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
0),
TALER_JSON_pack_amount ("amount_wired",
&roi->details.amount),
TALER_JSON_pack_amount ("amount_justified",
&zero),
GNUNET_JSON_pack_data_auto ("wtid",
&roi->details.wtid),
TALER_JSON_pack_time_abs_human ("timestamp",
roi->details.
execution_date),
GNUNET_JSON_pack_string ("account_section",
wa->ai->section_name),
GNUNET_JSON_pack_string ("diagnostic",
"justification for wire transfer not found")));
TALER_ARL_report (
report_wire_out_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
0),
TALER_JSON_pack_amount ("amount_wired",
&roi->details.amount),
TALER_JSON_pack_amount ("amount_justified",
&zero),
GNUNET_JSON_pack_data_auto ("wtid",
&roi->details.wtid),
TALER_JSON_pack_time_abs_human ("timestamp",
roi->details.execution_date.abs_time),
GNUNET_JSON_pack_string ("account_section",
wa->ai->section_name),
GNUNET_JSON_pack_string ("diagnostic",
"justification for wire transfer not found")));
TALER_ARL_amount_add (&total_bad_amount_out_plus,
&total_bad_amount_out_plus,
&roi->details.amount);
@ -1316,7 +1323,7 @@ history_debit_cb (void *cls,
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Analyzing bank DEBIT at %s of %s with WTID %s\n",
GNUNET_STRINGS_absolute_time_to_string (details->execution_date),
GNUNET_TIME_timestamp2s (details->execution_date),
TALER_amount2s (&details->amount),
TALER_B2S (&details->wtid));
/* Update offset */
@ -1459,7 +1466,7 @@ reserve_in_cb (void *cls,
const struct TALER_Amount *credit,
const char *sender_account_details,
uint64_t wire_reference,
struct GNUNET_TIME_Absolute execution_date)
struct GNUNET_TIME_Timestamp execution_date)
{
struct WireAccount *wa = cls;
struct ReserveInInfo *rii;
@ -1468,7 +1475,7 @@ reserve_in_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Analyzing exchange wire IN (%llu) at %s of %s with reserve_pub %s\n",
(unsigned long long) rowid,
GNUNET_STRINGS_absolute_time_to_string (execution_date),
GNUNET_TIME_timestamp2s (execution_date),
TALER_amount2s (credit),
TALER_B2S (reserve_pub));
slen = strlen (sender_account_details) + 1;
@ -1529,23 +1536,23 @@ complain_in_not_found (void *cls,
struct ReserveInInfo *rii = value;
(void) key;
TALER_ARL_report (report_reserve_in_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rii->rowid),
TALER_JSON_pack_amount ("amount_exchange_expected",
&rii->details.amount),
TALER_JSON_pack_amount ("amount_wired",
&zero),
GNUNET_JSON_pack_data_auto ("reserve_pub",
&rii->details.reserve_pub),
TALER_JSON_pack_time_abs_human ("timestamp",
rii->details.
execution_date),
GNUNET_JSON_pack_string ("account",
wa->ai->section_name),
GNUNET_JSON_pack_string ("diagnostic",
"incoming wire transfer claimed by exchange not found")));
TALER_ARL_report (
report_reserve_in_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rii->rowid),
TALER_JSON_pack_amount ("amount_exchange_expected",
&rii->details.amount),
TALER_JSON_pack_amount ("amount_wired",
&zero),
GNUNET_JSON_pack_data_auto ("reserve_pub",
&rii->details.reserve_pub),
TALER_JSON_pack_time_abs_human ("timestamp",
rii->details.execution_date.abs_time),
GNUNET_JSON_pack_string ("account",
wa->ai->section_name),
GNUNET_JSON_pack_string ("diagnostic",
"incoming wire transfer claimed by exchange not found")));
TALER_ARL_amount_add (&total_bad_amount_in_minus,
&total_bad_amount_in_minus,
&rii->details.amount);
@ -1620,7 +1627,7 @@ history_credit_cb (void *cls,
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Analyzing bank CREDIT at %s of %s with Reserve-pub %s\n",
GNUNET_STRINGS_absolute_time_to_string (details->execution_date),
GNUNET_TIME_timestamp2s (details->execution_date),
TALER_amount2s (&details->amount),
TALER_B2S (&details->reserve_pub));
GNUNET_CRYPTO_hash (&row_off,
@ -1632,8 +1639,7 @@ history_credit_cb (void *cls,
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Failed to find wire transfer at `%s' in exchange database. Audit ends at this point in time.\n",
GNUNET_STRINGS_absolute_time_to_string (
details->execution_date));
GNUNET_TIME_timestamp2s (details->execution_date));
wa->chh = NULL;
process_credits (wa->next);
return GNUNET_SYSERR; /* not an error, just end of processing */
@ -1645,42 +1651,43 @@ history_credit_cb (void *cls,
if (0 != GNUNET_memcmp (&details->reserve_pub,
&rii->details.reserve_pub))
{
TALER_ARL_report (report_reserve_in_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rii->rowid),
GNUNET_JSON_pack_uint64 ("bank_row",
row_off),
TALER_JSON_pack_amount ("amount_exchange_expected",
&rii->details.amount),
TALER_JSON_pack_amount ("amount_wired",
&zero),
GNUNET_JSON_pack_data_auto ("reserve_pub",
&rii->details.reserve_pub),
TALER_JSON_pack_time_abs_human ("timestamp",
rii->details.
execution_date),
GNUNET_JSON_pack_string ("diagnostic",
"wire subject does not match")));
TALER_ARL_report (
report_reserve_in_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rii->rowid),
GNUNET_JSON_pack_uint64 ("bank_row",
row_off),
TALER_JSON_pack_amount ("amount_exchange_expected",
&rii->details.amount),
TALER_JSON_pack_amount ("amount_wired",
&zero),
GNUNET_JSON_pack_data_auto ("reserve_pub",
&rii->details.reserve_pub),
TALER_JSON_pack_time_abs_human ("timestamp",
rii->details.execution_date.abs_time),
GNUNET_JSON_pack_string ("diagnostic",
"wire subject does not match")));
TALER_ARL_amount_add (&total_bad_amount_in_minus,
&total_bad_amount_in_minus,
&rii->details.amount);
TALER_ARL_report (report_reserve_in_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rii->rowid),
GNUNET_JSON_pack_uint64 ("bank_row",
row_off),
TALER_JSON_pack_amount ("amount_exchange_expected",
&zero),
TALER_JSON_pack_amount ("amount_wired",
&details->amount),
GNUNET_JSON_pack_data_auto ("reserve_pub",
&details->reserve_pub),
TALER_JSON_pack_time_abs_human ("timestamp",
details->execution_date),
GNUNET_JSON_pack_string ("diagnostic",
"wire subject does not match")));
TALER_ARL_report (
report_reserve_in_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rii->rowid),
GNUNET_JSON_pack_uint64 ("bank_row",
row_off),
TALER_JSON_pack_amount ("amount_exchange_expected",
&zero),
TALER_JSON_pack_amount ("amount_wired",
&details->amount),
GNUNET_JSON_pack_data_auto ("reserve_pub",
&details->reserve_pub),
TALER_JSON_pack_time_abs_human ("timestamp",
details->execution_date.abs_time),
GNUNET_JSON_pack_string ("diagnostic",
"wire subject does not match")));
TALER_ARL_amount_add (&total_bad_amount_in_plus,
&total_bad_amount_in_plus,
@ -1690,22 +1697,23 @@ history_credit_cb (void *cls,
if (0 != TALER_amount_cmp (&rii->details.amount,
&details->amount))
{
TALER_ARL_report (report_reserve_in_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rii->rowid),
GNUNET_JSON_pack_uint64 ("bank_row",
row_off),
TALER_JSON_pack_amount ("amount_exchange_expected",
&rii->details.amount),
TALER_JSON_pack_amount ("amount_wired",
&details->amount),
GNUNET_JSON_pack_data_auto ("reserve_pub",
&details->reserve_pub),
TALER_JSON_pack_time_abs_human ("timestamp",
details->execution_date),
GNUNET_JSON_pack_string ("diagnostic",
"wire amount does not match")));
TALER_ARL_report (
report_reserve_in_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row",
rii->rowid),
GNUNET_JSON_pack_uint64 ("bank_row",
row_off),
TALER_JSON_pack_amount ("amount_exchange_expected",
&rii->details.amount),
TALER_JSON_pack_amount ("amount_wired",
&details->amount),
GNUNET_JSON_pack_data_auto ("reserve_pub",
&details->reserve_pub),
TALER_JSON_pack_time_abs_human ("timestamp",
details->execution_date.abs_time),
GNUNET_JSON_pack_string ("diagnostic",
"wire amount does not match")));
if (0 < TALER_amount_cmp (&details->amount,
&rii->details.amount))
{
@ -1751,8 +1759,9 @@ history_credit_cb (void *cls,
&total_missattribution_in,
&rii->details.amount);
}
if (details->execution_date.abs_value_us !=
rii->details.execution_date.abs_value_us)
if (GNUNET_TIME_timestamp_cmp (details->execution_date,
!=,
rii->details.execution_date))
{
TALER_ARL_report (report_row_minor_inconsistencies,
GNUNET_JSON_PACK (
@ -1868,7 +1877,7 @@ begin_credit_audit (void)
static int
reserve_closed_cb (void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute execution_date,
struct GNUNET_TIME_Timestamp execution_date,
const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_ReservePublicKeyP *reserve_pub,
@ -1996,7 +2005,7 @@ begin_transaction (void)
start_pp = pp;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Resuming wire audit at %s / %llu\n",
GNUNET_STRINGS_absolute_time_to_string (pp.last_timestamp),
GNUNET_TIME_timestamp2s (pp.last_timestamp),
(unsigned long long) pp.last_reserve_close_uuid);
}

View File

@ -792,13 +792,13 @@ postgres_commit (void *cls)
* @return #GNUNET_OK on success,
* #GNUNET_SYSERR on DB errors
*/
static int
static enum GNUNET_GenericReturnValue
postgres_gc (void *cls)
{
struct PostgresClosure *pg = cls;
struct GNUNET_TIME_Absolute now;
struct GNUNET_PQ_QueryParam params_time[] = {
TALER_PQ_query_param_absolute_time (&now),
GNUNET_PQ_query_param_absolute_time (&now),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_Context *conn;
@ -1003,9 +1003,9 @@ postgres_insert_exchange_signkey (
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&sk->master_public_key),
TALER_PQ_query_param_absolute_time (&sk->ep_start),
TALER_PQ_query_param_absolute_time (&sk->ep_expire),
TALER_PQ_query_param_absolute_time (&sk->ep_end),
GNUNET_PQ_query_param_timestamp (&sk->ep_start),
GNUNET_PQ_query_param_timestamp (&sk->ep_expire),
GNUNET_PQ_query_param_timestamp (&sk->ep_end),
GNUNET_PQ_query_param_auto_from_type (&sk->exchange_pub),
GNUNET_PQ_query_param_auto_from_type (&sk->master_sig),
GNUNET_PQ_query_param_end
@ -1035,9 +1035,9 @@ postgres_insert_deposit_confirmation (
GNUNET_PQ_query_param_auto_from_type (&dc->h_contract_terms),
GNUNET_PQ_query_param_auto_from_type (&dc->h_extensions),
GNUNET_PQ_query_param_auto_from_type (&dc->h_wire),
TALER_PQ_query_param_absolute_time (&dc->exchange_timestamp),
TALER_PQ_query_param_absolute_time (&dc->wire_deadline),
TALER_PQ_query_param_absolute_time (&dc->refund_deadline),
GNUNET_PQ_query_param_timestamp (&dc->exchange_timestamp),
GNUNET_PQ_query_param_timestamp (&dc->wire_deadline),
GNUNET_PQ_query_param_timestamp (&dc->refund_deadline),
TALER_PQ_query_param_amount (&dc->amount_without_fee),
GNUNET_PQ_query_param_auto_from_type (&dc->coin_pub),
GNUNET_PQ_query_param_auto_from_type (&dc->merchant),
@ -1118,12 +1118,12 @@ deposit_confirmation_cb (void *cls,
&dc.h_extensions),
GNUNET_PQ_result_spec_auto_from_type ("h_wire",
&dc.h_wire),
GNUNET_PQ_result_spec_absolute_time ("exchange_timestamp",
&dc.exchange_timestamp),
GNUNET_PQ_result_spec_absolute_time ("refund_deadline",
&dc.refund_deadline),
GNUNET_PQ_result_spec_absolute_time ("wire_deadline",
&dc.wire_deadline),
GNUNET_PQ_result_spec_timestamp ("exchange_timestamp",
&dc.exchange_timestamp),
GNUNET_PQ_result_spec_timestamp ("refund_deadline",
&dc.refund_deadline),
GNUNET_PQ_result_spec_timestamp ("wire_deadline",
&dc.wire_deadline),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount_without_fee",
&dc.amount_without_fee),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
@ -1726,7 +1726,7 @@ postgres_insert_wire_auditor_progress (
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
TALER_PQ_query_param_absolute_time (&pp->last_timestamp),
GNUNET_PQ_query_param_timestamp (&pp->last_timestamp),
GNUNET_PQ_query_param_uint64 (&pp->last_reserve_close_uuid),
GNUNET_PQ_query_param_end
};
@ -1754,7 +1754,7 @@ postgres_update_wire_auditor_progress (
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
TALER_PQ_query_param_absolute_time (&pp->last_timestamp),
GNUNET_PQ_query_param_timestamp (&pp->last_timestamp),
GNUNET_PQ_query_param_uint64 (&pp->last_reserve_close_uuid),
GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_end
@ -1786,8 +1786,8 @@ postgres_get_wire_auditor_progress (
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
TALER_PQ_result_spec_absolute_time ("last_timestamp",
&pp->last_timestamp),
GNUNET_PQ_result_spec_timestamp ("last_timestamp",
&pp->last_timestamp),
GNUNET_PQ_result_spec_uint64 ("last_reserve_close_uuid",
&pp->last_reserve_close_uuid),
GNUNET_PQ_result_spec_end
@ -1820,7 +1820,7 @@ postgres_insert_reserve_info (void *cls,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_Amount *reserve_balance,
const struct TALER_Amount *withdraw_fee_balance,
struct GNUNET_TIME_Absolute expiration_date,
struct GNUNET_TIME_Timestamp expiration_date,
const char *origin_account)
{
struct PostgresClosure *pg = cls;
@ -1829,7 +1829,7 @@ postgres_insert_reserve_info (void *cls,
GNUNET_PQ_query_param_auto_from_type (master_pub),
TALER_PQ_query_param_amount (reserve_balance),
TALER_PQ_query_param_amount (withdraw_fee_balance),
TALER_PQ_query_param_absolute_time (&expiration_date),
GNUNET_PQ_query_param_timestamp (&expiration_date),
GNUNET_PQ_query_param_string (origin_account),
GNUNET_PQ_query_param_end
};
@ -1863,13 +1863,13 @@ postgres_update_reserve_info (void *cls,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_Amount *reserve_balance,
const struct TALER_Amount *withdraw_fee_balance,
struct GNUNET_TIME_Absolute expiration_date)
struct GNUNET_TIME_Timestamp expiration_date)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
TALER_PQ_query_param_amount (reserve_balance),
TALER_PQ_query_param_amount (withdraw_fee_balance),
TALER_PQ_query_param_absolute_time (&expiration_date),
GNUNET_PQ_query_param_timestamp (&expiration_date),
GNUNET_PQ_query_param_auto_from_type (reserve_pub),
GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_end
@ -1932,7 +1932,7 @@ postgres_get_reserve_info (void *cls,
uint64_t *rowid,
struct TALER_Amount *reserve_balance,
struct TALER_Amount *withdraw_fee_balance,
struct GNUNET_TIME_Absolute *expiration_date,
struct GNUNET_TIME_Timestamp *expiration_date,
char **sender_account)
{
struct PostgresClosure *pg = cls;
@ -1944,7 +1944,7 @@ postgres_get_reserve_info (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
TALER_PQ_RESULT_SPEC_AMOUNT ("reserve_balance", reserve_balance),
TALER_PQ_RESULT_SPEC_AMOUNT ("withdraw_fee_balance", withdraw_fee_balance),
TALER_PQ_result_spec_absolute_time ("expiration_date", expiration_date),
GNUNET_PQ_result_spec_timestamp ("expiration_date", expiration_date),
GNUNET_PQ_result_spec_uint64 ("auditor_reserves_rowid", rowid),
GNUNET_PQ_result_spec_string ("origin_account", sender_account),
GNUNET_PQ_result_spec_end
@ -2440,7 +2440,7 @@ postgres_insert_historic_denom_revenue (
void *cls,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_DenominationHash *denom_pub_hash,
struct GNUNET_TIME_Absolute revenue_timestamp,
struct GNUNET_TIME_Timestamp revenue_timestamp,
const struct TALER_Amount *revenue_balance,
const struct TALER_Amount *loss_balance)
{
@ -2448,7 +2448,7 @@ postgres_insert_historic_denom_revenue (
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_auto_from_type (denom_pub_hash),
TALER_PQ_query_param_absolute_time (&revenue_timestamp),
GNUNET_PQ_query_param_timestamp (&revenue_timestamp),
TALER_PQ_query_param_amount (revenue_balance),
TALER_PQ_query_param_amount (loss_balance),
GNUNET_PQ_query_param_end
@ -2507,15 +2507,18 @@ historic_denom_revenue_cb (void *cls,
for (unsigned int i = 0; i < num_results; i++)
{
struct TALER_DenominationHash denom_pub_hash;
struct GNUNET_TIME_Absolute revenue_timestamp;
struct GNUNET_TIME_Timestamp revenue_timestamp;
struct TALER_Amount revenue_balance;
struct TALER_Amount loss;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", &denom_pub_hash),
TALER_PQ_result_spec_absolute_time ("revenue_timestamp",
&revenue_timestamp),
TALER_PQ_RESULT_SPEC_AMOUNT ("revenue_balance", &revenue_balance),
TALER_PQ_RESULT_SPEC_AMOUNT ("loss_balance", &loss),
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&denom_pub_hash),
GNUNET_PQ_result_spec_timestamp ("revenue_timestamp",
&revenue_timestamp),
TALER_PQ_RESULT_SPEC_AMOUNT ("revenue_balance",
&revenue_balance),
TALER_PQ_RESULT_SPEC_AMOUNT ("loss_balance",
&loss),
GNUNET_PQ_result_spec_end
};
@ -2595,15 +2598,15 @@ static enum GNUNET_DB_QueryStatus
postgres_insert_historic_reserve_revenue (
void *cls,
const struct TALER_MasterPublicKeyP *master_pub,
struct GNUNET_TIME_Absolute start_time,
struct GNUNET_TIME_Absolute end_time,
struct GNUNET_TIME_Timestamp start_time,
struct GNUNET_TIME_Timestamp end_time,
const struct TALER_Amount *reserve_profits)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
TALER_PQ_query_param_absolute_time (&start_time),
TALER_PQ_query_param_absolute_time (&end_time),
GNUNET_PQ_query_param_timestamp (&start_time),
GNUNET_PQ_query_param_timestamp (&end_time),
TALER_PQ_query_param_amount (reserve_profits),
GNUNET_PQ_query_param_end
};
@ -2660,13 +2663,16 @@ historic_reserve_revenue_cb (void *cls,
for (unsigned int i = 0; i < num_results; i++)
{
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_Amount reserve_profits;
struct GNUNET_PQ_ResultSpec rs[] = {
TALER_PQ_result_spec_absolute_time ("start_date", &start_date),
TALER_PQ_result_spec_absolute_time ("end_date", &end_date),
TALER_PQ_RESULT_SPEC_AMOUNT ("reserve_profits", &reserve_profits),
GNUNET_PQ_result_spec_timestamp ("start_date",
&start_date),
GNUNET_PQ_result_spec_timestamp ("end_date",
&end_date),
TALER_PQ_RESULT_SPEC_AMOUNT ("reserve_profits",
&reserve_profits),
GNUNET_PQ_result_spec_end
};

View File

@ -134,10 +134,10 @@ run (void *cls)
struct TALER_DenominationPrivateKey denom_priv;
struct TALER_DenominationPublicKey denom_pub;
struct TALER_DenominationHash denom_pub_hash;
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Absolute past;
struct GNUNET_TIME_Absolute future;
struct GNUNET_TIME_Absolute date;
struct GNUNET_TIME_Timestamp now;
struct GNUNET_TIME_Timestamp past;
struct GNUNET_TIME_Timestamp future;
struct GNUNET_TIME_Timestamp date;
RND_BLK (&master_pub);
RND_BLK (&reserve_pub);
@ -152,16 +152,17 @@ run (void *cls)
TALER_denom_priv_free (&denom_priv);
TALER_denom_pub_free (&denom_pub);
now = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&now);
past = GNUNET_TIME_absolute_subtract (now,
GNUNET_TIME_relative_multiply (
GNUNET_TIME_UNIT_HOURS,
4));
future = GNUNET_TIME_absolute_add (now,
GNUNET_TIME_relative_multiply (
GNUNET_TIME_UNIT_HOURS,
4));
now = GNUNET_TIME_timestamp_get ();
past = GNUNET_TIME_absolute_to_timestamp (
GNUNET_TIME_absolute_subtract (now.abs_time,
GNUNET_TIME_relative_multiply (
GNUNET_TIME_UNIT_HOURS,
4)));
future = GNUNET_TIME_absolute_to_timestamp (
GNUNET_TIME_absolute_add (now.abs_time,
GNUNET_TIME_relative_multiply (
GNUNET_TIME_UNIT_HOURS,
4)));
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test: auditor_insert_exchange\n");
@ -488,7 +489,7 @@ run (void *cls)
select_historic_denom_revenue_result (
void *cls,
const struct TALER_DenominationHash *denom_pub_hash2,
struct GNUNET_TIME_Absolute revenue_timestamp2,
struct GNUNET_TIME_Timestamp revenue_timestamp2,
const struct TALER_Amount *revenue_balance2,
const struct TALER_Amount *loss2)
{
@ -548,12 +549,11 @@ run (void *cls)
"Test: select_historic_reserve_revenue\n");
int
select_historic_reserve_revenue_result (void *cls,
struct GNUNET_TIME_Absolute
start_time2,
struct GNUNET_TIME_Absolute end_time2,
const struct
TALER_Amount *reserve_profits2)
select_historic_reserve_revenue_result (
void *cls,
struct GNUNET_TIME_Timestamp start_time2,
struct GNUNET_TIME_Timestamp end_time2,
const struct TALER_Amount *reserve_profits2)
{
static int n = 0;

View File

@ -75,12 +75,12 @@ handle_admin_add_incoming_finished (void *cls,
{
struct TALER_BANK_AdminAddIncomingHandle *aai = cls;
uint64_t row_id = UINT64_MAX;
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Timestamp timestamp;
enum TALER_ErrorCode ec;
const json_t *j = response;
aai->job = NULL;
timestamp = GNUNET_TIME_UNIT_FOREVER_ABS;
timestamp = GNUNET_TIME_UNIT_FOREVER_TS;
switch (response_code)
{
case 0:
@ -91,8 +91,8 @@ handle_admin_add_incoming_finished (void *cls,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_uint64 ("row_id",
&row_id),
TALER_JSON_spec_absolute_time ("timestamp",
&timestamp),
GNUNET_JSON_spec_timestamp ("timestamp",
&timestamp),
GNUNET_JSON_spec_end ()
};
@ -158,23 +158,6 @@ handle_admin_add_incoming_finished (void *cls,
}
/**
* Perform a wire transfer from some account to the exchange to fill a
* reserve. Note that this API is usually only used for testing (with
* fakebank and our Python bank) and thus may not be accessible in a
* production setting.
*
* @param ctx curl context for the event loop
* @param auth authentication data to send to the bank
* @param reserve_pub wire transfer subject for the transfer
* @param amount amount that was is to be deposited
* @param debit_account account to deposit from (payto URI, but used as 'payfrom')
* @param res_cb the callback to call when the final result for this request is available
* @param res_cb_cls closure for the above callback
* @return NULL
* if the inputs are invalid (i.e. invalid amount) or internal errors.
* In this case, the callback is not called.
*/
struct TALER_BANK_AdminAddIncomingHandle *
TALER_BANK_admin_add_incoming (
struct GNUNET_CURL_Context *ctx,
@ -268,12 +251,6 @@ TALER_BANK_admin_add_incoming (
}
/**
* Cancel an add incoming. This function cannot be used on a request
* handle if a response is already served for it.
*
* @param aai the admin add incoming request handle
*/
void
TALER_BANK_admin_add_incoming_cancel (
struct TALER_BANK_AdminAddIncomingHandle *aai)

View File

@ -23,15 +23,6 @@
#include "bank_api_common.h"
/**
* Set authentication data in @a easy from @a auth.
* The API currently specifies the use of HTTP basic
* authentication.
*
* @param easy curl handle to setup for authentication
* @param auth authentication data to use
* @return #GNUNET_OK in success
*/
int
TALER_BANK_setup_auth_ (CURL *easy,
const struct TALER_BANK_AuthenticationData *auth)

View File

@ -97,8 +97,8 @@ parse_account_history (struct TALER_BANK_CreditHistoryHandle *hh,
struct GNUNET_JSON_Specification hist_spec[] = {
TALER_JSON_spec_amount_any ("amount",
&td.amount),
TALER_JSON_spec_absolute_time ("date",
&td.execution_date),
GNUNET_JSON_spec_timestamp ("date",
&td.execution_date),
GNUNET_JSON_spec_uint64 ("row_id",
&row_id),
GNUNET_JSON_spec_fixed_auto ("reserve_pub",

View File

@ -73,7 +73,7 @@ struct TALER_BANK_DebitHistoryHandle
* were set,
* #GNUNET_SYSERR if there was a protocol violation in @a history
*/
static int
static enum GNUNET_GenericReturnValue
parse_account_history (struct TALER_BANK_DebitHistoryHandle *hh,
const json_t *history)
{
@ -97,8 +97,8 @@ parse_account_history (struct TALER_BANK_DebitHistoryHandle *hh,
struct GNUNET_JSON_Specification hist_spec[] = {
TALER_JSON_spec_amount_any ("amount",
&td.amount),
TALER_JSON_spec_absolute_time ("date",
&td.execution_date),
GNUNET_JSON_spec_timestamp ("date",
&td.execution_date),
GNUNET_JSON_spec_uint64 ("row_id",
&row_id),
GNUNET_JSON_spec_fixed_auto ("wtid",

View File

@ -23,15 +23,7 @@
#include "taler_bank_service.h"
/**
* Parse configuration section with bank authentication data.
*
* @param cfg configuration to parse
* @param section the section with the configuration data
* @param[out] auth set to the configuration data found
* @return #GNUNET_OK on success
*/
int
enum GNUNET_GenericReturnValue
TALER_BANK_auth_parse_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *section,
struct TALER_BANK_AuthenticationData *auth)
@ -122,12 +114,6 @@ TALER_BANK_auth_parse_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
}
/**
* Free memory inside of @a auth (but not @a auth itself).
* Dual to #TALER_BANK_auth_parse_cfg().
*
* @param[in] auth authentication data to free
*/
void
TALER_BANK_auth_free (struct TALER_BANK_AuthenticationData *auth)
{

View File

@ -170,7 +170,7 @@ handle_transfer_finished (void *cls,
struct TALER_BANK_TransferHandle *th = cls;
const json_t *j = response;
uint64_t row_id = UINT64_MAX;
struct GNUNET_TIME_Absolute timestamp = GNUNET_TIME_UNIT_FOREVER_ABS;
struct GNUNET_TIME_Timestamp timestamp = GNUNET_TIME_UNIT_FOREVER_TS;
enum TALER_ErrorCode ec;
th->job = NULL;
@ -184,8 +184,8 @@ handle_transfer_finished (void *cls,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_uint64 ("row_id",
&row_id),
TALER_JSON_spec_absolute_time ("timestamp",
&timestamp),
GNUNET_JSON_spec_timestamp ("timestamp",
&timestamp),
GNUNET_JSON_spec_end ()
};

View File

@ -219,7 +219,7 @@ struct Transaction
/**
* When did the transaction happen?
*/
struct GNUNET_TIME_Absolute date;
struct GNUNET_TIME_Timestamp date;
/**
* Number of this transaction.
@ -963,7 +963,7 @@ make_transfer (
const char *exchange_base_url,
const struct GNUNET_HashCode *request_uid,
uint64_t *ret_row_id,
struct GNUNET_TIME_Absolute *timestamp)
struct GNUNET_TIME_Timestamp *timestamp)
{
struct Transaction *t;
struct Account *debit_acc;
@ -1022,9 +1022,9 @@ make_transfer (
t->debit_account = debit_acc;
t->credit_account = credit_acc;
t->amount = *amount;
t->date = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&t->date);
*timestamp = t->date;
t->date = GNUNET_TIME_timestamp_get ();
if (NULL != timestamp)
*timestamp = t->date;
t->type = T_DEBIT;
memcpy (t->subject.debit.exchange_base_url,
exchange_base_url,
@ -1082,7 +1082,7 @@ make_admin_transfer (
const struct TALER_Amount *amount,
const struct TALER_ReservePublicKeyP *reserve_pub,
uint64_t *row_id,
struct GNUNET_TIME_Absolute *timestamp)
struct GNUNET_TIME_Timestamp *timestamp)
{
struct Transaction *t;
const struct GNUNET_PeerIdentity *pid;
@ -1125,8 +1125,7 @@ make_admin_transfer (
t->debit_account = debit_acc;
t->credit_account = credit_acc;
t->amount = *amount;
t->date = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&t->date);
t->date = GNUNET_TIME_timestamp_get ();
if (NULL != timestamp)
*timestamp = t->date;
t->type = T_CREDIT;
@ -1334,7 +1333,7 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h,
enum GNUNET_JSON_PostResult pr;
json_t *json;
uint64_t row_id;
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Timestamp timestamp;
pr = GNUNET_JSON_post_parser (REQUEST_BUFFER_MAX,
connection,
@ -1431,8 +1430,8 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h,
MHD_HTTP_OK,
GNUNET_JSON_pack_uint64 ("row_id",
row_id),
GNUNET_JSON_pack_time_abs ("timestamp",
timestamp));
GNUNET_JSON_pack_timestamp ("timestamp",
timestamp));
}
@ -1458,7 +1457,7 @@ handle_transfer (struct TALER_FAKEBANK_Handle *h,
enum GNUNET_JSON_PostResult pr;
json_t *json;
uint64_t row_id;
struct GNUNET_TIME_Absolute ts;
struct GNUNET_TIME_Timestamp ts;
pr = GNUNET_JSON_post_parser (REQUEST_BUFFER_MAX,
connection,
@ -1561,8 +1560,8 @@ handle_transfer (struct TALER_FAKEBANK_Handle *h,
MHD_HTTP_OK,
GNUNET_JSON_pack_uint64 ("row_id",
row_id),
GNUNET_JSON_pack_time_abs ("timestamp",
ts));
GNUNET_JSON_pack_timestamp ("timestamp",
ts));
}
@ -2016,8 +2015,8 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h,
trans = GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row_id",
pos->row_id),
GNUNET_JSON_pack_time_abs ("date",
pos->date),
GNUNET_JSON_pack_timestamp ("date",
pos->date),
TALER_JSON_pack_amount ("amount",
&pos->amount),
GNUNET_JSON_pack_string ("credit_account",
@ -2215,8 +2214,8 @@ handle_credit_history (struct TALER_FAKEBANK_Handle *h,
trans = GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("row_id",
pos->row_id),
GNUNET_JSON_pack_time_abs ("date",
pos->date),
GNUNET_JSON_pack_timestamp ("date",
pos->date),
TALER_JSON_pack_amount ("amount",
&pos->amount),
GNUNET_JSON_pack_string ("credit_account",

View File

@ -227,7 +227,7 @@ credit_history_cb (void *cls,
details->credit_account_uri,
TALER_B2S (&details->reserve_pub),
TALER_amount2s (&details->amount),
GNUNET_STRINGS_absolute_time_to_string (details->execution_date));
GNUNET_TIME_timestamp2s (details->execution_date));
return GNUNET_OK;
}
@ -340,7 +340,7 @@ debit_history_cb (void *cls,
details->credit_account_uri,
TALER_B2S (&details->wtid),
TALER_amount2s (&details->amount),
GNUNET_STRINGS_absolute_time_to_string (details->execution_date));
GNUNET_TIME_timestamp2s (details->execution_date));
return GNUNET_OK;
}
@ -391,7 +391,7 @@ confirmation_cb (void *cls,
unsigned int response_code,
enum TALER_ErrorCode ec,
uint64_t row_id,
struct GNUNET_TIME_Absolute timestamp)
struct GNUNET_TIME_Timestamp timestamp)
{
(void) cls;
eh = NULL;
@ -408,7 +408,7 @@ confirmation_cb (void *cls,
fprintf (stdout,
"Wire transfer #%llu executed successfully at %s.\n",
(unsigned long long) row_id,
GNUNET_STRINGS_absolute_time_to_string (timestamp));
GNUNET_TIME_timestamp2s (timestamp));
global_ret = 0;
GNUNET_SCHEDULER_shutdown ();
}
@ -500,7 +500,7 @@ res_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)
{
(void) cls;

View File

@ -86,12 +86,12 @@ static struct TALER_DenominationSignature denom_sig;
/**
* Time range when deposits start.
*/
static struct GNUNET_TIME_Absolute start;
static struct GNUNET_TIME_Timestamp start;
/**
* Time range when deposits end.
*/
static struct GNUNET_TIME_Absolute end;
static struct GNUNET_TIME_Timestamp end;
/**
@ -171,18 +171,17 @@ make_amountN (unsigned int val,
*
* @return time stamp between start and end
*/
static struct GNUNET_TIME_Absolute
static struct GNUNET_TIME_Timestamp
random_time (void)
{
uint64_t delta;
struct GNUNET_TIME_Absolute ret;
delta = end.abs_value_us - start.abs_value_us;
delta = end.abs_time.abs_value_us - start.abs_time.abs_value_us;
delta = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_NONCE,
delta);
ret.abs_value_us = start.abs_value_us + delta;
(void) GNUNET_TIME_round_abs (&ret);
return ret;
ret.abs_value_us = start.abs_time.abs_value_us + delta;
return GNUNET_TIME_absolute_to_timestamp (ret);
}
@ -433,11 +432,10 @@ run (void *cls,
/* make sure everything 'ends' before the current time,
so that the aggregator will process everything without
need for time-travel */
end = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&end);
start = GNUNET_TIME_absolute_subtract (end,
GNUNET_TIME_UNIT_MONTHS);
(void) GNUNET_TIME_round_abs (&start);
end = GNUNET_TIME_timestamp_get ();
start = GNUNET_TIME_absolute_to_timestamp (
GNUNET_TIME_absolute_subtract (end.abs_time,
GNUNET_TIME_UNIT_MONTHS));
cfg = c;
if (GNUNET_OK !=
TALER_config_get_currency (cfg,
@ -467,17 +465,19 @@ run (void *cls,
issue.properties.purpose.size = htonl (sizeof (issue.properties));
RANDOMIZE (&issue.properties.master);
issue.properties.start
= GNUNET_TIME_absolute_hton (start);
= GNUNET_TIME_timestamp_hton (start);
issue.properties.expire_withdraw
= GNUNET_TIME_absolute_hton (
GNUNET_TIME_absolute_add (start,
GNUNET_TIME_UNIT_DAYS));
= GNUNET_TIME_timestamp_hton (
GNUNET_TIME_absolute_to_timestamp (
GNUNET_TIME_absolute_add (start.abs_time,
GNUNET_TIME_UNIT_DAYS)));
issue.properties.expire_deposit
= GNUNET_TIME_absolute_hton (end);
= GNUNET_TIME_timestamp_hton (end);
issue.properties.expire_legal
= GNUNET_TIME_absolute_hton (
GNUNET_TIME_absolute_add (end,
GNUNET_TIME_UNIT_YEARS));
= GNUNET_TIME_timestamp_hton (
GNUNET_TIME_absolute_to_timestamp (
GNUNET_TIME_absolute_add (end.abs_time,
GNUNET_TIME_UNIT_YEARS)));
{
struct TALER_DenominationPrivateKey pk;
struct TALER_DenominationPublicKey denom_pub;
@ -541,14 +541,14 @@ run (void *cls,
struct TALER_Amount wire_fee;
struct TALER_MasterSignatureP master_sig;
unsigned int year;
struct GNUNET_TIME_Absolute ws;
struct GNUNET_TIME_Absolute we;
struct GNUNET_TIME_Timestamp ws;
struct GNUNET_TIME_Timestamp we;
year = GNUNET_TIME_get_current_year ();
for (unsigned int y = year - 1; y<year + 2; y++)
{
ws = GNUNET_TIME_year_to_time (y - 1);
we = GNUNET_TIME_year_to_time (y);
ws = GNUNET_TIME_absolute_to_timestamp (GNUNET_TIME_year_to_time (y - 1));
we = GNUNET_TIME_absolute_to_timestamp (GNUNET_TIME_year_to_time (y));
make_amount (0, 5, &wire_fee);
memset (&master_sig,
0,

View File

@ -53,8 +53,6 @@ taler_exchange_dbinit_LDADD = \
$(top_builddir)/src/exchangedb/libtalerexchangedb.la \
-lgnunetutil \
$(XLIB)
taler_exchange_dbinit_LDFLAGS = \
$(POSTGRESQL_LDFLAGS)
taler_exchange_dbinit_CPPFLAGS = \
-I$(top_srcdir)/src/include \
-I$(top_srcdir)/src/pq/ \

View File

@ -752,10 +752,10 @@ show_denomkeys (const json_t *denomkeys)
const char *err_name;
unsigned int err_line;
struct TALER_DenominationPublicKey denom_pub;
struct GNUNET_TIME_Absolute stamp_start;
struct GNUNET_TIME_Absolute stamp_expire_withdraw;
struct GNUNET_TIME_Absolute stamp_expire_deposit;
struct GNUNET_TIME_Absolute stamp_expire_legal;
struct GNUNET_TIME_Timestamp stamp_start;
struct GNUNET_TIME_Timestamp stamp_expire_withdraw;
struct GNUNET_TIME_Timestamp stamp_expire_deposit;
struct GNUNET_TIME_Timestamp stamp_expire_legal;
struct TALER_Amount coin_value;
struct TALER_Amount fee_withdraw;
struct TALER_Amount fee_deposit;
@ -780,14 +780,14 @@ show_denomkeys (const json_t *denomkeys)
TALER_JSON_spec_amount ("fee_refund",
currency,
&fee_refund),
GNUNET_JSON_spec_absolute_time ("stamp_start",
&stamp_start),
GNUNET_JSON_spec_absolute_time ("stamp_expire_withdraw",
&stamp_expire_withdraw),
GNUNET_JSON_spec_absolute_time ("stamp_expire_deposit",
&stamp_expire_deposit),
GNUNET_JSON_spec_absolute_time ("stamp_expire_legal",
&stamp_expire_legal),
GNUNET_JSON_spec_timestamp ("stamp_start",
&stamp_start),
GNUNET_JSON_spec_timestamp ("stamp_expire_withdraw",
&stamp_expire_withdraw),
GNUNET_JSON_spec_timestamp ("stamp_expire_deposit",
&stamp_expire_deposit),
GNUNET_JSON_spec_timestamp ("stamp_expire_legal",
&stamp_expire_legal),
GNUNET_JSON_spec_fixed_auto ("master_sig",
&master_sig),
GNUNET_JSON_spec_end ()
@ -811,8 +811,9 @@ show_denomkeys (const json_t *denomkeys)
test_shutdown ();
return GNUNET_SYSERR;
}
duration = GNUNET_TIME_absolute_get_difference (stamp_start,
stamp_expire_withdraw);
duration = GNUNET_TIME_absolute_get_difference (
stamp_start.abs_time,
stamp_expire_withdraw.abs_time);
TALER_denom_pub_hash (&denom_pub,
&h_denom_pub);
if (GNUNET_OK !=
@ -851,18 +852,18 @@ show_denomkeys (const json_t *denomkeys)
refresh_fee_s = TALER_amount_to_string (&fee_refresh);
refund_fee_s = TALER_amount_to_string (&fee_refund);
deposit_s = GNUNET_strdup (
GNUNET_STRINGS_absolute_time_to_string (stamp_expire_deposit));
GNUNET_TIME_timestamp2s (stamp_expire_deposit));
legal_s = GNUNET_strdup (
GNUNET_STRINGS_absolute_time_to_string (stamp_expire_legal));
GNUNET_TIME_timestamp2s (stamp_expire_legal));
printf (
"DENOMINATION-KEY %s of value %s starting at %s "
"(used for: %s, deposit until: %s legal end: %s) with fees %s/%s/%s/%s\n",
TALER_B2S (&h_denom_pub),
TALER_amount2s (&coin_value),
GNUNET_STRINGS_absolute_time_to_string (stamp_start),
GNUNET_STRINGS_relative_time_to_string (duration,
GNUNET_NO),
GNUNET_TIME_timestamp2s (stamp_start),
GNUNET_TIME_relative2s (duration,
false),
deposit_s,
legal_s,
withdraw_fee_s,
@ -1052,10 +1053,10 @@ sign_denomkeys (const json_t *denomkeys)
const char *err_name;
unsigned int err_line;
struct TALER_DenominationPublicKey denom_pub;
struct GNUNET_TIME_Absolute stamp_start;
struct GNUNET_TIME_Absolute stamp_expire_withdraw;
struct GNUNET_TIME_Absolute stamp_expire_deposit;
struct GNUNET_TIME_Absolute stamp_expire_legal;
struct GNUNET_TIME_Timestamp stamp_start;
struct GNUNET_TIME_Timestamp stamp_expire_withdraw;
struct GNUNET_TIME_Timestamp stamp_expire_deposit;
struct GNUNET_TIME_Timestamp stamp_expire_legal;
struct TALER_Amount coin_value;
struct TALER_Amount fee_withdraw;
struct TALER_Amount fee_deposit;
@ -1080,14 +1081,14 @@ sign_denomkeys (const json_t *denomkeys)
TALER_JSON_spec_amount ("fee_refund",
currency,
&fee_refund),
GNUNET_JSON_spec_absolute_time ("stamp_start",
&stamp_start),
GNUNET_JSON_spec_absolute_time ("stamp_expire_withdraw",
&stamp_expire_withdraw),
GNUNET_JSON_spec_absolute_time ("stamp_expire_deposit",
&stamp_expire_deposit),
GNUNET_JSON_spec_absolute_time ("stamp_expire_legal",
&stamp_expire_legal),
GNUNET_JSON_spec_timestamp ("stamp_start",
&stamp_start),
GNUNET_JSON_spec_timestamp ("stamp_expire_withdraw",
&stamp_expire_withdraw),
GNUNET_JSON_spec_timestamp ("stamp_expire_deposit",
&stamp_expire_deposit),
GNUNET_JSON_spec_timestamp ("stamp_expire_legal",
&stamp_expire_legal),
GNUNET_JSON_spec_fixed_auto ("master_sig",
&master_sig),
GNUNET_JSON_spec_end ()

View File

@ -1031,7 +1031,7 @@ upload_auditor_add (const char *exchange_url,
struct TALER_MasterSignatureP master_sig;
const char *auditor_url;
const char *auditor_name;
struct GNUNET_TIME_Absolute start_time;
struct GNUNET_TIME_Timestamp start_time;
struct TALER_AuditorPublicKeyP auditor_pub;
struct AuditorAddRequest *aar;
const char *err_name;
@ -1041,8 +1041,8 @@ upload_auditor_add (const char *exchange_url,
&auditor_url),
GNUNET_JSON_spec_string ("auditor_name",
&auditor_name),
GNUNET_JSON_spec_absolute_time ("validity_start",
&start_time),
GNUNET_JSON_spec_timestamp ("validity_start",
&start_time),
GNUNET_JSON_spec_fixed_auto ("auditor_pub",
&auditor_pub),
GNUNET_JSON_spec_fixed_auto ("master_sig",
@ -1130,15 +1130,15 @@ upload_auditor_del (const char *exchange_url,
{
struct TALER_AuditorPublicKeyP auditor_pub;
struct TALER_MasterSignatureP master_sig;
struct GNUNET_TIME_Absolute end_time;
struct GNUNET_TIME_Timestamp end_time;
struct AuditorDelRequest *adr;
const char *err_name;
unsigned int err_line;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("auditor_pub",
&auditor_pub),
GNUNET_JSON_spec_absolute_time ("validity_end",
&end_time),
GNUNET_JSON_spec_timestamp ("validity_end",
&end_time),
GNUNET_JSON_spec_fixed_auto ("master_sig",
&master_sig),
GNUNET_JSON_spec_end ()
@ -1223,15 +1223,15 @@ upload_wire_add (const char *exchange_url,
struct TALER_MasterSignatureP master_sig_add;
struct TALER_MasterSignatureP master_sig_wire;
const char *payto_uri;
struct GNUNET_TIME_Absolute start_time;
struct GNUNET_TIME_Timestamp start_time;
struct WireAddRequest *war;
const char *err_name;
unsigned int err_line;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("payto_uri",
&payto_uri),
GNUNET_JSON_spec_absolute_time ("validity_start",
&start_time),
GNUNET_JSON_spec_timestamp ("validity_start",
&start_time),
GNUNET_JSON_spec_fixed_auto ("master_sig_add",
&master_sig_add),
GNUNET_JSON_spec_fixed_auto ("master_sig_wire",
@ -1333,15 +1333,15 @@ upload_wire_del (const char *exchange_url,
{
struct TALER_MasterSignatureP master_sig;
const char *payto_uri;
struct GNUNET_TIME_Absolute end_time;
struct GNUNET_TIME_Timestamp end_time;
struct WireDelRequest *wdr;
const char *err_name;
unsigned int err_line;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("payto_uri",
&payto_uri),
GNUNET_JSON_spec_absolute_time ("validity_end",
&end_time),
GNUNET_JSON_spec_timestamp ("validity_end",
&end_time),
GNUNET_JSON_spec_fixed_auto ("master_sig",
&master_sig),
GNUNET_JSON_spec_end ()
@ -1431,8 +1431,8 @@ upload_wire_fee (const char *exchange_url,
unsigned int err_line;
struct TALER_Amount wire_fee;
struct TALER_Amount closing_fee;
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 GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("wire_method",
&wire_method),
@ -1442,10 +1442,10 @@ upload_wire_fee (const char *exchange_url,
TALER_JSON_spec_amount ("closing_fee",
currency,
&closing_fee),
GNUNET_JSON_spec_absolute_time ("start_time",
&start_time),
GNUNET_JSON_spec_absolute_time ("end_time",
&end_time),
GNUNET_JSON_spec_timestamp ("start_time",
&start_time),
GNUNET_JSON_spec_timestamp ("end_time",
&end_time),
GNUNET_JSON_spec_fixed_auto ("master_sig",
&master_sig),
GNUNET_JSON_spec_end ()
@ -1926,7 +1926,7 @@ do_add_auditor (char *const *args)
{
struct TALER_MasterSignatureP master_sig;
struct TALER_AuditorPublicKeyP auditor_pub;
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Timestamp now;
if (NULL != in)
{
@ -1965,8 +1965,7 @@ do_add_auditor (char *const *args)
if (GNUNET_OK !=
load_offline_key (GNUNET_NO))
return;
now = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&now);
now = GNUNET_TIME_timestamp_get ();
TALER_exchange_offline_auditor_add_sign (&auditor_pub,
args[1],
now,
@ -1978,8 +1977,8 @@ do_add_auditor (char *const *args)
args[1]),
GNUNET_JSON_pack_string ("auditor_name",
args[2]),
GNUNET_JSON_pack_time_abs ("validity_start",
now),
GNUNET_JSON_pack_timestamp ("validity_start",
now),
GNUNET_JSON_pack_data_auto ("auditor_pub",
&auditor_pub),
GNUNET_JSON_pack_data_auto ("master_sig",
@ -1999,7 +1998,7 @@ do_del_auditor (char *const *args)
{
struct TALER_MasterSignatureP master_sig;
struct TALER_AuditorPublicKeyP auditor_pub;
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Timestamp now;
if (NULL != in)
{
@ -2025,9 +2024,7 @@ do_del_auditor (char *const *args)
if (GNUNET_OK !=
load_offline_key (GNUNET_NO))
return;
now = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&now);
now = GNUNET_TIME_timestamp_get ();
TALER_exchange_offline_auditor_del_sign (&auditor_pub,
now,
&master_priv,
@ -2036,8 +2033,8 @@ do_del_auditor (char *const *args)
GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("auditor_pub",
&auditor_pub),
GNUNET_JSON_pack_time_abs ("validity_end",
now),
GNUNET_JSON_pack_timestamp ("validity_end",
now),
GNUNET_JSON_pack_data_auto ("master_sig",
&master_sig)));
next (args + 1);
@ -2055,7 +2052,7 @@ do_add_wire (char *const *args)
{
struct TALER_MasterSignatureP master_sig_add;
struct TALER_MasterSignatureP master_sig_wire;
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Timestamp now;
if (NULL != in)
{
@ -2076,9 +2073,7 @@ do_add_wire (char *const *args)
if (GNUNET_OK !=
load_offline_key (GNUNET_NO))
return;
now = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&now);
now = GNUNET_TIME_timestamp_get ();
{
char *wire_method;
@ -2105,8 +2100,8 @@ do_add_wire (char *const *args)
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("payto_uri",
args[0]),
GNUNET_JSON_pack_time_abs ("validity_start",
now),
GNUNET_JSON_pack_timestamp ("validity_start",
now),
GNUNET_JSON_pack_data_auto ("master_sig_add",
&master_sig_add),
GNUNET_JSON_pack_data_auto ("master_sig_wire",
@ -2125,7 +2120,7 @@ static void
do_del_wire (char *const *args)
{
struct TALER_MasterSignatureP master_sig;
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Timestamp now;
if (NULL != in)
{
@ -2146,9 +2141,7 @@ do_del_wire (char *const *args)
if (GNUNET_OK !=
load_offline_key (GNUNET_NO))
return;
now = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&now);
now = GNUNET_TIME_timestamp_get ();
TALER_exchange_offline_wire_del_sign (args[0],
now,
&master_priv,
@ -2157,8 +2150,8 @@ do_del_wire (char *const *args)
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("payto_uri",
args[0]),
GNUNET_JSON_pack_time_abs ("validity_end",
now),
GNUNET_JSON_pack_timestamp ("validity_end",
now),
GNUNET_JSON_pack_data_auto ("master_sig",
&master_sig)));
next (args + 1);
@ -2180,8 +2173,8 @@ do_set_wire_fee (char *const *args)
unsigned int year;
struct TALER_Amount wire_fee;
struct TALER_Amount closing_fee;
struct GNUNET_TIME_Absolute start_time;
struct GNUNET_TIME_Absolute end_time;
struct GNUNET_TIME_Timestamp start_time;
struct GNUNET_TIME_Timestamp end_time;
if (NULL != in)
{
@ -2220,8 +2213,10 @@ do_set_wire_fee (char *const *args)
if (GNUNET_OK !=
load_offline_key (GNUNET_NO))
return;
start_time = GNUNET_TIME_year_to_time (year);
end_time = GNUNET_TIME_year_to_time (year + 1);
start_time = GNUNET_TIME_absolute_to_timestamp (
GNUNET_TIME_year_to_time (year));
end_time = GNUNET_TIME_absolute_to_timestamp (
GNUNET_TIME_year_to_time (year + 1));
TALER_exchange_offline_wire_fee_sign (args[1],
start_time,
@ -2234,10 +2229,10 @@ do_set_wire_fee (char *const *args)
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("wire_method",
args[1]),
GNUNET_JSON_pack_time_abs ("start_time",
start_time),
GNUNET_JSON_pack_time_abs ("end_time",
end_time),
GNUNET_JSON_pack_timestamp ("start_time",
start_time),
GNUNET_JSON_pack_timestamp ("end_time",
end_time),
TALER_JSON_pack_amount ("wire_fee",
&wire_fee),
TALER_JSON_pack_amount ("closing_fee",
@ -2504,17 +2499,17 @@ show_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
unsigned int err_line;
struct TALER_ExchangePublicKeyP exchange_pub;
struct TALER_SecurityModuleSignatureP secm_sig;
struct GNUNET_TIME_Absolute start_time;
struct GNUNET_TIME_Absolute sign_end;
struct GNUNET_TIME_Absolute legal_end;
struct GNUNET_TIME_Timestamp start_time;
struct GNUNET_TIME_Timestamp sign_end;
struct GNUNET_TIME_Timestamp legal_end;
struct GNUNET_TIME_Relative duration;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_absolute_time ("stamp_start",
&start_time),
GNUNET_JSON_spec_absolute_time ("stamp_expire",
&sign_end),
GNUNET_JSON_spec_absolute_time ("stamp_end",
&legal_end),
GNUNET_JSON_spec_timestamp ("stamp_start",
&start_time),
GNUNET_JSON_spec_timestamp ("stamp_expire",
&sign_end),
GNUNET_JSON_spec_timestamp ("stamp_end",
&legal_end),
GNUNET_JSON_spec_fixed_auto ("key",
&exchange_pub),
GNUNET_JSON_spec_fixed_auto ("signkey_secmod_sig",
@ -2540,8 +2535,8 @@ show_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
test_shutdown ();
return GNUNET_SYSERR;
}
duration = GNUNET_TIME_absolute_get_difference (start_time,
sign_end);
duration = GNUNET_TIME_absolute_get_difference (start_time.abs_time,
sign_end.abs_time);
if (GNUNET_OK !=
TALER_exchange_secmod_eddsa_verify (&exchange_pub,
start_time,
@ -2560,12 +2555,12 @@ show_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
char *legal_end_s;
legal_end_s = GNUNET_strdup (
GNUNET_STRINGS_absolute_time_to_string (legal_end));
GNUNET_TIME_timestamp2s (legal_end));
printf ("EXCHANGE-KEY %s starting at %s (used for: %s, legal end: %s)\n",
TALER_B2S (&exchange_pub),
GNUNET_STRINGS_absolute_time_to_string (start_time),
GNUNET_STRINGS_relative_time_to_string (duration,
GNUNET_NO),
GNUNET_TIME_timestamp2s (start_time),
GNUNET_TIME_relative2s (duration,
false),
legal_end_s);
GNUNET_free (legal_end_s);
}
@ -2593,10 +2588,10 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
unsigned int err_line;
const char *section_name;
struct TALER_DenominationPublicKey denom_pub;
struct GNUNET_TIME_Absolute stamp_start;
struct GNUNET_TIME_Absolute stamp_expire_withdraw;
struct GNUNET_TIME_Absolute stamp_expire_deposit;
struct GNUNET_TIME_Absolute stamp_expire_legal;
struct GNUNET_TIME_Timestamp stamp_start;
struct GNUNET_TIME_Timestamp stamp_expire_withdraw;
struct GNUNET_TIME_Timestamp stamp_expire_deposit;
struct GNUNET_TIME_Timestamp stamp_expire_legal;
struct TALER_Amount coin_value;
struct TALER_Amount fee_withdraw;
struct TALER_Amount fee_deposit;
@ -2623,14 +2618,14 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
TALER_JSON_spec_amount ("fee_refund",
currency,
&fee_refund),
GNUNET_JSON_spec_absolute_time ("stamp_start",
&stamp_start),
GNUNET_JSON_spec_absolute_time ("stamp_expire_withdraw",
&stamp_expire_withdraw),
GNUNET_JSON_spec_absolute_time ("stamp_expire_deposit",
&stamp_expire_deposit),
GNUNET_JSON_spec_absolute_time ("stamp_expire_legal",
&stamp_expire_legal),
GNUNET_JSON_spec_timestamp ("stamp_start",
&stamp_start),
GNUNET_JSON_spec_timestamp ("stamp_expire_withdraw",
&stamp_expire_withdraw),
GNUNET_JSON_spec_timestamp ("stamp_expire_deposit",
&stamp_expire_deposit),
GNUNET_JSON_spec_timestamp ("stamp_expire_legal",
&stamp_expire_legal),
GNUNET_JSON_spec_fixed_auto ("denom_secmod_sig",
&secm_sig),
GNUNET_JSON_spec_end ()
@ -2658,8 +2653,9 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
test_shutdown ();
return GNUNET_SYSERR;
}
duration = GNUNET_TIME_absolute_get_difference (stamp_start,
stamp_expire_withdraw);
duration = GNUNET_TIME_absolute_get_difference (
stamp_start.abs_time,
stamp_expire_withdraw.abs_time);
TALER_denom_pub_hash (&denom_pub,
&h_denom_pub);
switch (denom_pub.cipher)
@ -2706,9 +2702,9 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
refresh_fee_s = TALER_amount_to_string (&fee_refresh);
refund_fee_s = TALER_amount_to_string (&fee_refund);
deposit_s = GNUNET_strdup (
GNUNET_STRINGS_absolute_time_to_string (stamp_expire_deposit));
GNUNET_TIME_timestamp2s (stamp_expire_deposit));
legal_s = GNUNET_strdup (
GNUNET_STRINGS_absolute_time_to_string (stamp_expire_legal));
GNUNET_TIME_timestamp2s (stamp_expire_legal));
printf (
"DENOMINATION-KEY(%s) %s of value %s starting at %s "
@ -2716,9 +2712,9 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
section_name,
TALER_B2S (&h_denom_pub),
TALER_amount2s (&coin_value),
GNUNET_STRINGS_absolute_time_to_string (stamp_start),
GNUNET_STRINGS_relative_time_to_string (duration,
GNUNET_NO),
GNUNET_TIME_timestamp2s (stamp_start),
GNUNET_TIME_relative2s (duration,
false),
deposit_s,
legal_s,
withdraw_fee_s,
@ -2929,17 +2925,17 @@ sign_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
unsigned int err_line;
struct TALER_ExchangePublicKeyP exchange_pub;
struct TALER_SecurityModuleSignatureP secm_sig;
struct GNUNET_TIME_Absolute start_time;
struct GNUNET_TIME_Absolute sign_end;
struct GNUNET_TIME_Absolute legal_end;
struct GNUNET_TIME_Timestamp start_time;
struct GNUNET_TIME_Timestamp sign_end;
struct GNUNET_TIME_Timestamp legal_end;
struct GNUNET_TIME_Relative duration;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_absolute_time ("stamp_start",
&start_time),
GNUNET_JSON_spec_absolute_time ("stamp_expire",
&sign_end),
GNUNET_JSON_spec_absolute_time ("stamp_end",
&legal_end),
GNUNET_JSON_spec_timestamp ("stamp_start",
&start_time),
GNUNET_JSON_spec_timestamp ("stamp_expire",
&sign_end),
GNUNET_JSON_spec_timestamp ("stamp_end",
&legal_end),
GNUNET_JSON_spec_fixed_auto ("key",
&exchange_pub),
GNUNET_JSON_spec_fixed_auto ("signkey_secmod_sig",
@ -2966,8 +2962,8 @@ sign_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
return GNUNET_SYSERR;
}
duration = GNUNET_TIME_absolute_get_difference (start_time,
sign_end);
duration = GNUNET_TIME_absolute_get_difference (start_time.abs_time,
sign_end.abs_time);
if (GNUNET_OK !=
TALER_exchange_secmod_eddsa_verify (&exchange_pub,
start_time,
@ -3028,10 +3024,10 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
unsigned int err_line;
const char *section_name;
struct TALER_DenominationPublicKey denom_pub;
struct GNUNET_TIME_Absolute stamp_start;
struct GNUNET_TIME_Absolute stamp_expire_withdraw;
struct GNUNET_TIME_Absolute stamp_expire_deposit;
struct GNUNET_TIME_Absolute stamp_expire_legal;
struct GNUNET_TIME_Timestamp stamp_start;
struct GNUNET_TIME_Timestamp stamp_expire_withdraw;
struct GNUNET_TIME_Timestamp stamp_expire_deposit;
struct GNUNET_TIME_Timestamp stamp_expire_legal;
struct TALER_Amount coin_value;
struct TALER_Amount fee_withdraw;
struct TALER_Amount fee_deposit;
@ -3058,14 +3054,14 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
TALER_JSON_spec_amount ("fee_refund",
currency,
&fee_refund),
GNUNET_JSON_spec_absolute_time ("stamp_start",
&stamp_start),
GNUNET_JSON_spec_absolute_time ("stamp_expire_withdraw",
&stamp_expire_withdraw),
GNUNET_JSON_spec_absolute_time ("stamp_expire_deposit",
&stamp_expire_deposit),
GNUNET_JSON_spec_absolute_time ("stamp_expire_legal",
&stamp_expire_legal),
GNUNET_JSON_spec_timestamp ("stamp_start",
&stamp_start),
GNUNET_JSON_spec_timestamp ("stamp_expire_withdraw",
&stamp_expire_withdraw),
GNUNET_JSON_spec_timestamp ("stamp_expire_deposit",
&stamp_expire_deposit),
GNUNET_JSON_spec_timestamp ("stamp_expire_legal",
&stamp_expire_legal),
GNUNET_JSON_spec_fixed_auto ("denom_secmod_sig",
&secm_sig),
GNUNET_JSON_spec_end ()
@ -3092,8 +3088,9 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
test_shutdown ();
return GNUNET_SYSERR;
}
duration = GNUNET_TIME_absolute_get_difference (stamp_start,
stamp_expire_withdraw);
duration = GNUNET_TIME_absolute_get_difference (
stamp_start.abs_time,
stamp_expire_withdraw.abs_time);
// FIXME-Oec: setup age mask here?
TALER_denom_pub_hash (&denom_pub,
&h_denom_pub);

View File

@ -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,

View File

@ -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,

View File

@ -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 (

View File

@ -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,

View File

@ -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
@ -811,7 +811,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,
@ -888,7 +888,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,
@ -1176,10 +1176,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",
@ -1403,25 +1403,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",
@ -1484,17 +1484,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;
}
@ -1570,7 +1570,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,
@ -1579,12 +1579,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",
@ -1594,8 +1596,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;
}
@ -1616,7 +1618,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)
@ -1626,7 +1628,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);
@ -1634,13 +1636,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;
@ -1663,8 +1665,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 (
@ -1684,8 +1686,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",
@ -1771,7 +1773,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;
@ -1800,7 +1802,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;
@ -1808,8 +1810,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;
@ -1826,7 +1830,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)))
@ -1849,14 +1853,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",
@ -1872,7 +1876,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;
@ -1888,7 +1892,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);
@ -1925,9 +1929,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)
@ -2057,7 +2060,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",
@ -2301,7 +2304,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
*/
@ -2309,12 +2312,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;
}
@ -2324,7 +2331,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;
{
@ -2352,11 +2359,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;
}
}
@ -2388,16 +2395,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)
@ -2433,7 +2440,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,
@ -2456,14 +2463,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,
@ -2572,8 +2578,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)
@ -2614,10 +2621,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;
}
@ -2656,7 +2666,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)
@ -2673,8 +2683,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))
@ -2689,14 +2700,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",
@ -2726,7 +2737,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)
@ -2734,8 +2745,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);
@ -2743,22 +2754,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;

View File

@ -19,7 +19,6 @@
* @author Christian Grothoff
*/
#include "platform.h"
#include <pthread.h>
#include "taler_json_lib.h"
#include "taler_mhd_lib.h"
#include "taler-exchange-httpd_responses.h"

View File

@ -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));
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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 ()
};

View File

@ -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 ()
};

View File

@ -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),

View File

@ -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,

View File

@ -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)),

View File

@ -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");
}

View File

@ -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",

View File

@ -27,7 +27,6 @@
#include <gnunet/gnunet_util_lib.h>
#include <jansson.h>
#include <microhttpd.h>
#include <pthread.h>
#include "taler_error_codes.h"
#include "taler-exchange-httpd.h"
#include "taler-exchange-httpd_db.h"
@ -77,7 +76,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);

View File

@ -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;

View File

@ -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))))
{

View File

@ -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");
}

View File

@ -201,7 +201,7 @@ static unsigned int shard_size = DEFAULT_BATCH_SIZE;
/**
* How many workers should we plan our scheduling with?
*/
static unsigned int max_workers = 16;
static unsigned int max_workers = 0;
/**
@ -338,6 +338,15 @@ static void
run_transfers (void *cls);
static void
run_transfers_delayed (void *cls)
{
(void) cls;
shard->shard_start_time = GNUNET_TIME_absolute_get ();
run_transfers (NULL);
}
/**
* Select shard to process.
*
@ -407,7 +416,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 +651,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,
@ -709,7 +719,7 @@ run_transfers (void *cls)
"No more pending wire transfers, going idle\n");
GNUNET_assert (NULL == task);
task = GNUNET_SCHEDULER_add_delayed (transfer_idle_sleep_interval,
&run_transfers,
&run_transfers_delayed,
NULL);
}
return;
@ -776,8 +786,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);

View File

@ -43,13 +43,13 @@ irbt_cb_table_denominations (struct PostgresClosure *pg,
&td->details.denominations.denom_pub),
GNUNET_PQ_query_param_auto_from_type (
&td->details.denominations.master_sig),
TALER_PQ_query_param_absolute_time (
GNUNET_PQ_query_param_timestamp (
&td->details.denominations.valid_from),
TALER_PQ_query_param_absolute_time (
GNUNET_PQ_query_param_timestamp (
&td->details.denominations.expire_withdraw),
TALER_PQ_query_param_absolute_time (
GNUNET_PQ_query_param_timestamp (
&td->details.denominations.expire_deposit),
TALER_PQ_query_param_absolute_time (
GNUNET_PQ_query_param_timestamp (
&td->details.denominations.expire_legal),
TALER_PQ_query_param_amount (&td->details.denominations.coin),
TALER_PQ_query_param_amount (
@ -144,8 +144,8 @@ irbt_cb_table_reserves (struct PostgresClosure *pg,
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (&td->details.reserves.reserve_pub),
TALER_PQ_query_param_amount (&td->details.reserves.current_balance),
TALER_PQ_query_param_absolute_time (&td->details.reserves.expiration_date),
TALER_PQ_query_param_absolute_time (&td->details.reserves.gc_date),
GNUNET_PQ_query_param_timestamp (&td->details.reserves.expiration_date),
GNUNET_PQ_query_param_timestamp (&td->details.reserves.gc_date),
GNUNET_PQ_query_param_end
};
@ -172,7 +172,7 @@ irbt_cb_table_reserves_in (struct PostgresClosure *pg,
GNUNET_PQ_query_param_uint64 (&td->details.reserves_in.sender_account),
GNUNET_PQ_query_param_string (
td->details.reserves_in.exchange_account_section),
TALER_PQ_query_param_absolute_time (
GNUNET_PQ_query_param_timestamp (
&td->details.reserves_in.execution_date),
GNUNET_PQ_query_param_uint64 (&td->details.reserves_in.reserve_uuid),
GNUNET_PQ_query_param_end
@ -196,7 +196,7 @@ irbt_cb_table_reserves_close (struct PostgresClosure *pg,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
TALER_PQ_query_param_absolute_time (
GNUNET_PQ_query_param_timestamp (
&td->details.reserves_close.execution_date),
GNUNET_PQ_query_param_auto_from_type (
&td->details.reserves_close.wtid),
@ -236,7 +236,7 @@ irbt_cb_table_reserves_out (struct PostgresClosure *pg,
&td->details.reserves_out.reserve_uuid),
GNUNET_PQ_query_param_auto_from_type (
&td->details.reserves_out.reserve_sig),
TALER_PQ_query_param_absolute_time (
GNUNET_PQ_query_param_timestamp (
&td->details.reserves_out.execution_date),
TALER_PQ_query_param_amount (
&td->details.reserves_out.amount_with_fee),
@ -266,7 +266,7 @@ irbt_cb_table_auditors (struct PostgresClosure *pg,
GNUNET_PQ_query_param_string (td->details.auditors.auditor_name),
GNUNET_PQ_query_param_string (td->details.auditors.auditor_url),
GNUNET_PQ_query_param_auto_from_type (&is_active),
GNUNET_PQ_query_param_absolute_time (&td->details.auditors.last_change),
GNUNET_PQ_query_param_timestamp (&td->details.auditors.last_change),
GNUNET_PQ_query_param_end
};
@ -318,11 +318,11 @@ irbt_cb_table_exchange_sign_keys (struct PostgresClosure *pg,
&td->details.exchange_sign_keys.exchange_pub),
GNUNET_PQ_query_param_auto_from_type (
&td->details.exchange_sign_keys.master_sig),
TALER_PQ_query_param_absolute_time (
GNUNET_PQ_query_param_timestamp (
&td->details.exchange_sign_keys.meta.start),
TALER_PQ_query_param_absolute_time (
GNUNET_PQ_query_param_timestamp (
&td->details.exchange_sign_keys.meta.expire_sign),
TALER_PQ_query_param_absolute_time (
GNUNET_PQ_query_param_timestamp (
&td->details.exchange_sign_keys.meta.expire_legal),
GNUNET_PQ_query_param_end
};
@ -503,11 +503,11 @@ irbt_cb_table_deposits (struct PostgresClosure *pg,
GNUNET_PQ_query_param_uint64 (&td->details.deposits.shard),
GNUNET_PQ_query_param_uint64 (&td->details.deposits.known_coin_id),
TALER_PQ_query_param_amount (&td->details.deposits.amount_with_fee),
TALER_PQ_query_param_absolute_time (&td->details.deposits.wallet_timestamp),
TALER_PQ_query_param_absolute_time (
GNUNET_PQ_query_param_timestamp (&td->details.deposits.wallet_timestamp),
GNUNET_PQ_query_param_timestamp (
&td->details.deposits.exchange_timestamp),
TALER_PQ_query_param_absolute_time (&td->details.deposits.refund_deadline),
TALER_PQ_query_param_absolute_time (&td->details.deposits.wire_deadline),
GNUNET_PQ_query_param_timestamp (&td->details.deposits.refund_deadline),
GNUNET_PQ_query_param_timestamp (&td->details.deposits.wire_deadline),
GNUNET_PQ_query_param_auto_from_type (&td->details.deposits.merchant_pub),
GNUNET_PQ_query_param_auto_from_type (
&td->details.deposits.h_contract_terms),
@ -565,7 +565,7 @@ irbt_cb_table_wire_out (struct PostgresClosure *pg,
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
TALER_PQ_query_param_absolute_time (&td->details.wire_out.execution_date),
GNUNET_PQ_query_param_timestamp (&td->details.wire_out.execution_date),
GNUNET_PQ_query_param_auto_from_type (&td->details.wire_out.wtid_raw),
GNUNET_PQ_query_param_uint64 (&td->details.wire_out.wire_target_serial_id),
GNUNET_PQ_query_param_string (
@ -618,8 +618,8 @@ irbt_cb_table_wire_fee (struct PostgresClosure *pg,
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_string (td->details.wire_fee.wire_method),
TALER_PQ_query_param_absolute_time (&td->details.wire_fee.start_date),
TALER_PQ_query_param_absolute_time (&td->details.wire_fee.end_date),
GNUNET_PQ_query_param_timestamp (&td->details.wire_fee.start_date),
GNUNET_PQ_query_param_timestamp (&td->details.wire_fee.end_date),
TALER_PQ_query_param_amount (&td->details.wire_fee.wire_fee),
TALER_PQ_query_param_amount (&td->details.wire_fee.closing_fee),
GNUNET_PQ_query_param_auto_from_type (&td->details.wire_fee.master_sig),
@ -647,7 +647,7 @@ irbt_cb_table_recoup (struct PostgresClosure *pg,
GNUNET_PQ_query_param_auto_from_type (&td->details.recoup.coin_sig),
GNUNET_PQ_query_param_auto_from_type (&td->details.recoup.coin_blind),
TALER_PQ_query_param_amount (&td->details.recoup.amount),
TALER_PQ_query_param_absolute_time (&td->details.recoup.timestamp),
GNUNET_PQ_query_param_timestamp (&td->details.recoup.timestamp),
GNUNET_PQ_query_param_uint64 (&td->details.recoup.known_coin_id),
GNUNET_PQ_query_param_uint64 (&td->details.recoup.reserve_out_serial_id),
GNUNET_PQ_query_param_end
@ -675,7 +675,7 @@ irbt_cb_table_recoup_refresh (struct PostgresClosure *pg,
GNUNET_PQ_query_param_auto_from_type (
&td->details.recoup_refresh.coin_blind),
TALER_PQ_query_param_amount (&td->details.recoup_refresh.amount),
TALER_PQ_query_param_absolute_time (&td->details.recoup_refresh.timestamp),
GNUNET_PQ_query_param_timestamp (&td->details.recoup_refresh.timestamp),
GNUNET_PQ_query_param_uint64 (&td->details.recoup_refresh.known_coin_id),
GNUNET_PQ_query_param_uint64 (&td->details.recoup_refresh.rrc_serial),
GNUNET_PQ_query_param_end

View File

@ -61,18 +61,18 @@ lrbt_cb_table_denominations (void *cls,
GNUNET_PQ_result_spec_auto_from_type (
"master_sig",
&td.details.denominations.master_sig),
TALER_PQ_result_spec_absolute_time (
GNUNET_PQ_result_spec_timestamp (
"valid_from",
&td.details.denominations.valid_from),
TALER_PQ_result_spec_absolute_time (
GNUNET_PQ_result_spec_timestamp (
"expire_withdraw",
&td.details.denominations.
expire_withdraw),
TALER_PQ_result_spec_absolute_time (
GNUNET_PQ_result_spec_timestamp (
"expire_deposit",
&td.details.denominations.
expire_deposit),
TALER_PQ_result_spec_absolute_time (
GNUNET_PQ_result_spec_timestamp (
"expire_legal",
&td.details.denominations.expire_legal),
TALER_PQ_RESULT_SPEC_AMOUNT (
@ -230,10 +230,10 @@ lrbt_cb_table_reserves (void *cls,
&td.details.reserves.reserve_pub),
TALER_PQ_RESULT_SPEC_AMOUNT ("current_balance",
&td.details.reserves.current_balance),
TALER_PQ_result_spec_absolute_time ("expiration_date",
&td.details.reserves.expiration_date),
TALER_PQ_result_spec_absolute_time ("gc_date",
&td.details.reserves.gc_date),
GNUNET_PQ_result_spec_timestamp ("expiration_date",
&td.details.reserves.expiration_date),
GNUNET_PQ_result_spec_timestamp ("gc_date",
&td.details.reserves.gc_date),
GNUNET_PQ_result_spec_end
};
@ -292,7 +292,7 @@ lrbt_cb_table_reserves_in (void *cls,
GNUNET_PQ_result_spec_string (
"exchange_account_section",
&td.details.reserves_in.exchange_account_section),
TALER_PQ_result_spec_absolute_time (
GNUNET_PQ_result_spec_timestamp (
"execution_date",
&td.details.reserves_in.execution_date),
GNUNET_PQ_result_spec_end
@ -341,7 +341,7 @@ lrbt_cb_table_reserves_close (void *cls,
GNUNET_PQ_result_spec_uint64 (
"reserve_uuid",
&td.details.reserves_close.reserve_uuid),
TALER_PQ_result_spec_absolute_time (
GNUNET_PQ_result_spec_timestamp (
"execution_date",
&td.details.reserves_close.execution_date),
GNUNET_PQ_result_spec_auto_from_type (
@ -414,7 +414,7 @@ lrbt_cb_table_reserves_out (void *cls,
GNUNET_PQ_result_spec_auto_from_type (
"reserve_sig",
&td.details.reserves_out.reserve_sig),
TALER_PQ_result_spec_absolute_time (
GNUNET_PQ_result_spec_timestamp (
"execution_date",
&td.details.reserves_out.execution_date),
TALER_PQ_RESULT_SPEC_AMOUNT (
@ -470,8 +470,8 @@ lrbt_cb_table_auditors (void *cls,
&td.details.auditors.auditor_name),
GNUNET_PQ_result_spec_auto_from_type ("is_active",
&is_active8),
TALER_PQ_result_spec_absolute_time ("last_change",
&td.details.auditors.last_change),
GNUNET_PQ_result_spec_timestamp ("last_change",
&td.details.auditors.last_change),
GNUNET_PQ_result_spec_end
};
@ -571,15 +571,15 @@ lrbt_cb_table_exchange_sign_keys (void *cls,
GNUNET_PQ_result_spec_auto_from_type ("master_sig",
&td.details.exchange_sign_keys.
master_sig),
TALER_PQ_result_spec_absolute_time ("valid_from",
&td.details.exchange_sign_keys.meta.
start),
TALER_PQ_result_spec_absolute_time ("expire_sign",
&td.details.exchange_sign_keys.meta.
expire_sign),
TALER_PQ_result_spec_absolute_time ("expire_legal",
&td.details.exchange_sign_keys.meta.
expire_legal),
GNUNET_PQ_result_spec_timestamp ("valid_from",
&td.details.exchange_sign_keys.meta.
start),
GNUNET_PQ_result_spec_timestamp ("expire_sign",
&td.details.exchange_sign_keys.meta.
expire_sign),
GNUNET_PQ_result_spec_timestamp ("expire_legal",
&td.details.exchange_sign_keys.meta.
expire_legal),
GNUNET_PQ_result_spec_end
};
@ -916,16 +916,16 @@ lrbt_cb_table_deposits (void *cls,
TALER_PQ_RESULT_SPEC_AMOUNT (
"amount_with_fee",
&td.details.deposits.amount_with_fee),
TALER_PQ_result_spec_absolute_time (
GNUNET_PQ_result_spec_timestamp (
"wallet_timestamp",
&td.details.deposits.wallet_timestamp),
TALER_PQ_result_spec_absolute_time (
GNUNET_PQ_result_spec_timestamp (
"exchange_timestamp",
&td.details.deposits.exchange_timestamp),
TALER_PQ_result_spec_absolute_time (
GNUNET_PQ_result_spec_timestamp (
"refund_deadline",
&td.details.deposits.refund_deadline),
TALER_PQ_result_spec_absolute_time (
GNUNET_PQ_result_spec_timestamp (
"wire_deadline",
&td.details.deposits.wire_deadline),
GNUNET_PQ_result_spec_auto_from_type (
@ -1054,7 +1054,7 @@ lrbt_cb_table_wire_out (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("serial",
&td.serial),
TALER_PQ_result_spec_absolute_time (
GNUNET_PQ_result_spec_timestamp (
"execution_date",
&td.details.wire_out.execution_date),
GNUNET_PQ_result_spec_auto_from_type (
@ -1161,10 +1161,10 @@ lrbt_cb_table_wire_fee (void *cls,
&td.serial),
GNUNET_PQ_result_spec_string ("wire_method",
&td.details.wire_fee.wire_method),
TALER_PQ_result_spec_absolute_time ("start_date",
&td.details.wire_fee.start_date),
TALER_PQ_result_spec_absolute_time ("end_date",
&td.details.wire_fee.end_date),
GNUNET_PQ_result_spec_timestamp ("start_date",
&td.details.wire_fee.start_date),
GNUNET_PQ_result_spec_timestamp ("end_date",
&td.details.wire_fee.end_date),
TALER_PQ_RESULT_SPEC_AMOUNT ("wire_fee",
&td.details.wire_fee.wire_fee),
TALER_PQ_RESULT_SPEC_AMOUNT ("closing_fee",
@ -1219,8 +1219,8 @@ lrbt_cb_table_recoup (void *cls,
&td.details.recoup.coin_blind),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
&td.details.recoup.amount),
TALER_PQ_result_spec_absolute_time ("timestamp",
&td.details.recoup.timestamp),
GNUNET_PQ_result_spec_timestamp ("timestamp",
&td.details.recoup.timestamp),
GNUNET_PQ_result_spec_uint64 ("known_coin_id",
&td.details.recoup.known_coin_id),
GNUNET_PQ_result_spec_uint64 ("reserve_out_serial_id",
@ -1274,8 +1274,8 @@ lrbt_cb_table_recoup_refresh (void *cls,
&td.details.recoup_refresh.coin_blind),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
&td.details.recoup_refresh.amount),
TALER_PQ_result_spec_absolute_time ("timestamp",
&td.details.recoup_refresh.timestamp),
GNUNET_PQ_result_spec_timestamp ("timestamp",
&td.details.recoup_refresh.timestamp),
GNUNET_PQ_result_spec_uint64 ("known_coin_id",
&td.details.recoup_refresh.known_coin_id),
GNUNET_PQ_result_spec_uint64 ("rrc_serial",

File diff suppressed because it is too large Load Diff

View File

@ -214,7 +214,7 @@ destroy_denom_key_pair (struct DenomKeyPair *dkp)
*/
static struct DenomKeyPair *
create_denom_key_pair (unsigned int size,
struct GNUNET_TIME_Absolute now,
struct GNUNET_TIME_Timestamp now,
const struct TALER_Amount *value,
const struct TALER_Amount *fee_withdraw,
const struct TALER_Amount *fee_deposit,
@ -237,21 +237,24 @@ create_denom_key_pair (unsigned int size,
0,
sizeof (struct TALER_EXCHANGEDB_DenominationKey));
dki.denom_pub = dkp->pub;
GNUNET_TIME_round_abs (&now);
dki.issue.properties.start = GNUNET_TIME_absolute_hton (now);
dki.issue.properties.expire_withdraw = GNUNET_TIME_absolute_hton
(GNUNET_TIME_absolute_add (now,
GNUNET_TIME_UNIT_HOURS));
dki.issue.properties.expire_deposit = GNUNET_TIME_absolute_hton
(GNUNET_TIME_absolute_add
(now,
GNUNET_TIME_relative_multiply (
GNUNET_TIME_UNIT_HOURS, 2)));
dki.issue.properties.expire_legal = GNUNET_TIME_absolute_hton
(GNUNET_TIME_absolute_add
(now,
GNUNET_TIME_relative_multiply (
GNUNET_TIME_UNIT_HOURS, 3)));
dki.issue.properties.start = GNUNET_TIME_timestamp_hton (now);
dki.issue.properties.expire_withdraw = GNUNET_TIME_timestamp_hton
(GNUNET_TIME_absolute_to_timestamp
(GNUNET_TIME_absolute_add (
now.abs_time,
GNUNET_TIME_UNIT_HOURS)));
dki.issue.properties.expire_deposit = GNUNET_TIME_timestamp_hton (
GNUNET_TIME_absolute_to_timestamp
(GNUNET_TIME_absolute_add
(now.abs_time,
GNUNET_TIME_relative_multiply (
GNUNET_TIME_UNIT_HOURS, 2))));
dki.issue.properties.expire_legal = GNUNET_TIME_timestamp_hton (
GNUNET_TIME_absolute_to_timestamp
(GNUNET_TIME_absolute_add
(now.abs_time,
GNUNET_TIME_relative_multiply (
GNUNET_TIME_UNIT_HOURS, 3))));
TALER_amount_hton (&dki.issue.properties.value, value);
TALER_amount_hton (&dki.issue.properties.fee_withdraw, fee_withdraw);
TALER_amount_hton (&dki.issue.properties.fee_deposit, fee_deposit);
@ -506,7 +509,7 @@ test_melting (void)
struct TALER_DenominationPublicKey *new_denom_pubs;
enum GNUNET_GenericReturnValue ret;
enum GNUNET_DB_QueryStatus qs;
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Timestamp now;
ret = GNUNET_SYSERR;
RND_BLK (&refresh_session);
@ -516,8 +519,7 @@ test_melting (void)
/* create and test a refresh session */
refresh_session.noreveal_index = MELT_NOREVEAL_INDEX;
/* create a denomination (value: 1; fraction: 100) */
now = GNUNET_TIME_absolute_get ();
GNUNET_TIME_round_abs (&now);
now = GNUNET_TIME_timestamp_get ();
dkp = create_denom_key_pair (512,
now,
&value,
@ -614,10 +616,9 @@ test_melting (void)
for (unsigned int cnt = 0; cnt < MELT_NEW_COINS; cnt++)
{
struct TALER_EXCHANGEDB_RefreshRevealedCoin *ccoin;
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Timestamp now;
now = GNUNET_TIME_absolute_get ();
GNUNET_TIME_round_abs (&now);
now = GNUNET_TIME_timestamp_get ();
new_dkp[cnt] = create_denom_key_pair (RSA_KEY_SIZE,
now,
&value,
@ -714,7 +715,7 @@ cb_wt_never (void *cls,
uint64_t serial_id,
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,
@ -742,7 +743,7 @@ static struct TALER_CoinSpendPublicKeyP coin_pub_wt;
static struct TALER_Amount coin_value_wt;
static struct TALER_Amount coin_fee_wt;
static struct TALER_Amount transfer_value_wt;
static struct GNUNET_TIME_Absolute wire_out_date;
static struct GNUNET_TIME_Timestamp wire_out_date;
static struct TALER_WireTransferIdentifierRawP wire_out_wtid;
@ -754,7 +755,7 @@ cb_wt_check (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,
@ -768,7 +769,9 @@ cb_wt_check (void *cls,
&merchant_pub_wt));
GNUNET_assert (0 == strcmp (account_payto_uri,
"payto://iban/DE67830654080004822650?receiver-name=Test"));
GNUNET_assert (exec_time.abs_value_us == wire_out_date.abs_value_us);
GNUNET_assert (GNUNET_TIME_timestamp_cmp (exec_time,
==,
wire_out_date));
GNUNET_assert (0 == GNUNET_memcmp (h_contract_terms,
&h_contract_terms_wt));
GNUNET_assert (0 == GNUNET_memcmp (coin_pub,
@ -901,7 +904,7 @@ matching_deposit_cb (void *cls,
static enum GNUNET_GenericReturnValue
audit_deposit_cb (void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute exchange_timestamp,
struct GNUNET_TIME_Timestamp exchange_timestamp,
const struct TALER_EXCHANGEDB_Deposit *deposit,
const struct TALER_DenominationPublicKey *denom_pub,
bool done)
@ -977,7 +980,7 @@ audit_reserve_in_cb (void *cls,
const struct TALER_Amount *credit,
const char *sender_account_details,
uint64_t wire_reference,
struct GNUNET_TIME_Absolute execution_date)
struct GNUNET_TIME_Timestamp execution_date)
{
(void) cls;
(void) rowid;
@ -1011,7 +1014,7 @@ audit_reserve_out_cb (void *cls,
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_ReserveSignatureP *reserve_sig,
struct GNUNET_TIME_Absolute execution_date,
struct GNUNET_TIME_Timestamp execution_date,
const struct TALER_Amount *amount_with_fee)
{
(void) cls;
@ -1036,17 +1039,17 @@ static enum GNUNET_GenericReturnValue
test_gc (void)
{
struct DenomKeyPair *dkp;
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Absolute past;
struct GNUNET_TIME_Timestamp now;
struct GNUNET_TIME_Timestamp past;
struct TALER_EXCHANGEDB_DenominationKeyInformationP issue2;
struct TALER_DenominationHash denom_hash;
now = GNUNET_TIME_absolute_get ();
GNUNET_TIME_round_abs (&now);
past = GNUNET_TIME_absolute_subtract (now,
GNUNET_TIME_relative_multiply (
GNUNET_TIME_UNIT_HOURS,
4));
now = GNUNET_TIME_timestamp_get ();
past = GNUNET_TIME_absolute_to_timestamp (
GNUNET_TIME_absolute_subtract (now.abs_time,
GNUNET_TIME_relative_multiply (
GNUNET_TIME_UNIT_HOURS,
4)));
dkp = create_denom_key_pair (RSA_KEY_SIZE,
past,
&value,
@ -1087,21 +1090,19 @@ test_gc (void)
static enum GNUNET_GenericReturnValue
test_wire_fees (void)
{
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_Amount wire_fee;
struct TALER_Amount closing_fee;
struct TALER_MasterSignatureP master_sig;
struct GNUNET_TIME_Absolute sd;
struct GNUNET_TIME_Absolute ed;
struct GNUNET_TIME_Timestamp sd;
struct GNUNET_TIME_Timestamp ed;
struct TALER_Amount fee;
struct TALER_Amount fee2;
struct TALER_MasterSignatureP ms;
start_date = GNUNET_TIME_absolute_get ();
GNUNET_TIME_round_abs (&start_date);
end_date = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
GNUNET_TIME_round_abs (&end_date);
start_date = GNUNET_TIME_timestamp_get ();
end_date = GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_MINUTES);
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (CURRENCY ":1.424242",
&wire_fee));
@ -1163,8 +1164,12 @@ test_wire_fees (void)
GNUNET_break (0);
return GNUNET_SYSERR;
}
if ( (sd.abs_value_us != start_date.abs_value_us) ||
(ed.abs_value_us != end_date.abs_value_us) ||
if ( (GNUNET_TIME_timestamp_cmp (sd,
!=,
start_date)) ||
(GNUNET_TIME_timestamp_cmp (ed,
!=,
end_date)) ||
(0 != TALER_amount_cmp (&fee,
&wire_fee)) ||
(0 != TALER_amount_cmp (&fee2,
@ -1196,7 +1201,7 @@ static struct TALER_Amount wire_out_amount;
static enum GNUNET_GenericReturnValue
audit_wire_cb (void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute date,
struct GNUNET_TIME_Timestamp date,
const struct TALER_WireTransferIdentifierRawP *wtid,
const char *payto_uri,
const struct TALER_Amount *amount)
@ -1211,7 +1216,9 @@ audit_wire_cb (void *cls,
GNUNET_assert (0 ==
GNUNET_memcmp (wtid,
&wire_out_wtid));
GNUNET_assert (date.abs_value_us == wire_out_date.abs_value_us);
GNUNET_assert (GNUNET_TIME_timestamp_cmp (date,
==,
wire_out_date));
return GNUNET_OK;
}
@ -1228,8 +1235,7 @@ test_wire_out (const struct TALER_EXCHANGEDB_Deposit *deposit)
memset (&wire_out_wtid,
42,
sizeof (wire_out_wtid));
wire_out_date = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&wire_out_date);
wire_out_date = GNUNET_TIME_timestamp_get ();
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (CURRENCY ":1",
&wire_out_amount));
@ -1263,7 +1269,7 @@ test_wire_out (const struct TALER_EXCHANGEDB_Deposit *deposit)
struct TALER_WireTransferIdentifierRawP wtid2;
struct TALER_Amount coin_contribution2;
struct TALER_Amount coin_fee2;
struct GNUNET_TIME_Absolute execution_time2;
struct GNUNET_TIME_Timestamp execution_time2;
struct TALER_EXCHANGEDB_KycStatus kyc;
h_contract_terms_wt2.hash.bits[0]++;
@ -1321,7 +1327,7 @@ test_wire_out (const struct TALER_EXCHANGEDB_Deposit *deposit)
struct TALER_WireTransferIdentifierRawP wtid2;
struct TALER_Amount coin_contribution2;
struct TALER_Amount coin_fee2;
struct GNUNET_TIME_Absolute execution_time2;
struct GNUNET_TIME_Timestamp execution_time2;
struct TALER_EXCHANGEDB_KycStatus kyc;
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
@ -1338,8 +1344,9 @@ test_wire_out (const struct TALER_EXCHANGEDB_Deposit *deposit)
&kyc));
GNUNET_assert (0 == GNUNET_memcmp (&wtid2,
&wire_out_wtid));
GNUNET_assert (execution_time2.abs_value_us ==
wire_out_date.abs_value_us);
GNUNET_assert (GNUNET_TIME_timestamp_cmp (execution_time2,
==,
wire_out_date));
GNUNET_assert (0 == TALER_amount_cmp (&coin_contribution2,
&coin_value_wt));
GNUNET_assert (0 == TALER_amount_cmp (&coin_fee2,
@ -1375,7 +1382,7 @@ drop:
static enum GNUNET_GenericReturnValue
recoup_cb (void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute timestamp,
struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_Amount *amount,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_CoinPublicInfo *coin,
@ -1420,7 +1427,7 @@ wire_missing_cb (void *cls,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *amount,
const char *payto_uri,
struct GNUNET_TIME_Absolute deadline,
struct GNUNET_TIME_Timestamp deadline,
bool tiny,
bool done)
{
@ -1488,7 +1495,7 @@ run (void *cls)
{
struct GNUNET_CONFIGURATION_Handle *cfg = cls;
struct TALER_CoinSpendSignatureP coin_sig;
struct GNUNET_TIME_Absolute deadline;
struct GNUNET_TIME_Timestamp deadline;
union TALER_DenominationBlindingKeyP coin_blind;
struct TALER_ReservePublicKeyP reserve_pub;
struct TALER_ReservePublicKeyP reserve_pub2;
@ -1510,7 +1517,7 @@ run (void *cls)
unsigned int cnt;
uint64_t rr;
enum GNUNET_DB_QueryStatus qs;
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Timestamp now;
struct TALER_WireSalt salt;
union TALER_DenominationBlindingKeyP bks;
struct TALER_CoinPubHash c_hash;
@ -1574,8 +1581,7 @@ run (void *cls)
plugin->get_latest_reserve_in_reference (plugin->cls,
"exchange-account-1",
&rr));
now = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&now);
now = GNUNET_TIME_timestamp_get ();
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->reserves_in_insert (plugin->cls,
&reserve_pub,
@ -1594,8 +1600,7 @@ run (void *cls)
value.value,
value.fraction,
value.currency));
now = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&now);
now = GNUNET_TIME_timestamp_get ();
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->reserves_in_insert (plugin->cls,
&reserve_pub,
@ -1619,8 +1624,7 @@ run (void *cls)
value.fraction * 2,
value.currency));
result = 5;
now = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&now);
now = GNUNET_TIME_timestamp_get ();
dkp = create_denom_key_pair (RSA_KEY_SIZE,
now,
&value,
@ -1727,9 +1731,7 @@ run (void *cls)
&cbc.sig,
&bks,
&dkp->pub));
deadline = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&deadline);
deadline = GNUNET_TIME_timestamp_get ();
FAILIF (TALER_EXCHANGEDB_CKS_ADDED !=
plugin->ensure_coin_known (plugin->cls,
&deposit.coin));
@ -1779,8 +1781,7 @@ run (void *cls)
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (CURRENCY ":0.000010",
&fee_closing));
now = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&now);
now = GNUNET_TIME_timestamp_get ();
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->insert_reserve_closed (plugin->cls,
&reserve_pub,
@ -1917,12 +1918,11 @@ run (void *cls)
plugin->ensure_coin_known (plugin->cls,
&deposit.coin));
{
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Absolute r;
struct GNUNET_TIME_Timestamp now;
struct GNUNET_TIME_Timestamp r;
struct TALER_Amount deposit_fee;
now = GNUNET_TIME_absolute_get ();
GNUNET_TIME_round_abs (&now);
now = GNUNET_TIME_timestamp_get ();
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->insert_deposit (plugin->cls,
now,
@ -1932,16 +1932,20 @@ run (void *cls)
&deposit,
&deposit_fee,
&r));
FAILIF (now.abs_value_us != r.abs_value_us);
FAILIF (GNUNET_TIME_timestamp_cmp (now,
!=,
r));
}
{
struct GNUNET_TIME_Absolute start_range;
struct GNUNET_TIME_Absolute end_range;
struct GNUNET_TIME_Timestamp start_range;
struct GNUNET_TIME_Timestamp end_range;
start_range = GNUNET_TIME_absolute_subtract (deadline,
GNUNET_TIME_UNIT_SECONDS);
end_range = GNUNET_TIME_absolute_add (deadline,
GNUNET_TIME_UNIT_SECONDS);
start_range = GNUNET_TIME_absolute_to_timestamp (
GNUNET_TIME_absolute_subtract (deadline.abs_time,
GNUNET_TIME_UNIT_SECONDS));
end_range = GNUNET_TIME_absolute_to_timestamp (
GNUNET_TIME_absolute_add (deadline.abs_time,
GNUNET_TIME_UNIT_SECONDS));
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->select_deposits_missing_wire (plugin->cls,
start_range,
@ -2012,7 +2016,7 @@ run (void *cls)
"test-2"));
RND_BLK (&deposit2.merchant_pub); /* should fail if merchant is different */
{
struct GNUNET_TIME_Absolute r;
struct GNUNET_TIME_Timestamp r;
struct TALER_Amount deposit_fee;
FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
@ -2140,11 +2144,15 @@ run (void *cls)
FAILIF (0 !=
GNUNET_memcmp (&have->wire_salt,
&deposit.wire_salt));
FAILIF (have->timestamp.abs_value_us != deposit.timestamp.abs_value_us);
FAILIF (have->refund_deadline.abs_value_us !=
deposit.refund_deadline.abs_value_us);
FAILIF (have->wire_deadline.abs_value_us !=
deposit.wire_deadline.abs_value_us);
FAILIF (GNUNET_TIME_timestamp_cmp (have->timestamp,
!=,
deposit.timestamp));
FAILIF (GNUNET_TIME_timestamp_cmp (have->refund_deadline,
!=,
deposit.refund_deadline));
FAILIF (GNUNET_TIME_timestamp_cmp (have->wire_deadline,
!=,
deposit.wire_deadline));
FAILIF (0 != TALER_amount_cmp (&have->amount_with_fee,
&deposit.amount_with_fee));
FAILIF (0 != TALER_amount_cmp (&have->deposit_fee,

View File

@ -259,18 +259,18 @@ TALER_AUDITOR_deposit_confirmation (
const struct TALER_MerchantWireHash *h_wire,
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_PrivateContractHash *h_contract_terms,
struct GNUNET_TIME_Absolute timestamp,
struct GNUNET_TIME_Absolute wire_deadline,
struct GNUNET_TIME_Absolute refund_deadline,
struct GNUNET_TIME_Timestamp timestamp,
struct GNUNET_TIME_Timestamp wire_deadline,
struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_Amount *amount_without_fee,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_ExchangePublicKeyP *exchange_pub,
const struct TALER_ExchangeSignatureP *exchange_sig,
const struct TALER_MasterPublicKeyP *master_pub,
struct GNUNET_TIME_Absolute ep_start,
struct GNUNET_TIME_Absolute ep_expire,
struct GNUNET_TIME_Absolute ep_end,
struct GNUNET_TIME_Timestamp ep_start,
struct GNUNET_TIME_Timestamp ep_expire,
struct GNUNET_TIME_Timestamp ep_end,
const struct TALER_MasterSignatureP *master_sig,
TALER_AUDITOR_DepositConfirmationResultCallback cb,
void *cb_cls);

View File

@ -63,7 +63,7 @@ typedef enum GNUNET_GenericReturnValue
(*TALER_AUDITORDB_HistoricDenominationRevenueDataCallback)(
void *cls,
const struct TALER_DenominationHash *denom_pub_hash,
struct GNUNET_TIME_Absolute revenue_timestamp,
struct GNUNET_TIME_Timestamp revenue_timestamp,
const struct TALER_Amount *revenue_balance,
const struct TALER_Amount *loss_balance);
@ -84,8 +84,8 @@ typedef enum GNUNET_GenericReturnValue
typedef enum GNUNET_GenericReturnValue
(*TALER_AUDITORDB_HistoricReserveRevenueDataCallback)(
void *cls,
struct GNUNET_TIME_Absolute start_time,
struct GNUNET_TIME_Absolute end_time,
struct GNUNET_TIME_Timestamp start_time,
struct GNUNET_TIME_Timestamp end_time,
const struct TALER_Amount *reserve_profits);
@ -100,7 +100,7 @@ struct TALER_AUDITORDB_WireProgressPoint
* Time until which we have confirmed that all wire transactions
* that the exchange should do, have indeed been done.
*/
struct GNUNET_TIME_Absolute last_timestamp;
struct GNUNET_TIME_Timestamp last_timestamp;
/**
* reserves_close uuid until which we have checked
@ -240,17 +240,17 @@ struct TALER_AUDITORDB_ExchangeSigningKey
/**
* When does @e exchange_pub start to be used?
*/
struct GNUNET_TIME_Absolute ep_start;
struct GNUNET_TIME_Timestamp ep_start;
/**
* When will the exchange stop signing with @e exchange_pub?
*/
struct GNUNET_TIME_Absolute ep_expire;
struct GNUNET_TIME_Timestamp ep_expire;
/**
* When does the signing key expire (for legal disputes)?
*/
struct GNUNET_TIME_Absolute ep_end;
struct GNUNET_TIME_Timestamp ep_end;
/**
* What is the public offline signing key this is all about?
@ -289,7 +289,7 @@ struct TALER_AUDITORDB_DepositConfirmation
/**
* Time when this deposit confirmation was generated by the exchange.
*/
struct GNUNET_TIME_Absolute exchange_timestamp;
struct GNUNET_TIME_Timestamp exchange_timestamp;
/**
* How much time does the @e merchant have to issue a refund
@ -298,12 +298,12 @@ struct TALER_AUDITORDB_DepositConfirmation
* performed by the exchange until the refund deadline. This value
* is taken from the original deposit request.
*/
struct GNUNET_TIME_Absolute refund_deadline;
struct GNUNET_TIME_Timestamp refund_deadline;
/**
* How much time does the @e exchange have to wire the funds?
*/
struct GNUNET_TIME_Absolute wire_deadline;
struct GNUNET_TIME_Timestamp wire_deadline;
/**
* Amount to be deposited, excluding fee. Calculated from the
@ -872,7 +872,7 @@ struct TALER_AUDITORDB_Plugin
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_Amount *reserve_balance,
const struct TALER_Amount *withdraw_fee_balance,
struct GNUNET_TIME_Absolute expiration_date,
struct GNUNET_TIME_Timestamp expiration_date,
const char *origin_account);
@ -895,7 +895,7 @@ struct TALER_AUDITORDB_Plugin
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_Amount *reserve_balance,
const struct TALER_Amount *withdraw_fee_balance,
struct GNUNET_TIME_Absolute expiration_date);
struct GNUNET_TIME_Timestamp expiration_date);
/**
@ -919,7 +919,7 @@ struct TALER_AUDITORDB_Plugin
uint64_t *rowid,
struct TALER_Amount *reserve_balance,
struct TALER_Amount *withdraw_fee_balance,
struct GNUNET_TIME_Absolute *expiration_date,
struct GNUNET_TIME_Timestamp *expiration_date,
char **sender_account);
@ -1220,7 +1220,7 @@ struct TALER_AUDITORDB_Plugin
void *cls,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_DenominationHash *denom_pub_hash,
struct GNUNET_TIME_Absolute revenue_timestamp,
struct GNUNET_TIME_Timestamp revenue_timestamp,
const struct TALER_Amount *revenue_balance,
const struct TALER_Amount *recoup_loss_balance);
@ -1257,8 +1257,8 @@ struct TALER_AUDITORDB_Plugin
(*insert_historic_reserve_revenue)(
void *cls,
const struct TALER_MasterPublicKeyP *master_pub,
struct GNUNET_TIME_Absolute start_time,
struct GNUNET_TIME_Absolute end_time,
struct GNUNET_TIME_Timestamp start_time,
struct GNUNET_TIME_Timestamp end_time,
const struct TALER_Amount *reserve_profits);

View File

@ -112,12 +112,13 @@ struct TALER_BANK_AdminAddIncomingHandle;
* @param json detailed response from the HTTPD, or NULL if reply was not in JSON
*/
typedef void
(*TALER_BANK_AdminAddIncomingCallback) (void *cls,
unsigned int http_status,
enum TALER_ErrorCode ec,
uint64_t serial_id,
struct GNUNET_TIME_Absolute timestamp,
const json_t *json);
(*TALER_BANK_AdminAddIncomingCallback) (
void *cls,
unsigned int http_status,
enum TALER_ErrorCode ec,
uint64_t serial_id,
struct GNUNET_TIME_Timestamp timestamp,
const json_t *json);
/**
@ -199,11 +200,12 @@ struct TALER_BANK_TransferHandle;
* @param timestamp when did the transaction go into effect
*/
typedef void
(*TALER_BANK_TransferCallback)(void *cls,
unsigned int response_code,
enum TALER_ErrorCode ec,
uint64_t row_id,
struct GNUNET_TIME_Absolute timestamp);
(*TALER_BANK_TransferCallback)(
void *cls,
unsigned int response_code,
enum TALER_ErrorCode ec,
uint64_t row_id,
struct GNUNET_TIME_Timestamp timestamp);
/**
@ -266,7 +268,7 @@ struct TALER_BANK_CreditDetails
/**
* Time of the the transfer
*/
struct GNUNET_TIME_Absolute execution_date;
struct GNUNET_TIME_Timestamp execution_date;
/**
* Reserve public key encoded in the wire
@ -332,13 +334,14 @@ typedef enum GNUNET_GenericReturnValue
* In this case, the callback is not called.
*/
struct TALER_BANK_CreditHistoryHandle *
TALER_BANK_credit_history (struct GNUNET_CURL_Context *ctx,
const struct TALER_BANK_AuthenticationData *auth,
uint64_t start_row,
int64_t num_results,
struct GNUNET_TIME_Relative timeout,
TALER_BANK_CreditHistoryCallback hres_cb,
void *hres_cb_cls);
TALER_BANK_credit_history (
struct GNUNET_CURL_Context *ctx,
const struct TALER_BANK_AuthenticationData *auth,
uint64_t start_row,
int64_t num_results,
struct GNUNET_TIME_Relative timeout,
TALER_BANK_CreditHistoryCallback hres_cb,
void *hres_cb_cls);
/**
@ -374,7 +377,7 @@ struct TALER_BANK_DebitDetails
/**
* Time of the the transfer
*/
struct GNUNET_TIME_Absolute execution_date;
struct GNUNET_TIME_Timestamp execution_date;
/**
* Wire transfer identifier used by the exchange.
@ -477,7 +480,7 @@ TALER_BANK_debit_history_cancel (struct TALER_BANK_DebitHistoryHandle *hh);
* @param[out] auth set to the configuration data found
* @return #GNUNET_OK on success
*/
int
enum GNUNET_GenericReturnValue
TALER_BANK_auth_parse_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *section,
struct TALER_BANK_AuthenticationData *auth);

View File

@ -1367,7 +1367,7 @@ typedef void
(*TALER_CRYPTO_RsaDenominationKeyStatusCallback)(
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,
@ -1484,7 +1484,7 @@ struct TALER_CRYPTO_ExchangeSignHelper;
typedef void
(*TALER_CRYPTO_ExchangeKeyStatusCallback)(
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,
@ -1625,9 +1625,9 @@ TALER_exchange_deposit_confirm_verify (
const struct TALER_PrivateContractHash *h_contract_terms,
const struct TALER_MerchantWireHash *h_wire,
const struct TALER_ExtensionContractHash *h_extensions,
struct GNUNET_TIME_Absolute exchange_timestamp,
struct GNUNET_TIME_Absolute wire_deadline,
struct GNUNET_TIME_Absolute refund_deadline,
struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Timestamp wire_deadline,
struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_Amount *amount_without_fee,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant_pub,
@ -1661,9 +1661,9 @@ TALER_wallet_deposit_sign (
const struct TALER_PrivateContractHash *h_contract_terms,
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_DenominationHash *h_denom_pub,
struct GNUNET_TIME_Absolute wallet_timestamp,
struct GNUNET_TIME_Timestamp wallet_timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
struct GNUNET_TIME_Absolute refund_deadline,
struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_CoinSpendPrivateKeyP *coin_priv,
struct TALER_CoinSpendSignatureP *coin_sig);
@ -1692,9 +1692,9 @@ TALER_wallet_deposit_verify (
const struct TALER_PrivateContractHash *h_contract_terms,
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_DenominationHash *h_denom_pub,
struct GNUNET_TIME_Absolute wallet_timestamp,
struct GNUNET_TIME_Timestamp wallet_timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
struct GNUNET_TIME_Absolute refund_deadline,
struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_CoinSpendSignatureP *coin_sig);
@ -1754,7 +1754,7 @@ void
TALER_exchange_offline_auditor_add_sign (
const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url,
struct GNUNET_TIME_Absolute start_date,
struct GNUNET_TIME_Timestamp start_date,
const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig);
@ -1773,7 +1773,7 @@ enum GNUNET_GenericReturnValue
TALER_exchange_offline_auditor_add_verify (
const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url,
struct GNUNET_TIME_Absolute start_date,
struct GNUNET_TIME_Timestamp start_date,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig);
@ -1789,7 +1789,7 @@ TALER_exchange_offline_auditor_add_verify (
void
TALER_exchange_offline_auditor_del_sign (
const struct TALER_AuditorPublicKeyP *auditor_pub,
struct GNUNET_TIME_Absolute end_date,
struct GNUNET_TIME_Timestamp end_date,
const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig);
@ -1806,7 +1806,7 @@ TALER_exchange_offline_auditor_del_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_offline_auditor_del_verify (
const struct TALER_AuditorPublicKeyP *auditor_pub,
struct GNUNET_TIME_Absolute end_date,
struct GNUNET_TIME_Timestamp end_date,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig);
@ -1882,9 +1882,9 @@ TALER_exchange_offline_signkey_revoke_verify (
void
TALER_exchange_offline_signkey_validity_sign (
const struct TALER_ExchangePublicKeyP *exchange_pub,
struct GNUNET_TIME_Absolute start_sign,
struct GNUNET_TIME_Absolute end_sign,
struct GNUNET_TIME_Absolute end_legal,
struct GNUNET_TIME_Timestamp start_sign,
struct GNUNET_TIME_Timestamp end_sign,
struct GNUNET_TIME_Timestamp end_legal,
const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig);
@ -1903,9 +1903,9 @@ TALER_exchange_offline_signkey_validity_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_offline_signkey_validity_verify (
const struct TALER_ExchangePublicKeyP *exchange_pub,
struct GNUNET_TIME_Absolute start_sign,
struct GNUNET_TIME_Absolute end_sign,
struct GNUNET_TIME_Absolute end_legal,
struct GNUNET_TIME_Timestamp start_sign,
struct GNUNET_TIME_Timestamp end_sign,
struct GNUNET_TIME_Timestamp end_legal,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig);
@ -1929,10 +1929,10 @@ TALER_exchange_offline_signkey_validity_verify (
void
TALER_exchange_offline_denom_validity_sign (
const struct TALER_DenominationHash *h_denom_pub,
struct GNUNET_TIME_Absolute stamp_start,
struct GNUNET_TIME_Absolute stamp_expire_withdraw,
struct GNUNET_TIME_Absolute stamp_expire_deposit,
struct GNUNET_TIME_Absolute stamp_expire_legal,
struct GNUNET_TIME_Timestamp stamp_start,
struct GNUNET_TIME_Timestamp stamp_expire_withdraw,
struct GNUNET_TIME_Timestamp stamp_expire_deposit,
struct GNUNET_TIME_Timestamp stamp_expire_legal,
const struct TALER_Amount *coin_value,
const struct TALER_Amount *fee_withdraw,
const struct TALER_Amount *fee_deposit,
@ -1962,10 +1962,10 @@ TALER_exchange_offline_denom_validity_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_offline_denom_validity_verify (
const struct TALER_DenominationHash *h_denom_pub,
struct GNUNET_TIME_Absolute stamp_start,
struct GNUNET_TIME_Absolute stamp_expire_withdraw,
struct GNUNET_TIME_Absolute stamp_expire_deposit,
struct GNUNET_TIME_Absolute stamp_expire_legal,
struct GNUNET_TIME_Timestamp stamp_start,
struct GNUNET_TIME_Timestamp stamp_expire_withdraw,
struct GNUNET_TIME_Timestamp stamp_expire_deposit,
struct GNUNET_TIME_Timestamp stamp_expire_legal,
const struct TALER_Amount *coin_value,
const struct TALER_Amount *fee_withdraw,
const struct TALER_Amount *fee_deposit,
@ -1987,7 +1987,7 @@ TALER_exchange_offline_denom_validity_verify (
void
TALER_exchange_secmod_eddsa_sign (
const struct TALER_ExchangePublicKeyP *exchange_pub,
struct GNUNET_TIME_Absolute start_sign,
struct GNUNET_TIME_Timestamp start_sign,
struct GNUNET_TIME_Relative duration,
const struct TALER_SecurityModulePrivateKeyP *secm_priv,
struct TALER_SecurityModuleSignatureP *secm_sig);
@ -2006,7 +2006,7 @@ TALER_exchange_secmod_eddsa_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_secmod_eddsa_verify (
const struct TALER_ExchangePublicKeyP *exchange_pub,
struct GNUNET_TIME_Absolute start_sign,
struct GNUNET_TIME_Timestamp start_sign,
struct GNUNET_TIME_Relative duration,
const struct TALER_SecurityModulePublicKeyP *secm_pub,
const struct TALER_SecurityModuleSignatureP *secm_sig);
@ -2026,7 +2026,7 @@ void
TALER_exchange_secmod_rsa_sign (
const struct TALER_RsaPubHashP *h_rsa,
const char *section_name,
struct GNUNET_TIME_Absolute start_sign,
struct GNUNET_TIME_Timestamp start_sign,
struct GNUNET_TIME_Relative duration,
const struct TALER_SecurityModulePrivateKeyP *secm_priv,
struct TALER_SecurityModuleSignatureP *secm_sig);
@ -2047,7 +2047,7 @@ enum GNUNET_GenericReturnValue
TALER_exchange_secmod_rsa_verify (
const struct TALER_RsaPubHashP *h_rsa,
const char *section_name,
struct GNUNET_TIME_Absolute start_sign,
struct GNUNET_TIME_Timestamp start_sign,
struct GNUNET_TIME_Relative duration,
const struct TALER_SecurityModulePublicKeyP *secm_pub,
const struct TALER_SecurityModuleSignatureP *secm_sig);
@ -2076,10 +2076,10 @@ TALER_auditor_denom_validity_sign (
const char *auditor_url,
const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_MasterPublicKeyP *master_pub,
struct GNUNET_TIME_Absolute stamp_start,
struct GNUNET_TIME_Absolute stamp_expire_withdraw,
struct GNUNET_TIME_Absolute stamp_expire_deposit,
struct GNUNET_TIME_Absolute stamp_expire_legal,
struct GNUNET_TIME_Timestamp stamp_start,
struct GNUNET_TIME_Timestamp stamp_expire_withdraw,
struct GNUNET_TIME_Timestamp stamp_expire_deposit,
struct GNUNET_TIME_Timestamp stamp_expire_legal,
const struct TALER_Amount *coin_value,
const struct TALER_Amount *fee_withdraw,
const struct TALER_Amount *fee_deposit,
@ -2113,10 +2113,10 @@ TALER_auditor_denom_validity_verify (
const char *auditor_url,
const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_MasterPublicKeyP *master_pub,
struct GNUNET_TIME_Absolute stamp_start,
struct GNUNET_TIME_Absolute stamp_expire_withdraw,
struct GNUNET_TIME_Absolute stamp_expire_deposit,
struct GNUNET_TIME_Absolute stamp_expire_legal,
struct GNUNET_TIME_Timestamp stamp_start,
struct GNUNET_TIME_Timestamp stamp_expire_withdraw,
struct GNUNET_TIME_Timestamp stamp_expire_deposit,
struct GNUNET_TIME_Timestamp stamp_expire_legal,
const struct TALER_Amount *coin_value,
const struct TALER_Amount *fee_withdraw,
const struct TALER_Amount *fee_deposit,
@ -2143,8 +2143,8 @@ TALER_auditor_denom_validity_verify (
void
TALER_exchange_offline_wire_fee_sign (
const char *payment_method,
struct GNUNET_TIME_Absolute start_time,
struct GNUNET_TIME_Absolute end_time,
struct GNUNET_TIME_Timestamp start_time,
struct GNUNET_TIME_Timestamp end_time,
const struct TALER_Amount *wire_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_MasterPrivateKeyP *master_priv,
@ -2166,8 +2166,8 @@ TALER_exchange_offline_wire_fee_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_offline_wire_fee_verify (
const char *payment_method,
struct GNUNET_TIME_Absolute start_time,
struct GNUNET_TIME_Absolute end_time,
struct GNUNET_TIME_Timestamp start_time,
struct GNUNET_TIME_Timestamp end_time,
const struct TALER_Amount *wire_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_MasterPublicKeyP *master_pub,
@ -2185,7 +2185,7 @@ TALER_exchange_offline_wire_fee_verify (
void
TALER_exchange_offline_wire_add_sign (
const char *payto_uri,
struct GNUNET_TIME_Absolute now,
struct GNUNET_TIME_Timestamp now,
const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig);
@ -2202,7 +2202,7 @@ TALER_exchange_offline_wire_add_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_offline_wire_add_verify (
const char *payto_uri,
struct GNUNET_TIME_Absolute sign_time,
struct GNUNET_TIME_Timestamp sign_time,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig);
@ -2218,7 +2218,7 @@ TALER_exchange_offline_wire_add_verify (
void
TALER_exchange_offline_wire_del_sign (
const char *payto_uri,
struct GNUNET_TIME_Absolute now,
struct GNUNET_TIME_Timestamp now,
const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig);
@ -2235,7 +2235,7 @@ TALER_exchange_offline_wire_del_sign (
enum GNUNET_GenericReturnValue
TALER_exchange_offline_wire_del_verify (
const char *payto_uri,
struct GNUNET_TIME_Absolute sign_time,
struct GNUNET_TIME_Timestamp sign_time,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig);

View File

@ -70,17 +70,17 @@ struct TALER_EXCHANGE_SigningPublicKey
/**
* Validity start time
*/
struct GNUNET_TIME_Absolute valid_from;
struct GNUNET_TIME_Timestamp valid_from;
/**
* Validity expiration time (how long the exchange may use it).
*/
struct GNUNET_TIME_Absolute valid_until;
struct GNUNET_TIME_Timestamp valid_until;
/**
* Validity expiration time for legal disputes.
*/
struct GNUNET_TIME_Absolute valid_legal;
struct GNUNET_TIME_Timestamp valid_legal;
};
@ -107,18 +107,18 @@ struct TALER_EXCHANGE_DenomPublicKey
/**
* Timestamp indicating when the denomination key becomes valid
*/
struct GNUNET_TIME_Absolute valid_from;
struct GNUNET_TIME_Timestamp valid_from;
/**
* Timestamp indicating when the denomination key cant be used anymore to
* withdraw new coins.
*/
struct GNUNET_TIME_Absolute withdraw_valid_until;
struct GNUNET_TIME_Timestamp withdraw_valid_until;
/**
* Timestamp indicating when coins of this denomination become invalid.
*/
struct GNUNET_TIME_Absolute expire_deposit;
struct GNUNET_TIME_Timestamp expire_deposit;
/**
* When do signatures with this denomination key become invalid?
@ -127,7 +127,7 @@ struct TALER_EXCHANGE_DenomPublicKey
* of the evidence. @e expire_legal is expected to be significantly
* larger than @e expire_deposit (by a year or more).
*/
struct GNUNET_TIME_Absolute expire_legal;
struct GNUNET_TIME_Timestamp expire_legal;
/**
* The value of this denomination
@ -273,14 +273,14 @@ struct TALER_EXCHANGE_Keys
/**
* Timestamp indicating the /keys generation.
*/
struct GNUNET_TIME_Absolute list_issue_date;
struct GNUNET_TIME_Timestamp list_issue_date;
/**
* Timestamp indicating the creation time of the last
* denomination key in /keys.
* Used to fetch /keys incrementally.
*/
struct GNUNET_TIME_Absolute last_denom_issue_date;
struct GNUNET_TIME_Timestamp last_denom_issue_date;
/**
* Length of the @e sign_keys array (number of valid entries).
@ -491,7 +491,7 @@ TALER_EXCHANGE_get_keys (struct TALER_EXCHANGE_Handle *exchange);
*/
void
TALER_EXCHANGE_set_last_denom (struct TALER_EXCHANGE_Handle *exchange,
struct GNUNET_TIME_Absolute last_denom_new);
struct GNUNET_TIME_Timestamp last_denom_new);
/**
@ -535,7 +535,7 @@ enum TALER_EXCHANGE_CheckKeysFlags
* @param flags options controlling when to download what
* @return until when the existing response is current, 0 if we are re-downloading now
*/
struct GNUNET_TIME_Absolute
struct GNUNET_TIME_Timestamp
TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange,
enum TALER_EXCHANGE_CheckKeysFlags flags);
@ -663,12 +663,12 @@ struct TALER_EXCHANGE_WireAggregateFees
/**
* Time when this fee goes into effect (inclusive)
*/
struct GNUNET_TIME_Absolute start_date;
struct GNUNET_TIME_Timestamp start_date;
/**
* Time when this fee stops being in effect (exclusive).
*/
struct GNUNET_TIME_Absolute end_date;
struct GNUNET_TIME_Timestamp end_date;
/**
* Signature affirming the above fee structure.
@ -789,9 +789,9 @@ TALER_EXCHANGE_deposit_permission_sign (
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_CoinSpendPrivateKeyP *coin_priv,
struct GNUNET_TIME_Absolute wallet_timestamp,
struct GNUNET_TIME_Timestamp wallet_timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
struct GNUNET_TIME_Absolute refund_deadline,
struct GNUNET_TIME_Timestamp refund_deadline,
struct TALER_CoinSpendSignatureP *coin_sig);
@ -824,7 +824,7 @@ struct TALER_EXCHANGE_DepositResult
/**
* Time when the exchange generated the deposit confirmation
*/
struct GNUNET_TIME_Absolute deposit_timestamp;
struct GNUNET_TIME_Timestamp deposit_timestamp;
/**
* signature provided by the exchange
@ -910,7 +910,7 @@ struct TALER_EXCHANGE_DepositHandle *
TALER_EXCHANGE_deposit (
struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_Amount *amount,
struct GNUNET_TIME_Absolute wire_deadline,
struct GNUNET_TIME_Timestamp wire_deadline,
const char *merchant_payto_uri,
const struct TALER_WireSalt *wire_salt,
const struct TALER_PrivateContractHash *h_contract_terms,
@ -918,9 +918,9 @@ TALER_EXCHANGE_deposit (
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_DenominationSignature *denom_sig,
const struct TALER_DenominationPublicKey *denom_pub,
struct GNUNET_TIME_Absolute timestamp,
struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
struct GNUNET_TIME_Absolute refund_deadline,
struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_CoinSpendSignatureP *coin_sig,
TALER_EXCHANGE_DepositResultCallback cb,
void *cb_cls,
@ -1102,7 +1102,7 @@ struct TALER_EXCHANGE_ReserveHistory
/**
* When did the wire transfer happen?
*/
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Timestamp timestamp;
} in_details;
@ -1149,7 +1149,7 @@ struct TALER_EXCHANGE_ReserveHistory
/**
* When did the /recoup operation happen?
*/
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Timestamp timestamp;
} recoup_details;
@ -1183,7 +1183,7 @@ struct TALER_EXCHANGE_ReserveHistory
/**
* When did the wire transfer happen?
*/
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Timestamp timestamp;
/**
* Fee that was charged for the closing.
@ -1716,7 +1716,7 @@ struct TALER_EXCHANGE_TransferData
/**
* time when the exchange claims to have performed the wire transfer
*/
struct GNUNET_TIME_Absolute execution_time;
struct GNUNET_TIME_Timestamp execution_time;
/**
* Actual amount of the wire transfer, excluding the wire fee.
@ -1837,7 +1837,7 @@ struct TALER_EXCHANGE_GetDepositResponse
/**
* actual execution time for the wire transfer
*/
struct GNUNET_TIME_Absolute execution_time;
struct GNUNET_TIME_Timestamp execution_time;
/**
* contribution to the total amount by this coin, all zeros if exchange did not
@ -1861,7 +1861,7 @@ struct TALER_EXCHANGE_GetDepositResponse
/**
* planned execution time for the wire transfer
*/
struct GNUNET_TIME_Absolute execution_time;
struct GNUNET_TIME_Timestamp execution_time;
/**
* Payment target that the merchant should use
@ -2029,6 +2029,7 @@ typedef void
* @param pk kind of coin to pay back
* @param denom_sig signature over the coin by the exchange using @a pk
* @param ps secret internals of the original planchet
* @param amount value remaining on the coin that is being recouped
* @param was_refreshed true if the coin in @a ps was refreshed
* @param recoup_cb the callback to call when the final result for this request is available
* @param recoup_cb_cls closure for @a recoup_cb
@ -2041,6 +2042,7 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_EXCHANGE_DenomPublicKey *pk,
const struct TALER_DenominationSignature *denom_sig,
const struct TALER_PlanchetSecretsP *ps,
const struct TALER_Amount *amount,
bool was_refreshed,
TALER_EXCHANGE_RecoupResultCallback recoup_cb,
void *recoup_cb_cls);
@ -2091,7 +2093,7 @@ struct TALER_EXCHANGE_KycStatus
/**
* Time of the affirmation.
*/
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Timestamp timestamp;
/**
* The signing public key used for @e exchange_sig.
@ -2327,17 +2329,17 @@ struct TALER_EXCHANGE_FutureSigningPublicKey
/**
* Validity start time
*/
struct GNUNET_TIME_Absolute valid_from;
struct GNUNET_TIME_Timestamp valid_from;
/**
* Validity expiration time (how long the exchange may use it).
*/
struct GNUNET_TIME_Absolute valid_until;
struct GNUNET_TIME_Timestamp valid_until;
/**
* Validity expiration time for legal disputes.
*/
struct GNUNET_TIME_Absolute valid_legal;
struct GNUNET_TIME_Timestamp valid_legal;
};
@ -2359,18 +2361,18 @@ struct TALER_EXCHANGE_FutureDenomPublicKey
/**
* Timestamp indicating when the denomination key becomes valid
*/
struct GNUNET_TIME_Absolute valid_from;
struct GNUNET_TIME_Timestamp valid_from;
/**
* Timestamp indicating when the denomination key cant be used anymore to
* withdraw new coins.
*/
struct GNUNET_TIME_Absolute withdraw_valid_until;
struct GNUNET_TIME_Timestamp withdraw_valid_until;
/**
* Timestamp indicating when coins of this denomination become invalid.
*/
struct GNUNET_TIME_Absolute expire_deposit;
struct GNUNET_TIME_Timestamp expire_deposit;
/**
* When do signatures with this denomination key become invalid?
@ -2379,7 +2381,7 @@ struct TALER_EXCHANGE_FutureDenomPublicKey
* of the evidence. @e expire_legal is expected to be significantly
* larger than @e expire_deposit (by a year or more).
*/
struct GNUNET_TIME_Absolute expire_legal;
struct GNUNET_TIME_Timestamp expire_legal;
/**
* The value of this denomination
@ -2806,7 +2808,7 @@ TALER_EXCHANGE_management_enable_auditor (
const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url,
const char *auditor_name,
struct GNUNET_TIME_Absolute validity_start,
struct GNUNET_TIME_Timestamp validity_start,
const struct TALER_MasterSignatureP *master_sig,
TALER_EXCHANGE_ManagementAuditorEnableCallback cb,
void *cb_cls);
@ -2857,7 +2859,7 @@ TALER_EXCHANGE_management_disable_auditor (
struct GNUNET_CURL_Context *ctx,
const char *url,
const struct TALER_AuditorPublicKeyP *auditor_pub,
struct GNUNET_TIME_Absolute validity_end,
struct GNUNET_TIME_Timestamp validity_end,
const struct TALER_MasterSignatureP *master_sig,
TALER_EXCHANGE_ManagementAuditorDisableCallback cb,
void *cb_cls);
@ -2911,7 +2913,7 @@ TALER_EXCHANGE_management_enable_wire (
struct GNUNET_CURL_Context *ctx,
const char *url,
const char *payto_uri,
struct GNUNET_TIME_Absolute validity_start,
struct GNUNET_TIME_Timestamp validity_start,
const struct TALER_MasterSignatureP *master_sig1,
const struct TALER_MasterSignatureP *master_sig2,
TALER_EXCHANGE_ManagementWireEnableCallback cb,
@ -2964,7 +2966,7 @@ TALER_EXCHANGE_management_disable_wire (
struct GNUNET_CURL_Context *ctx,
const char *url,
const char *payto_uri,
struct GNUNET_TIME_Absolute validity_end,
struct GNUNET_TIME_Timestamp validity_end,
const struct TALER_MasterSignatureP *master_sig,
TALER_EXCHANGE_ManagementWireDisableCallback cb,
void *cb_cls);
@ -3019,8 +3021,8 @@ TALER_EXCHANGE_management_set_wire_fees (
struct GNUNET_CURL_Context *ctx,
const char *exchange_base_url,
const char *wire_method,
struct GNUNET_TIME_Absolute validity_start,
struct GNUNET_TIME_Absolute validity_end,
struct GNUNET_TIME_Timestamp validity_start,
struct GNUNET_TIME_Timestamp validity_end,
const struct TALER_Amount *wire_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_MasterSignatureP *master_sig,

View File

@ -117,12 +117,12 @@ struct TALER_EXCHANGEDB_SignkeyMetaData
/**
* Start time of the validity period for this key.
*/
struct GNUNET_TIME_Absolute start;
struct GNUNET_TIME_Timestamp start;
/**
* The exchange will sign messages with this key between @e start and this time.
*/
struct GNUNET_TIME_Absolute expire_sign;
struct GNUNET_TIME_Timestamp expire_sign;
/**
* When do signatures with this sign key become invalid?
@ -131,7 +131,7 @@ struct TALER_EXCHANGEDB_SignkeyMetaData
* of the evidence. @e expire_legal is expected to be significantly
* larger than @e expire_sign (by a year or more).
*/
struct GNUNET_TIME_Absolute expire_legal;
struct GNUNET_TIME_Timestamp expire_legal;
};
@ -197,10 +197,10 @@ struct TALER_EXCHANGEDB_TableData
uint32_t age_restrictions;
struct TALER_DenominationPublicKey denom_pub;
struct TALER_MasterSignatureP master_sig;
struct GNUNET_TIME_Absolute valid_from;
struct GNUNET_TIME_Absolute expire_withdraw;
struct GNUNET_TIME_Absolute expire_deposit;
struct GNUNET_TIME_Absolute expire_legal;
struct GNUNET_TIME_Timestamp valid_from;
struct GNUNET_TIME_Timestamp expire_withdraw;
struct GNUNET_TIME_Timestamp expire_deposit;
struct GNUNET_TIME_Timestamp expire_legal;
struct TALER_Amount coin;
struct TALER_Amount fee_withdraw;
struct TALER_Amount fee_deposit;
@ -228,8 +228,8 @@ struct TALER_EXCHANGEDB_TableData
* Note: not useful for auditor, because not UPDATEd!
*/
struct TALER_Amount current_balance;
struct GNUNET_TIME_Absolute expiration_date;
struct GNUNET_TIME_Absolute gc_date;
struct GNUNET_TIME_Timestamp expiration_date;
struct GNUNET_TIME_Timestamp gc_date;
} reserves;
struct
@ -238,14 +238,14 @@ struct TALER_EXCHANGEDB_TableData
struct TALER_Amount credit;
uint64_t sender_account;
char *exchange_account_section;
struct GNUNET_TIME_Absolute execution_date;
struct GNUNET_TIME_Timestamp execution_date;
uint64_t reserve_uuid;
} reserves_in;
struct
{
uint64_t reserve_uuid;
struct GNUNET_TIME_Absolute execution_date;
struct GNUNET_TIME_Timestamp execution_date;
struct TALER_WireTransferIdentifierRawP wtid;
uint64_t wire_target_serial_id;
struct TALER_Amount amount;
@ -259,7 +259,7 @@ struct TALER_EXCHANGEDB_TableData
struct TALER_BlindedDenominationSignature denom_sig;
uint64_t reserve_uuid;
struct TALER_ReserveSignatureP reserve_sig;
struct GNUNET_TIME_Absolute execution_date;
struct GNUNET_TIME_Timestamp execution_date;
struct TALER_Amount amount_with_fee;
} reserves_out;
@ -269,7 +269,7 @@ struct TALER_EXCHANGEDB_TableData
char *auditor_url;
char *auditor_name;
bool is_active;
struct GNUNET_TIME_Absolute last_change;
struct GNUNET_TIME_Timestamp last_change;
} auditors;
struct
@ -333,10 +333,10 @@ struct TALER_EXCHANGEDB_TableData
uint64_t shard;
uint64_t known_coin_id;
struct TALER_Amount amount_with_fee;
struct GNUNET_TIME_Absolute wallet_timestamp;
struct GNUNET_TIME_Absolute exchange_timestamp;
struct GNUNET_TIME_Absolute refund_deadline;
struct GNUNET_TIME_Absolute wire_deadline;
struct GNUNET_TIME_Timestamp wallet_timestamp;
struct GNUNET_TIME_Timestamp exchange_timestamp;
struct GNUNET_TIME_Timestamp refund_deadline;
struct GNUNET_TIME_Timestamp wire_deadline;
struct TALER_MerchantPublicKeyP merchant_pub;
struct TALER_PrivateContractHash h_contract_terms;
struct TALER_CoinSpendSignatureP coin_sig;
@ -358,7 +358,7 @@ struct TALER_EXCHANGEDB_TableData
struct
{
struct GNUNET_TIME_Absolute execution_date;
struct GNUNET_TIME_Timestamp execution_date;
struct TALER_WireTransferIdentifierRawP wtid_raw;
uint64_t wire_target_serial_id;
char *exchange_account_section;
@ -374,8 +374,8 @@ struct TALER_EXCHANGEDB_TableData
struct
{
char *wire_method;
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_Amount wire_fee;
struct TALER_Amount closing_fee;
struct TALER_MasterSignatureP master_sig;
@ -387,7 +387,7 @@ struct TALER_EXCHANGEDB_TableData
struct TALER_CoinSpendSignatureP coin_sig;
union TALER_DenominationBlindingKeyP coin_blind;
struct TALER_Amount amount;
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Timestamp timestamp;
uint64_t reserve_out_serial_id;
} recoup;
@ -397,7 +397,7 @@ struct TALER_EXCHANGEDB_TableData
struct TALER_CoinSpendSignatureP coin_sig;
union TALER_DenominationBlindingKeyP coin_blind;
struct TALER_Amount amount;
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Timestamp timestamp;
uint64_t rrc_serial;
} recoup_refresh;
@ -467,7 +467,7 @@ struct TALER_EXCHANGEDB_BankTransfer
* (This is the execution date of the exchange's database,
* the execution date of the bank should be in @e wire).
*/
struct GNUNET_TIME_Absolute execution_date;
struct GNUNET_TIME_Timestamp execution_date;
/**
* Detailed wire information about the sending account
@ -508,7 +508,7 @@ struct TALER_EXCHANGEDB_ClosingTransfer
/**
* When did the exchange execute the transaction?
*/
struct GNUNET_TIME_Absolute execution_date;
struct GNUNET_TIME_Timestamp execution_date;
/**
* Detailed wire information about the receiving account
@ -544,13 +544,13 @@ struct TALER_EXCHANGEDB_Reserve
* The expiration date of this reserve; funds will be wired back
* at this time.
*/
struct GNUNET_TIME_Absolute expiry;
struct GNUNET_TIME_Timestamp expiry;
/**
* The legal expiration date of this reserve; we will forget about
* it at this time.
*/
struct GNUNET_TIME_Absolute gc;
struct GNUNET_TIME_Timestamp gc;
};
@ -562,7 +562,7 @@ struct TALER_EXCHANGEDB_DenominationKeyMetaData
/**
* Start time of the validity period for this key.
*/
struct GNUNET_TIME_Absolute start;
struct GNUNET_TIME_Timestamp start;
/**
* The exchange will sign fresh coins between @e start and this time.
@ -576,7 +576,7 @@ struct TALER_EXCHANGEDB_DenominationKeyMetaData
* with the same value with overlapping validity periods, to address
* issues such as clock skew.
*/
struct GNUNET_TIME_Absolute expire_withdraw;
struct GNUNET_TIME_Timestamp expire_withdraw;
/**
* Coins signed with the denomination key must be spent or refreshed
@ -588,7 +588,7 @@ struct TALER_EXCHANGEDB_DenominationKeyMetaData
* significantly larger than @e expire_withdraw (by months or even
* years).
*/
struct GNUNET_TIME_Absolute expire_deposit;
struct GNUNET_TIME_Timestamp expire_deposit;
/**
* When do signatures with this denomination key become invalid?
@ -597,7 +597,7 @@ struct TALER_EXCHANGEDB_DenominationKeyMetaData
* of the evidence. @e expire_legal is expected to be significantly
* larger than @e expire_deposit (by a year or more).
*/
struct GNUNET_TIME_Absolute expire_legal;
struct GNUNET_TIME_Timestamp expire_legal;
/**
* The value of the coins signed with this denomination key.
@ -815,7 +815,7 @@ struct TALER_EXCHANGEDB_Recoup
/**
* When did the recoup operation happen?
*/
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Timestamp timestamp;
};
@ -857,7 +857,7 @@ struct TALER_EXCHANGEDB_RecoupListEntry
/**
* When did the /recoup operation happen?
*/
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Timestamp timestamp;
};
@ -900,7 +900,7 @@ struct TALER_EXCHANGEDB_RecoupRefreshListEntry
/**
* When did the recoup operation happen?
*/
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Timestamp timestamp;
};
@ -1054,14 +1054,14 @@ struct TALER_EXCHANGEDB_Deposit
* deposit request in a timely fashion (so back-dating is not
* prevented).
*/
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Timestamp timestamp;
/**
* How much time does the merchant have to issue a refund request?
* Zero if refunds are not allowed. After this time, the coin
* cannot be refunded.
*/
struct GNUNET_TIME_Absolute refund_deadline;
struct GNUNET_TIME_Timestamp refund_deadline;
/**
* How much time does the merchant have to execute the wire transfer?
@ -1069,7 +1069,7 @@ struct TALER_EXCHANGEDB_Deposit
* constraint (as the merchant can theoretically pick any time,
* including one in the past).
*/
struct GNUNET_TIME_Absolute wire_deadline;
struct GNUNET_TIME_Timestamp wire_deadline;
/**
* Fraction of the coin's remaining value to be deposited, including
@ -1141,14 +1141,14 @@ struct TALER_EXCHANGEDB_DepositListEntry
* deposit request in a timely fashion (so back-dating is not
* prevented).
*/
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Timestamp timestamp;
/**
* How much time does the merchant have to issue a refund request?
* Zero if refunds are not allowed. After this time, the coin
* cannot be refunded.
*/
struct GNUNET_TIME_Absolute refund_deadline;
struct GNUNET_TIME_Timestamp refund_deadline;
/**
* How much time does the merchant have to execute the wire transfer?
@ -1156,7 +1156,7 @@ struct TALER_EXCHANGEDB_DepositListEntry
* constraint (as the merchant can theoretically pick any time,
* including one in the past).
*/
struct GNUNET_TIME_Absolute wire_deadline;
struct GNUNET_TIME_Timestamp wire_deadline;
/**
* Fraction of the coin's remaining value to be deposited, including
@ -1572,7 +1572,7 @@ typedef enum GNUNET_GenericReturnValue
(*TALER_EXCHANGEDB_DepositCallback)(
void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute exchange_timestamp,
struct GNUNET_TIME_Timestamp exchange_timestamp,
const struct TALER_EXCHANGEDB_Deposit *deposit,
const struct TALER_DenominationPublicKey *denom_pub,
bool done);
@ -1787,7 +1787,7 @@ typedef enum GNUNET_GenericReturnValue
const struct TALER_Amount *credit,
const char *sender_account_details,
uint64_t wire_reference,
struct GNUNET_TIME_Absolute execution_date);
struct GNUNET_TIME_Timestamp execution_date);
/**
@ -1821,8 +1821,8 @@ typedef void
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);
@ -1847,7 +1847,7 @@ typedef enum GNUNET_GenericReturnValue
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_ReserveSignatureP *reserve_sig,
struct GNUNET_TIME_Absolute execution_date,
struct GNUNET_TIME_Timestamp execution_date,
const struct TALER_Amount *amount_with_fee);
@ -1888,7 +1888,7 @@ typedef void
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,
@ -1912,7 +1912,7 @@ typedef enum GNUNET_GenericReturnValue
(*TALER_EXCHANGEDB_WireTransferOutCallback)(
void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute date,
struct GNUNET_TIME_Timestamp date,
const struct TALER_WireTransferIdentifierRawP *wtid,
const char *payto_uri,
const struct TALER_Amount *amount);
@ -1956,7 +1956,7 @@ typedef enum GNUNET_GenericReturnValue
(*TALER_EXCHANGEDB_RecoupCallback)(
void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute timestamp,
struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_Amount *amount,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_CoinPublicInfo *coin,
@ -1985,7 +1985,7 @@ typedef enum GNUNET_GenericReturnValue
(*TALER_EXCHANGEDB_RecoupRefreshCallback)(
void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute timestamp,
struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_Amount *amount,
const struct TALER_CoinSpendPublicKeyP *old_coin_pub,
const struct TALER_DenominationHash *old_denom_pub_hash,
@ -2013,7 +2013,7 @@ typedef enum GNUNET_GenericReturnValue
(*TALER_EXCHANGEDB_ReserveClosedCallback)(
void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute execution_date,
struct GNUNET_TIME_Timestamp execution_date,
const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_ReservePublicKeyP *reserve_pub,
@ -2049,7 +2049,7 @@ typedef enum GNUNET_DB_QueryStatus
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_Amount *left,
const char *account_details,
struct GNUNET_TIME_Absolute expiration_date);
struct GNUNET_TIME_Timestamp expiration_date);
/**
@ -2095,7 +2095,7 @@ typedef void
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *amount,
const char *payto_uri,
struct GNUNET_TIME_Absolute deadline,
struct GNUNET_TIME_Timestamp deadline,
bool tiny,
bool done);
@ -2462,7 +2462,7 @@ struct TALER_EXCHANGEDB_Plugin
(*reserves_in_insert)(void *cls,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_Amount *balance,
struct GNUNET_TIME_Absolute execution_time,
struct GNUNET_TIME_Timestamp execution_time,
const char *sender_account_details,
const char *exchange_account_name,
uint64_t wire_reference);
@ -2544,7 +2544,7 @@ struct TALER_EXCHANGEDB_Plugin
(*do_withdraw)(
void *cls,
const struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable,
struct GNUNET_TIME_Absolute now,
struct GNUNET_TIME_Timestamp now,
bool *found,
bool *balance_ok,
struct TALER_EXCHANGEDB_KycStatus *kyc_ok,
@ -2712,7 +2712,7 @@ struct TALER_EXCHANGEDB_Plugin
(*have_deposit)(void *cls,
const struct TALER_EXCHANGEDB_Deposit *deposit,
struct TALER_Amount *deposit_fee,
struct GNUNET_TIME_Absolute *exchange_timestamp);
struct GNUNET_TIME_Timestamp *exchange_timestamp);
/**
@ -2737,9 +2737,9 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_MerchantWireHash *h_wire,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant,
struct GNUNET_TIME_Absolute refund_deadline,
struct GNUNET_TIME_Timestamp refund_deadline,
struct TALER_Amount *deposit_fee,
struct GNUNET_TIME_Absolute *exchange_timestamp);
struct GNUNET_TIME_Timestamp *exchange_timestamp);
/**
@ -2752,7 +2752,7 @@ struct TALER_EXCHANGEDB_Plugin
*/
enum GNUNET_DB_QueryStatus
(*insert_deposit)(void *cls,
struct GNUNET_TIME_Absolute exchange_timestamp,
struct GNUNET_TIME_Timestamp exchange_timestamp,
const struct TALER_EXCHANGEDB_Deposit *deposit);
@ -3055,7 +3055,7 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_MerchantPublicKeyP *merchant_pub,
bool *pending,
struct TALER_WireTransferIdentifierRawP *wtid,
struct GNUNET_TIME_Absolute *exec_time,
struct GNUNET_TIME_Timestamp *exec_time,
struct TALER_Amount *amount_with_fee,
struct TALER_Amount *deposit_fee,
struct TALER_EXCHANGEDB_KycStatus *kyc);
@ -3091,8 +3091,8 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus
(*insert_wire_fee)(void *cls,
const char *wire_method,
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_Amount *wire_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_MasterSignatureP *master_sig);
@ -3114,9 +3114,9 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus
(*get_wire_fee)(void *cls,
const char *type,
struct GNUNET_TIME_Absolute date,
struct GNUNET_TIME_Absolute *start_date,
struct GNUNET_TIME_Absolute *end_date,
struct GNUNET_TIME_Timestamp date,
struct GNUNET_TIME_Timestamp *start_date,
struct GNUNET_TIME_Timestamp *end_date,
struct TALER_Amount *wire_fee,
struct TALER_Amount *closing_fee,
struct TALER_MasterSignatureP *master_sig);
@ -3134,7 +3134,7 @@ struct TALER_EXCHANGEDB_Plugin
*/
enum GNUNET_DB_QueryStatus
(*get_expired_reserves)(void *cls,
struct GNUNET_TIME_Absolute now,
struct GNUNET_TIME_Timestamp now,
TALER_EXCHANGEDB_ReserveExpiredCallback rec,
void *rec_cls);
@ -3154,7 +3154,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus
(*insert_reserve_closed)(void *cls,
const struct TALER_ReservePublicKeyP *reserve_pub,
struct GNUNET_TIME_Absolute execution_date,
struct GNUNET_TIME_Timestamp execution_date,
const char *receiver_account,
const struct TALER_WireTransferIdentifierRawP *wtid,
const struct TALER_Amount *amount_with_fee,
@ -3248,7 +3248,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus
(*store_wire_transfer_out)(
void *cls,
struct GNUNET_TIME_Absolute date,
struct GNUNET_TIME_Timestamp date,
const struct TALER_WireTransferIdentifierRawP *wtid,
uint64_t wire_target,
const char *exchange_account_section,
@ -3486,7 +3486,7 @@ struct TALER_EXCHANGEDB_Plugin
const union TALER_DenominationBlindingKeyP *coin_blind,
const struct TALER_Amount *amount,
const struct TALER_BlindedCoinHash *h_blind_ev,
struct GNUNET_TIME_Absolute timestamp);
struct GNUNET_TIME_Timestamp timestamp);
/**
@ -3511,7 +3511,7 @@ struct TALER_EXCHANGEDB_Plugin
const union TALER_DenominationBlindingKeyP *coin_blind,
const struct TALER_Amount *amount,
const struct TALER_BlindedCoinHash *h_blind_ev,
struct GNUNET_TIME_Absolute timestamp);
struct GNUNET_TIME_Timestamp timestamp);
/**
@ -3592,8 +3592,8 @@ struct TALER_EXCHANGEDB_Plugin
*/
enum GNUNET_DB_QueryStatus
(*select_deposits_missing_wire)(void *cls,
struct GNUNET_TIME_Absolute start_date,
struct GNUNET_TIME_Absolute end_date,
struct GNUNET_TIME_Timestamp start_date,
struct GNUNET_TIME_Timestamp end_date,
TALER_EXCHANGEDB_WireMissingCallback cb,
void *cb_cls);
@ -3609,7 +3609,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus
(*lookup_auditor_timestamp)(void *cls,
const struct TALER_AuditorPublicKeyP *auditor_pub,
struct GNUNET_TIME_Absolute *last_date);
struct GNUNET_TIME_Timestamp *last_date);
/**
@ -3645,7 +3645,7 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url,
const char *auditor_name,
struct GNUNET_TIME_Absolute start_date);
struct GNUNET_TIME_Timestamp start_date);
/**
@ -3665,7 +3665,7 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url,
const char *auditor_name,
struct GNUNET_TIME_Absolute change_date,
struct GNUNET_TIME_Timestamp change_date,
bool enabled);
@ -3680,7 +3680,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus
(*lookup_wire_timestamp)(void *cls,
const char *payto_uri,
struct GNUNET_TIME_Absolute *last_date);
struct GNUNET_TIME_Timestamp *last_date);
/**
@ -3697,7 +3697,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus
(*insert_wire)(void *cls,
const char *payto_uri,
struct GNUNET_TIME_Absolute start_date,
struct GNUNET_TIME_Timestamp start_date,
const struct TALER_MasterSignatureP *master_sig);
@ -3714,7 +3714,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus
(*update_wire)(void *cls,
const char *payto_uri,
struct GNUNET_TIME_Absolute change_date,
struct GNUNET_TIME_Timestamp change_date,
bool enabled);
@ -3899,8 +3899,8 @@ struct TALER_EXCHANGEDB_Plugin
(*lookup_wire_fee_by_time)(
void *cls,
const char *wire_method,
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);

View File

@ -38,20 +38,6 @@
__FILE__, __LINE__, error.text, error.source)
/**
* Generate packer instruction for a JSON field of type
* absolute time.
* The absolute time value is expected to be already rounded.
*
* @param name name of the field to add to the object
* @param at absolute time to pack
* @return json pack specification
*/
struct GNUNET_JSON_PackSpec
TALER_JSON_pack_time_abs (const char *name,
struct GNUNET_TIME_Absolute at);
/**
* Generate packer instruction for a JSON field of type
* absolute time creating a human-readable timestamp.
@ -65,20 +51,6 @@ TALER_JSON_pack_time_abs_human (const char *name,
struct GNUNET_TIME_Absolute at);
/**
* Generate packer instruction for a JSON field of type
* absolute time in network byte order.
* The absolute time value is expected to be already rounded.
*
* @param name name of the field to add to the object
* @param at absolute time to pack
* @return json pack specification
*/
struct GNUNET_JSON_PackSpec
TALER_JSON_pack_time_abs_nbo (const char *name,
struct GNUNET_TIME_AbsoluteNBO at);
/**
* Put an error code into a JSON reply, including
* both the numeric value and the hint.
@ -102,34 +74,6 @@ TALER_JSON_pack_time_abs_nbo_human (const char *name,
struct GNUNET_TIME_AbsoluteNBO at);
/**
* Generate packer instruction for a JSON field of type
* relative time.
* The relative time value is expected to be already rounded.
*
* @param name name of the field to add to the object
* @param rt relative time to pack
* @return json pack specification
*/
struct GNUNET_JSON_PackSpec
TALER_JSON_pack_time_rel (const char *name,
struct GNUNET_TIME_Relative rt);
/**
* Generate packer instruction for a JSON field of type
* relative time in network byte order.
* The relative time value is expected to be already rounded.
*
* @param name name of the field to add to the object
* @param rt relative time to pack
* @return json pack specification
*/
struct GNUNET_JSON_PackSpec
TALER_JSON_pack_time_rel_nbo (const char *name,
struct GNUNET_TIME_RelativeNBO rt);
/**
* Generate packer instruction for a JSON field of type
* denomination public key.
@ -278,46 +222,6 @@ TALER_JSON_spec_amount_any_nbo (const char *name,
struct TALER_AmountNBO *r_amount);
/**
* Provide specification to parse given JSON object to an absolute time.
* The absolute time value is expected to be already rounded.
*
* @param name name of the time field in the JSON
* @param[out] r_time where the time has to be written
* @return spec for parsing an absolute time
*/
struct GNUNET_JSON_Specification
TALER_JSON_spec_absolute_time (const char *name,
struct GNUNET_TIME_Absolute *r_time);
/**
* Provide specification to parse given JSON object to an absolute time
* in network byte order.
* The absolute time value is expected to be already rounded.
*
* @param name name of the time field in the JSON
* @param[out] r_time where the time has to be written
* @return spec for parsing an absolute time
*/
struct GNUNET_JSON_Specification
TALER_JSON_spec_absolute_time_nbo (const char *name,
struct GNUNET_TIME_AbsoluteNBO *r_time);
/**
* Provide specification to parse given JSON object to a relative time.
* The absolute time value is expected to be already rounded.
*
* @param name name of the time field in the JSON
* @param[out] r_time where the time has to be written
* @return spec for parsing a relative time
*/
struct GNUNET_JSON_Specification
TALER_JSON_spec_relative_time (const char *name,
struct GNUNET_TIME_Relative *r_time);
/**
* Generate line in parser specification for denomination public key.
*

View File

@ -101,33 +101,6 @@ struct GNUNET_PQ_QueryParam
TALER_PQ_query_param_json (const json_t *x);
/**
* Generate query parameter for an absolute time value.
* In contrast to
* #GNUNET_PQ_query_param_absolute_time(), this function
* will abort (!) if the time given is not rounded!
* The database must store a 64-bit integer.
*
* @param x pointer to the query parameter to pass
*/
struct GNUNET_PQ_QueryParam
TALER_PQ_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x);
/**
* Generate query parameter for an absolute time value.
* In contrast to
* #GNUNET_PQ_query_param_absolute_time(), this function
* will abort (!) if the time given is not rounded!
* The database must store a 64-bit integer.
*
* @param x pointer to the query parameter to pass
*/
struct GNUNET_PQ_QueryParam
TALER_PQ_query_param_absolute_time_nbo (const struct
GNUNET_TIME_AbsoluteNBO *x);
/**
* Currency amount expected.
*
@ -205,36 +178,6 @@ TALER_PQ_result_spec_json (const char *name,
json_t **jp);
/**
* Rounded absolute time expected.
* In contrast to #GNUNET_PQ_query_param_absolute_time_nbo(),
* this function ensures that the result is rounded and can
* be converted to JSON.
*
* @param name name of the field in the table
* @param[out] at where to store the result
* @return array entry for the result specification to use
*/
struct GNUNET_PQ_ResultSpec
TALER_PQ_result_spec_absolute_time (const char *name,
struct GNUNET_TIME_Absolute *at);
/**
* Rounded absolute time expected.
* In contrast to #GNUNET_PQ_result_spec_absolute_time_nbo(),
* this function ensures that the result is rounded and can
* be converted to JSON.
*
* @param name name of the field in the table
* @param[out] at where to store the result
* @return array entry for the result specification to use
*/
struct GNUNET_PQ_ResultSpec
TALER_PQ_result_spec_absolute_time_nbo (const char *name,
struct GNUNET_TIME_AbsoluteNBO *at);
#endif /* TALER_PQ_LIB_H_ */
/* end of include/taler_pq_lib.h */

View File

@ -342,7 +342,7 @@ struct TALER_DenominationKeyAnnouncementPS
/**
* When does the key become available?
*/
struct GNUNET_TIME_AbsoluteNBO anchor_time;
struct GNUNET_TIME_TimestampNBO anchor_time;
/**
* How long is the key available after @e anchor_time?
@ -373,7 +373,7 @@ struct TALER_SigningKeyAnnouncementPS
/**
* When does the key become available?
*/
struct GNUNET_TIME_AbsoluteNBO anchor_time;
struct GNUNET_TIME_TimestampNBO anchor_time;
/**
* How long is the key available after @e anchor_time?
@ -497,14 +497,14 @@ struct TALER_DepositRequestPS
* deposit request in a timely fashion (so back-dating is not
* prevented).
*/
struct GNUNET_TIME_AbsoluteNBO wallet_timestamp;
struct GNUNET_TIME_TimestampNBO wallet_timestamp;
/**
* How much time does the merchant have to issue a refund request?
* Zero if refunds are not allowed. After this time, the coin
* cannot be refunded.
*/
struct GNUNET_TIME_AbsoluteNBO refund_deadline;
struct GNUNET_TIME_TimestampNBO refund_deadline;
/**
* Amount to be deposited, including deposit fee charged by the
@ -565,13 +565,13 @@ struct TALER_DepositConfirmationPS
* Time when this confirmation was generated / when the exchange received
* the deposit request.
*/
struct GNUNET_TIME_AbsoluteNBO exchange_timestamp;
struct GNUNET_TIME_TimestampNBO exchange_timestamp;
/**
* By when does the exchange expect to pay the merchant
* (as per the merchant's request).
*/
struct GNUNET_TIME_AbsoluteNBO wire_deadline;
struct GNUNET_TIME_TimestampNBO wire_deadline;
/**
* How much time does the @e merchant have to issue a refund
@ -580,7 +580,7 @@ struct TALER_DepositConfirmationPS
* performed by the exchange until the refund deadline. This value
* is taken from the original deposit request.
*/
struct GNUNET_TIME_AbsoluteNBO refund_deadline;
struct GNUNET_TIME_TimestampNBO refund_deadline;
/**
* Amount to be deposited, excluding fee. Calculated from the
@ -782,7 +782,7 @@ struct TALER_ExchangeSigningKeyValidityPS
/**
* When does this signing key begin to be valid?
*/
struct GNUNET_TIME_AbsoluteNBO start;
struct GNUNET_TIME_TimestampNBO start;
/**
* When does this signing key expire? Note: This is currently when
@ -792,7 +792,7 @@ struct TALER_ExchangeSigningKeyValidityPS
* the use of either key during the overlap time (due to the
* possibility of clock skew).
*/
struct GNUNET_TIME_AbsoluteNBO expire;
struct GNUNET_TIME_TimestampNBO expire;
/**
* When do signatures with this signing key become invalid? After
@ -801,7 +801,7 @@ struct TALER_ExchangeSigningKeyValidityPS
* evidence. @e end is expected to be significantly larger than @e
* expire (by a year or more).
*/
struct GNUNET_TIME_AbsoluteNBO end;
struct GNUNET_TIME_TimestampNBO end;
/**
* The public online signing key that the exchange will use
@ -828,7 +828,7 @@ struct TALER_ExchangeKeySetPS
/**
* Time of the key set issue.
*/
struct GNUNET_TIME_AbsoluteNBO list_issue_date;
struct GNUNET_TIME_TimestampNBO list_issue_date;
/**
* Hash over the various denomination signing keys returned.
@ -858,7 +858,7 @@ struct TALER_ExchangeAccountSetupSuccessPS
/**
* When was the signature made.
*/
struct GNUNET_TIME_AbsoluteNBO timestamp;
struct GNUNET_TIME_TimestampNBO timestamp;
};
@ -878,7 +878,7 @@ struct TALER_MasterAddAuditorPS
/**
* Time of the change.
*/
struct GNUNET_TIME_AbsoluteNBO start_date;
struct GNUNET_TIME_TimestampNBO start_date;
/**
* Public key of the auditor.
@ -908,7 +908,7 @@ struct TALER_MasterDelAuditorPS
/**
* Time of the change.
*/
struct GNUNET_TIME_AbsoluteNBO end_date;
struct GNUNET_TIME_TimestampNBO end_date;
/**
* Public key of the auditor.
@ -934,7 +934,7 @@ struct TALER_MasterAddWirePS
/**
* Time of the change.
*/
struct GNUNET_TIME_AbsoluteNBO start_date;
struct GNUNET_TIME_TimestampNBO start_date;
/**
* Hash over the exchange's payto URI.
@ -959,7 +959,7 @@ struct TALER_MasterDelWirePS
/**
* Time of the change.
*/
struct GNUNET_TIME_AbsoluteNBO end_date;
struct GNUNET_TIME_TimestampNBO end_date;
/**
* Hash over the exchange's payto URI.
@ -990,7 +990,7 @@ struct TALER_DenominationKeyValidityPS
/**
* Start time of the validity period for this key.
*/
struct GNUNET_TIME_AbsoluteNBO start;
struct GNUNET_TIME_TimestampNBO start;
/**
* The exchange will sign fresh coins between @e start and this time.
@ -1004,7 +1004,7 @@ struct TALER_DenominationKeyValidityPS
* with the same value with overlapping validity periods, to address
* issues such as clock skew.
*/
struct GNUNET_TIME_AbsoluteNBO expire_withdraw;
struct GNUNET_TIME_TimestampNBO expire_withdraw;
/**
* Coins signed with the denomination key must be spent or refreshed
@ -1016,7 +1016,7 @@ struct TALER_DenominationKeyValidityPS
* significantly larger than @e expire_withdraw (by months or even
* years).
*/
struct GNUNET_TIME_AbsoluteNBO expire_deposit;
struct GNUNET_TIME_TimestampNBO expire_deposit;
/**
* When do signatures with this denomination key become invalid?
@ -1025,7 +1025,7 @@ struct TALER_DenominationKeyValidityPS
* of the evidence. @e expire_legal is expected to be significantly
* larger than @e expire_deposit (by a year or more).
*/
struct GNUNET_TIME_AbsoluteNBO expire_legal;
struct GNUNET_TIME_TimestampNBO expire_legal;
/**
* The value of the coins signed with this denomination key.
@ -1093,7 +1093,7 @@ struct TALER_ExchangeKeyValidityPS
/**
* Start time of the validity period for this key.
*/
struct GNUNET_TIME_AbsoluteNBO start;
struct GNUNET_TIME_TimestampNBO start;
/**
* The exchange will sign fresh coins between @e start and this time.
@ -1107,7 +1107,7 @@ struct TALER_ExchangeKeyValidityPS
* with the same value with overlapping validity periods, to address
* issues such as clock skew.
*/
struct GNUNET_TIME_AbsoluteNBO expire_withdraw;
struct GNUNET_TIME_TimestampNBO expire_withdraw;
/**
* Coins signed with the denomination key must be spent or refreshed
@ -1119,7 +1119,7 @@ struct TALER_ExchangeKeyValidityPS
* significantly larger than @e expire_withdraw (by months or even
* years).
*/
struct GNUNET_TIME_AbsoluteNBO expire_deposit;
struct GNUNET_TIME_TimestampNBO expire_deposit;
/**
* When do signatures with this denomination key become invalid?
@ -1128,7 +1128,7 @@ struct TALER_ExchangeKeyValidityPS
* of the evidence. @e expire_legal is expected to be significantly
* larger than @e expire_deposit (by a year or more).
*/
struct GNUNET_TIME_AbsoluteNBO expire_legal;
struct GNUNET_TIME_TimestampNBO expire_legal;
/**
* The value of the coins signed with this denomination key.
@ -1231,12 +1231,12 @@ struct TALER_MasterWireFeePS
/**
* Start date when the fee goes into effect.
*/
struct GNUNET_TIME_AbsoluteNBO start_date;
struct GNUNET_TIME_TimestampNBO start_date;
/**
* End date when the fee stops being in effect (exclusive)
*/
struct GNUNET_TIME_AbsoluteNBO end_date;
struct GNUNET_TIME_TimestampNBO end_date;
/**
* Fee charged to the merchant per wire transfer.
@ -1338,7 +1338,7 @@ struct TALER_WireDepositDetailP
/**
* Time when the wire transfer was performed by the exchange.
*/
struct GNUNET_TIME_AbsoluteNBO execution_time;
struct GNUNET_TIME_TimestampNBO execution_time;
/**
* Coin's public key.
@ -1473,7 +1473,7 @@ struct TALER_ConfirmWirePS
* timestamp may not be exactly the same on the wire, i.e.
* because the wire has a different timezone or resolution.
*/
struct GNUNET_TIME_AbsoluteNBO execution_time;
struct GNUNET_TIME_TimestampNBO execution_time;
/**
* The contribution of @e coin_pub to the total transfer volume.
@ -1532,7 +1532,7 @@ struct TALER_RecoupConfirmationPS
* Indirectly determines when the wire transfer is (likely)
* to happen.
*/
struct GNUNET_TIME_AbsoluteNBO timestamp;
struct GNUNET_TIME_TimestampNBO timestamp;
/**
* How much of the coin's value will the exchange transfer?
@ -1570,7 +1570,7 @@ struct TALER_RecoupRefreshConfirmationPS
* Indirectly determines when the wire transfer is (likely)
* to happen.
*/
struct GNUNET_TIME_AbsoluteNBO timestamp;
struct GNUNET_TIME_TimestampNBO timestamp;
/**
* How much of the coin's value will the exchange transfer?
@ -1605,7 +1605,7 @@ struct TALER_DenominationUnknownAffirmationPS
/**
* When did the exchange sign this message.
*/
struct GNUNET_TIME_AbsoluteNBO timestamp;
struct GNUNET_TIME_TimestampNBO timestamp;
/**
* Hash of the public denomination key we do not know.
@ -1630,7 +1630,7 @@ struct TALER_DenominationExpiredAffirmationPS
/**
* When did the exchange sign this message.
*/
struct GNUNET_TIME_AbsoluteNBO timestamp;
struct GNUNET_TIME_TimestampNBO timestamp;
/**
* Name of the operation that is not allowed at this time. Might NOT be 0-terminated, but is padded with 0s.
@ -1660,7 +1660,7 @@ struct TALER_ReserveCloseConfirmationPS
/**
* When did the exchange initiate the wire transfer.
*/
struct GNUNET_TIME_AbsoluteNBO timestamp;
struct GNUNET_TIME_TimestampNBO timestamp;
/**
* How much did the exchange send?

View File

@ -60,33 +60,6 @@ struct GNUNET_SQ_QueryParam
TALER_SQ_query_param_json (const json_t *x);
/**
* Generate query parameter for an absolute time value.
* In contrast to
* #GNUNET_SQ_query_param_absolute_time(), this function
* will abort (!) if the time given is not rounded!
* The database must store a 64-bit integer.
*
* @param x pointer to the query parameter to pass
*/
struct GNUNET_SQ_QueryParam
TALER_SQ_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x);
/**
* Generate query parameter for an absolute time value.
* In contrast to
* #GNUNET_SQ_query_param_absolute_time(), this function
* will abort (!) if the time given is not rounded!
* The database must store a 64-bit integer.
*
* @param x pointer to the query parameter to pass
*/
struct GNUNET_SQ_QueryParam
TALER_SQ_query_param_absolute_time_nbo (const struct
GNUNET_TIME_AbsoluteNBO *x);
/**
* Currency amount expected.
*
@ -121,32 +94,6 @@ struct GNUNET_SQ_ResultSpec
TALER_SQ_result_spec_json (json_t **jp);
/**
* Rounded absolute time expected.
* In contrast to #GNUNET_SQ_query_param_absolute_time_nbo(),
* this function ensures that the result is rounded and can
* be converted to JSON.
*
* @param[out] at where to store the result
* @return array entry for the result specification to use
*/
struct GNUNET_SQ_ResultSpec
TALER_SQ_result_spec_absolute_time (struct GNUNET_TIME_Absolute *at);
/**
* Rounded absolute time expected.
* In contrast to #GNUNET_SQ_result_spec_absolute_time_nbo(),
* this function ensures that the result is rounded and can
* be converted to JSON.
*
* @param[out] at where to store the result
* @return array entry for the result specification to use
*/
struct GNUNET_SQ_ResultSpec
TALER_SQ_result_spec_absolute_time_nbo (struct GNUNET_TIME_AbsoluteNBO *at);
#endif /* TALER_SQ_LIB_H_ */
/* end of include/taler_sq_lib.h */

View File

@ -133,7 +133,7 @@ struct TALER_TESTING_LibeufinServices
* @return #GNUNET_OK on success, #GNUNET_NO if test should be
* skipped, #GNUNET_SYSERR on test failure
*/
int
enum GNUNET_GenericReturnValue
TALER_TESTING_prepare_exchange (const char *config_filename,
int reset_db,
struct TALER_TESTING_ExchangeConfiguration *ec);
@ -208,7 +208,7 @@ TALER_TESTING_cleanup_files (const char *config_name);
* @param cfg configuration
* @return #GNUNET_OK on success
*/
int
enum GNUNET_GenericReturnValue
TALER_TESTING_cleanup_files_cfg (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg);
@ -222,7 +222,7 @@ TALER_TESTING_cleanup_files_cfg (void *cls,
* @param auditor_url URL of auditor to enable, can be NULL
* @return #GNUNET_OK on success
*/
int
enum GNUNET_GenericReturnValue
TALER_TESTING_run_exchange_offline (const char *config_filename,
const char *payto_uri,
const char *auditor_pub,
@ -235,7 +235,7 @@ TALER_TESTING_run_exchange_offline (const char *config_filename,
* @param config_filename configuration file to use
* @return #GNUNET_OK on success
*/
int
enum GNUNET_GenericReturnValue
TALER_TESTING_auditor_db_reset (const char *config_filename);
@ -245,7 +245,7 @@ TALER_TESTING_auditor_db_reset (const char *config_filename);
* @param config_filename configuration file to use
* @return #GNUNET_OK on success
*/
int
enum GNUNET_GenericReturnValue
TALER_TESTING_exchange_db_reset (const char *config_filename);
@ -255,7 +255,7 @@ TALER_TESTING_exchange_db_reset (const char *config_filename);
* @param config_filename configuration file to use
* @return #GNUNET_OK on success
*/
int
enum GNUNET_GenericReturnValue
TALER_TESTING_run_auditor_offline (const char *config_filename);
@ -268,7 +268,7 @@ TALER_TESTING_run_auditor_offline (const char *config_filename);
* @param do_remove #GNUNET_NO to add exchange, #GNUNET_YES to remove
* @return #GNUNET_OK on success
*/
int
enum GNUNET_GenericReturnValue
TALER_TESTING_run_auditor_exchange (const char *config_filename,
const char *exchange_master_pub,
const char *exchange_base_url,
@ -281,7 +281,7 @@ TALER_TESTING_run_auditor_exchange (const char *config_filename,
* @param url URL to extract port from, 80 is default
* @return #GNUNET_OK if the port is free
*/
int
enum GNUNET_GenericReturnValue
TALER_TESTING_url_port_free (const char *url);
@ -324,7 +324,7 @@ struct TALER_TESTING_BankConfiguration
* @param[out] bc set to the bank's configuration data
* @return #GNUNET_OK on success
*/
int
enum GNUNET_GenericReturnValue
TALER_TESTING_prepare_fakebank (const char *config_filename,
const char *config_section,
struct TALER_TESTING_BankConfiguration *bc);
@ -531,7 +531,7 @@ struct TALER_TESTING_Command
* @param index index number of the object to extract.
* @return #GNUNET_OK on success
*/
int
enum GNUNET_GenericReturnValue
(*traits)(void *cls,
const void **ret,
const char *trait,
@ -731,7 +731,7 @@ typedef void
* non-#GNUNET_OK codes are #GNUNET_SYSERR most of the
* times.
*/
int
enum GNUNET_GenericReturnValue
TALER_TESTING_setup (TALER_TESTING_Main main_cb,
void *main_cb_cls,
const struct GNUNET_CONFIGURATION_Handle *cfg,
@ -751,7 +751,7 @@ TALER_TESTING_setup (TALER_TESTING_Main main_cb,
* non-GNUNET_OK codes are #GNUNET_SYSERR most of the
* times.
*/
int
enum GNUNET_GenericReturnValue
TALER_TESTING_auditor_setup (TALER_TESTING_Main main_cb,
void *main_cb_cls,
const char *config_filename);
@ -788,7 +788,7 @@ struct TALER_TESTING_SetupContext
* @param cfg configuration to use.
* @return #GNUNET_OK if no errors occurred.
*/
int
enum GNUNET_GenericReturnValue
TALER_TESTING_setup_with_exchange_cfg (
void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg);
@ -809,7 +809,7 @@ TALER_TESTING_setup_with_exchange_cfg (
* at its base URL.
* @return #GNUNET_OK if no errors occurred.
*/
int
enum GNUNET_GenericReturnValue
TALER_TESTING_setup_with_exchange (TALER_TESTING_Main main_cb,
void *main_cb_cls,
const char *config_file);
@ -824,7 +824,7 @@ TALER_TESTING_setup_with_exchange (TALER_TESTING_Main main_cb,
* @param cfg configuration to use.
* @return #GNUNET_OK if no errors occurred.
*/
int
enum GNUNET_GenericReturnValue
TALER_TESTING_setup_with_auditor_and_exchange_cfg (
void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg);
@ -845,7 +845,7 @@ TALER_TESTING_setup_with_auditor_and_exchange_cfg (
* at its base URL.
* @return #GNUNET_OK if no errors occurred.
*/
int
enum GNUNET_GenericReturnValue
TALER_TESTING_setup_with_auditor_and_exchange (TALER_TESTING_Main main_cb,
void *main_cb_cls,
const char *config_file);
@ -905,7 +905,7 @@ TALER_TESTING_run_fakebank (const char *bank_url,
* @param[out] bc set to the bank's configuration data
* @return #GNUNET_OK on success
*/
int
enum GNUNET_GenericReturnValue
TALER_TESTING_prepare_bank (const char *config_filename,
int reset_db,
const char *config_section,
@ -922,7 +922,7 @@ TALER_TESTING_prepare_bank (const char *config_filename,
* @return the base url, or NULL upon errors. Must be freed
* by the caller.
*/
int
enum GNUNET_GenericReturnValue
TALER_TESTING_prepare_nexus (const char *config_filename,
int reset_db,
const char *config_section,
@ -934,7 +934,7 @@ TALER_TESTING_prepare_nexus (const char *config_filename,
* @param prog program's name to look into
* @param marker chunk to find in @a prog
*/
int
enum GNUNET_GenericReturnValue
TALER_TESTING_has_in_name (const char *prog,
const char *marker);
@ -1966,7 +1966,7 @@ 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);
@ -2446,12 +2446,12 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
op (debit_payto_uri, const char *) \
op (order_id, const char *) \
op (amount, const struct TALER_Amount) \
op (amount_with_fee, const struct TALER_Amount) \
op (deposit_amount, const struct TALER_Amount) \
op (deposit_fee_amount, const struct TALER_Amount) \
op (amount_with_fee, const struct TALER_Amount) \
op (deposit_amount, const struct TALER_Amount) \
op (deposit_fee_amount, const struct TALER_Amount) \
op (batch_cmds, struct TALER_TESTING_Command *) \
op (uuid, const struct GNUNET_Uuid) \
op (fresh_coins, const struct TALER_TESTING_FreshCoinData *) \
op (fresh_coins, const struct TALER_TESTING_FreshCoinData *) \
op (claim_token, const struct TALER_ClaimTokenP) \
op (relative_time, const struct GNUNET_TIME_Relative) \
op (process, struct GNUNET_OS_Process *)
@ -2460,14 +2460,15 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
/**
* Call #op on all indexed traits.
*/
#define TALER_TESTING_INDEXED_TRAITS(op) \
#define TALER_TESTING_INDEXED_TRAITS(op) \
op (denom_pub, const struct TALER_EXCHANGE_DenomPublicKey) \
op (denom_sig, const struct TALER_DenominationSignature) \
op (denom_sig, const struct TALER_DenominationSignature) \
op (coin_priv, const struct TALER_CoinSpendPrivateKeyP) \
op (coin_pub, const struct TALER_CoinSpendPublicKeyP) \
op (absolute_time, const struct GNUNET_TIME_Absolute) \
op (wire_deadline, const struct GNUNET_TIME_Absolute) \
op (refund_deadline, const struct GNUNET_TIME_Absolute) \
op (timestamp, const struct GNUNET_TIME_Timestamp) \
op (wire_deadline, const struct GNUNET_TIME_Timestamp) \
op (refund_deadline, const struct GNUNET_TIME_Timestamp) \
op (exchange_pub, const struct TALER_ExchangePublicKeyP) \
op (exchange_sig, const struct TALER_ExchangeSignatureP) \
op (blinding_key, const union TALER_DenominationBlindingKeyP)

View File

@ -215,219 +215,6 @@ TALER_JSON_spec_amount_any_nbo (const char *name,
}
/**
* Parse given JSON object to *rounded* absolute time.
*
* @param cls closure, NULL
* @param root the json object representing data
* @param[out] spec where to write the data
* @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
*/
static enum GNUNET_GenericReturnValue
parse_abs_time (void *cls,
json_t *root,
struct GNUNET_JSON_Specification *spec)
{
struct GNUNET_TIME_Absolute *abs = spec->ptr;
json_t *json_t_ms;
unsigned long long int tval;
(void) cls;
if (! json_is_object (root))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
json_t_ms = json_object_get (root,
"t_ms");
if (json_is_integer (json_t_ms))
{
tval = json_integer_value (json_t_ms);
/* Time is in milliseconds in JSON, but in microseconds in GNUNET_TIME_Absolute */
abs->abs_value_us = tval * 1000LL;
if ((abs->abs_value_us) / 1000LL != tval)
{
/* Integer overflow */
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
GNUNET_TIME_round_abs (abs))
{
/* time not rounded */
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
return GNUNET_OK;
}
if (json_is_string (json_t_ms))
{
const char *val;
val = json_string_value (json_t_ms);
if ((0 == strcasecmp (val, "never")))
{
*abs = GNUNET_TIME_UNIT_FOREVER_ABS;
return GNUNET_OK;
}
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"`%s' is not a valid absolute time\n",
json_string_value (json_t_ms));
return GNUNET_SYSERR;
}
return GNUNET_SYSERR;
}
struct GNUNET_JSON_Specification
TALER_JSON_spec_absolute_time (const char *name,
struct GNUNET_TIME_Absolute *r_time)
{
struct GNUNET_JSON_Specification ret = {
.parser = &parse_abs_time,
.cleaner = NULL,
.cls = NULL,
.field = name,
.ptr = r_time,
.ptr_size = sizeof(struct GNUNET_TIME_Absolute),
.size_ptr = NULL
};
return ret;
}
/**
* Parse given JSON object to absolute time.
*
* @param cls closure, NULL
* @param root the json object representing data
* @param[out] spec where to write the data
* @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
*/
static enum GNUNET_GenericReturnValue
parse_abs_time_nbo (void *cls,
json_t *root,
struct GNUNET_JSON_Specification *spec)
{
struct GNUNET_TIME_AbsoluteNBO *abs = spec->ptr;
struct GNUNET_TIME_Absolute a;
struct GNUNET_JSON_Specification ispec;
(void) cls;
ispec = *spec;
ispec.parser = &parse_abs_time;
ispec.ptr = &a;
if (GNUNET_OK !=
parse_abs_time (NULL,
root,
&ispec))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
*abs = GNUNET_TIME_absolute_hton (a);
return GNUNET_OK;
}
struct GNUNET_JSON_Specification
TALER_JSON_spec_absolute_time_nbo (const char *name,
struct GNUNET_TIME_AbsoluteNBO *r_time)
{
struct GNUNET_JSON_Specification ret = {
.parser = &parse_abs_time_nbo,
.cleaner = NULL,
.cls = NULL,
.field = name,
.ptr = r_time,
.ptr_size = sizeof(struct GNUNET_TIME_AbsoluteNBO),
.size_ptr = NULL
};
return ret;
}
/**
* Parse given JSON object to relative time.
*
* @param cls closure, NULL
* @param root the json object representing data
* @param[out] spec where to write the data
* @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
*/
static enum GNUNET_GenericReturnValue
parse_rel_time (void *cls,
json_t *root,
struct GNUNET_JSON_Specification *spec)
{
struct GNUNET_TIME_Relative *rel = spec->ptr;
json_t *json_d_ms;
unsigned long long int tval;
(void) cls;
if (! json_is_object (root))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
json_d_ms = json_object_get (root, "d_ms");
if (json_is_integer (json_d_ms))
{
tval = json_integer_value (json_d_ms);
/* Time is in milliseconds in JSON, but in microseconds in GNUNET_TIME_Absolute */
rel->rel_value_us = tval * 1000LL;
if ((rel->rel_value_us) / 1000LL != tval)
{
/* Integer overflow */
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
GNUNET_TIME_round_rel (rel))
{
/* time not rounded */
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
return GNUNET_OK;
}
if (json_is_string (json_d_ms))
{
const char *val;
val = json_string_value (json_d_ms);
if ((0 == strcasecmp (val, "forever")))
{
*rel = GNUNET_TIME_UNIT_FOREVER_REL;
return GNUNET_OK;
}
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
struct GNUNET_JSON_Specification
TALER_JSON_spec_relative_time (const char *name,
struct GNUNET_TIME_Relative *r_time)
{
struct GNUNET_JSON_Specification ret = {
.parser = &parse_rel_time,
.cleaner = NULL,
.cls = NULL,
.field = name,
.ptr = r_time,
.ptr_size = sizeof(struct GNUNET_TIME_Relative),
.size_ptr = NULL
};
return ret;
}
/**
* Parse given JSON object to denomination public key.
*

View File

@ -24,17 +24,6 @@
#include "taler_json_lib.h"
struct GNUNET_JSON_PackSpec
TALER_JSON_pack_time_abs (const char *name,
struct GNUNET_TIME_Absolute at)
{
GNUNET_assert (GNUNET_OK ==
GNUNET_TIME_round_abs (&at));
return GNUNET_JSON_pack_time_abs (name,
at);
}
struct GNUNET_JSON_PackSpec
TALER_JSON_pack_time_abs_human (const char *name,
struct GNUNET_TIME_Absolute at)
@ -49,15 +38,6 @@ TALER_JSON_pack_time_abs_human (const char *name,
}
struct GNUNET_JSON_PackSpec
TALER_JSON_pack_time_abs_nbo (const char *name,
struct GNUNET_TIME_AbsoluteNBO at)
{
return TALER_JSON_pack_time_abs (name,
GNUNET_TIME_absolute_ntoh (at));
}
struct GNUNET_JSON_PackSpec
TALER_JSON_pack_time_abs_nbo_human (const char *name,
struct GNUNET_TIME_AbsoluteNBO at)
@ -67,26 +47,6 @@ TALER_JSON_pack_time_abs_nbo_human (const char *name,
}
struct GNUNET_JSON_PackSpec
TALER_JSON_pack_time_rel (const char *name,
struct GNUNET_TIME_Relative rt)
{
GNUNET_assert (GNUNET_OK ==
GNUNET_TIME_round_rel (&rt));
return GNUNET_JSON_pack_time_rel (name,
rt);
}
struct GNUNET_JSON_PackSpec
TALER_JSON_pack_time_rel_nbo (const char *name,
struct GNUNET_TIME_RelativeNBO rt)
{
return TALER_JSON_pack_time_rel (name,
GNUNET_TIME_relative_ntoh (rt));
}
struct GNUNET_JSON_PackSpec
TALER_JSON_pack_denom_pub (
const char *name,

View File

@ -22,12 +22,6 @@
#include "auditor_api_curl_defaults.h"
/**
* Get a curl handle with the right defaults
* for the exchange lib. In the future, we might manage a pool of connections here.
*
* @param url URL to query
*/
CURL *
TALER_AUDITOR_curl_easy_get_ (const char *url)
{
@ -47,6 +41,12 @@ TALER_AUDITOR_curl_easy_get_ (const char *url)
curl_easy_setopt (eh,
CURLOPT_FOLLOWLOCATION,
1L));
/* Enable compression (using whatever curl likes), see
https://curl.se/libcurl/c/CURLOPT_ACCEPT_ENCODING.html */
GNUNET_break (CURLE_OK ==
curl_easy_setopt (eh,
CURLOPT_ACCEPT_ENCODING,
""));
/* limit MAXREDIRS to 5 as a simple security measure against
a potential infinite loop caused by a malicious target */
GNUNET_assert (CURLE_OK ==

View File

@ -173,18 +173,18 @@ static enum GNUNET_GenericReturnValue
verify_signatures (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 wire_deadline,
struct GNUNET_TIME_Absolute refund_deadline,
struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Timestamp wire_deadline,
struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_Amount *amount_without_fee,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_ExchangePublicKeyP *exchange_pub,
const struct TALER_ExchangeSignatureP *exchange_sig,
const struct TALER_MasterPublicKeyP *master_pub,
struct GNUNET_TIME_Absolute ep_start,
struct GNUNET_TIME_Absolute ep_expire,
struct GNUNET_TIME_Absolute ep_end,
struct GNUNET_TIME_Timestamp ep_start,
struct GNUNET_TIME_Timestamp ep_expire,
struct GNUNET_TIME_Timestamp ep_end,
const struct TALER_MasterSignatureP *master_sig)
{
if (GNUNET_OK !=
@ -223,7 +223,7 @@ verify_signatures (const struct TALER_MerchantWireHash *h_wire,
TALER_LOG_WARNING ("Invalid signature on exchange signing key!\n");
return GNUNET_SYSERR;
}
if (GNUNET_TIME_absolute_is_past (ep_end))
if (GNUNET_TIME_absolute_is_past (ep_end.abs_time))
{
GNUNET_break (0);
TALER_LOG_WARNING ("Exchange signing key is no longer valid!\n");
@ -239,18 +239,18 @@ TALER_AUDITOR_deposit_confirmation (
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 wire_deadline,
struct GNUNET_TIME_Absolute refund_deadline,
struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Timestamp wire_deadline,
struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_Amount *amount_without_fee,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_ExchangePublicKeyP *exchange_pub,
const struct TALER_ExchangeSignatureP *exchange_sig,
const struct TALER_MasterPublicKeyP *master_pub,
struct GNUNET_TIME_Absolute ep_start,
struct GNUNET_TIME_Absolute ep_expire,
struct GNUNET_TIME_Absolute ep_end,
struct GNUNET_TIME_Timestamp ep_start,
struct GNUNET_TIME_Timestamp ep_expire,
struct GNUNET_TIME_Timestamp ep_end,
const struct TALER_MasterSignatureP *master_sig,
TALER_AUDITOR_DepositConfirmationResultCallback cb,
void *cb_cls)
@ -260,11 +260,6 @@ TALER_AUDITOR_deposit_confirmation (
json_t *deposit_confirmation_obj;
CURL *eh;
(void) GNUNET_TIME_round_abs (&exchange_timestamp);
(void) GNUNET_TIME_round_abs (&refund_deadline);
(void) GNUNET_TIME_round_abs (&ep_start);
(void) GNUNET_TIME_round_abs (&ep_expire);
(void) GNUNET_TIME_round_abs (&ep_end);
GNUNET_assert (GNUNET_YES ==
TALER_AUDITOR_handle_is_ready_ (auditor));
if (GNUNET_OK !=
@ -297,12 +292,12 @@ TALER_AUDITOR_deposit_confirmation (
h_extensions),
GNUNET_JSON_pack_data_auto ("h_contract_terms",
h_contract_terms),
GNUNET_JSON_pack_time_abs ("exchange_timestamp",
exchange_timestamp),
GNUNET_JSON_pack_time_abs ("refund_deadline",
refund_deadline),
GNUNET_JSON_pack_time_abs ("wire_deadline",
wire_deadline),
GNUNET_JSON_pack_timestamp ("exchange_timestamp",
exchange_timestamp),
GNUNET_JSON_pack_timestamp ("refund_deadline",
refund_deadline),
GNUNET_JSON_pack_timestamp ("wire_deadline",
wire_deadline),
TALER_JSON_pack_amount ("amount_without_fee",
amount_without_fee),
GNUNET_JSON_pack_data_auto ("coin_pub",
@ -313,12 +308,12 @@ TALER_AUDITOR_deposit_confirmation (
exchange_sig),
GNUNET_JSON_pack_data_auto ("master_pub",
master_pub),
GNUNET_JSON_pack_time_abs ("ep_start",
ep_start),
GNUNET_JSON_pack_time_abs ("ep_expire",
ep_expire),
GNUNET_JSON_pack_time_abs ("ep_end",
ep_end),
GNUNET_JSON_pack_timestamp ("ep_start",
ep_start),
GNUNET_JSON_pack_timestamp ("ep_expire",
ep_expire),
GNUNET_JSON_pack_timestamp ("ep_end",
ep_end),
GNUNET_JSON_pack_data_auto ("master_sig",
master_sig),
GNUNET_JSON_pack_data_auto ("exchange_pub",

View File

@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
#include "auditor_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@ -190,7 +191,7 @@ TALER_EXCHANGE_add_auditor_denomination (
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("auditor_sig",
auditor_sig));
eh = curl_easy_init ();
eh = TALER_AUDITOR_curl_easy_get_ (ah->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&ah->post_ctx,
@ -207,9 +208,6 @@ TALER_EXCHANGE_add_auditor_denomination (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
ah->url);
GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
CURLOPT_URL,
ah->url));
ah->job = GNUNET_CURL_job_add2 (ctx,
eh,
ah->post_ctx.headers,

View File

@ -86,12 +86,12 @@ TALER_EXCHANGE_parse_reserve_history (
{
const char *wire_url;
uint64_t wire_reference;
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Timestamp timestamp;
struct GNUNET_JSON_Specification withdraw_spec[] = {
GNUNET_JSON_spec_uint64 ("wire_reference",
&wire_reference),
TALER_JSON_spec_absolute_time ("timestamp",
&timestamp),
GNUNET_JSON_spec_timestamp ("timestamp",
&timestamp),
GNUNET_JSON_spec_string ("sender_account_url",
&wire_url),
GNUNET_JSON_spec_end ()
@ -226,7 +226,7 @@ TALER_EXCHANGE_parse_reserve_history (
"RECOUP"))
{
struct TALER_RecoupConfirmationPS pc;
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Timestamp timestamp;
const struct TALER_EXCHANGE_Keys *key_state;
struct GNUNET_JSON_Specification recoup_spec[] = {
GNUNET_JSON_spec_fixed_auto ("coin_pub",
@ -235,8 +235,8 @@ TALER_EXCHANGE_parse_reserve_history (
&rh->details.recoup_details.exchange_sig),
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
&rh->details.recoup_details.exchange_pub),
TALER_JSON_spec_absolute_time_nbo ("timestamp",
&pc.timestamp),
GNUNET_JSON_spec_timestamp_nbo ("timestamp",
&pc.timestamp),
GNUNET_JSON_spec_end ()
};
@ -256,7 +256,7 @@ TALER_EXCHANGE_parse_reserve_history (
pc.purpose.size = htonl (sizeof (pc));
pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP);
pc.reserve_pub = *reserve_pub;
timestamp = GNUNET_TIME_absolute_ntoh (pc.timestamp);
timestamp = GNUNET_TIME_timestamp_ntoh (pc.timestamp);
rh->details.recoup_details.timestamp = timestamp;
key_state = TALER_EXCHANGE_get_keys (exchange);
@ -294,7 +294,7 @@ TALER_EXCHANGE_parse_reserve_history (
{
const struct TALER_EXCHANGE_Keys *key_state;
struct TALER_ReserveCloseConfirmationPS rcc;
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Timestamp timestamp;
struct GNUNET_JSON_Specification closing_spec[] = {
GNUNET_JSON_spec_string (
"receiver_account_details",
@ -307,8 +307,8 @@ TALER_EXCHANGE_parse_reserve_history (
&rh->details.close_details.exchange_pub),
TALER_JSON_spec_amount_any_nbo ("closing_fee",
&rcc.closing_fee),
TALER_JSON_spec_absolute_time_nbo ("timestamp",
&rcc.timestamp),
GNUNET_JSON_spec_timestamp_nbo ("timestamp",
&rcc.timestamp),
GNUNET_JSON_spec_end ()
};
@ -330,7 +330,7 @@ TALER_EXCHANGE_parse_reserve_history (
rcc.purpose.size = htonl (sizeof (rcc));
rcc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED);
rcc.reserve_pub = *reserve_pub;
timestamp = GNUNET_TIME_absolute_ntoh (rcc.timestamp);
timestamp = GNUNET_TIME_timestamp_ntoh (rcc.timestamp);
rh->details.close_details.timestamp = timestamp;
TALER_amount_ntoh (&rh->details.close_details.fee,
&rcc.closing_fee);
@ -478,9 +478,9 @@ TALER_EXCHANGE_verify_coin_history (
struct TALER_MerchantWireHash h_wire;
struct TALER_PrivateContractHash h_contract_terms;
// struct TALER_ExtensionContractHash h_extensions; // FIXME!
struct GNUNET_TIME_Absolute wallet_timestamp;
struct GNUNET_TIME_Timestamp wallet_timestamp;
struct TALER_MerchantPublicKeyP merchant_pub;
struct GNUNET_TIME_Absolute refund_deadline = {0};
struct GNUNET_TIME_Timestamp refund_deadline = {0};
struct TALER_CoinSpendSignatureP sig;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("coin_sig",
@ -491,11 +491,11 @@ TALER_EXCHANGE_verify_coin_history (
&h_wire),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
h_denom_pub),
TALER_JSON_spec_absolute_time ("timestamp",
&wallet_timestamp),
GNUNET_JSON_spec_timestamp ("timestamp",
&wallet_timestamp),
GNUNET_JSON_spec_mark_optional (
TALER_JSON_spec_absolute_time ("refund_deadline",
&refund_deadline)),
GNUNET_JSON_spec_timestamp ("refund_deadline",
&refund_deadline)),
TALER_JSON_spec_amount_any ("deposit_fee",
&fee),
GNUNET_JSON_spec_fixed_auto ("merchant_pub",
@ -711,8 +711,8 @@ TALER_EXCHANGE_verify_coin_history (
&rr.coin_blind),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
&rr.h_denom_pub),
TALER_JSON_spec_absolute_time_nbo ("timestamp",
&pc.timestamp),
GNUNET_JSON_spec_timestamp_nbo ("timestamp",
&pc.timestamp),
GNUNET_JSON_spec_end ()
};
@ -781,8 +781,8 @@ TALER_EXCHANGE_verify_coin_history (
&rr.coin_blind),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
&rr.h_denom_pub),
TALER_JSON_spec_absolute_time_nbo ("timestamp",
&pc.timestamp),
GNUNET_JSON_spec_timestamp_nbo ("timestamp",
&pc.timestamp),
GNUNET_JSON_spec_end ()
};
@ -840,8 +840,8 @@ TALER_EXCHANGE_verify_coin_history (
&exchange_pub),
GNUNET_JSON_spec_fixed_auto ("coin_pub",
&pc.coin_pub),
TALER_JSON_spec_absolute_time_nbo ("timestamp",
&pc.timestamp),
GNUNET_JSON_spec_timestamp_nbo ("timestamp",
&pc.timestamp),
GNUNET_JSON_spec_end ()
};

View File

@ -30,7 +30,10 @@ TALER_EXCHANGE_curl_easy_get_ (const char *url)
eh = curl_easy_init ();
if (NULL == eh)
{
GNUNET_break (0);
return NULL;
}
GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh,
CURLOPT_URL,

View File

@ -100,13 +100,13 @@ struct TALER_EXCHANGE_DepositHandle
* Time when this confirmation was generated / when the exchange received
* the deposit request.
*/
struct GNUNET_TIME_Absolute exchange_timestamp;
struct GNUNET_TIME_Timestamp exchange_timestamp;
/**
* By when does the exchange expect to pay the merchant
* (as per the merchant's request).
*/
struct GNUNET_TIME_Absolute wire_deadline;
struct GNUNET_TIME_Timestamp wire_deadline;
/**
* How much time does the @e merchant have to issue a refund
@ -115,7 +115,7 @@ struct TALER_EXCHANGE_DepositHandle
* performed by the exchange until the refund deadline. This value
* is taken from the original deposit request.
*/
struct GNUNET_TIME_Absolute refund_deadline;
struct GNUNET_TIME_Timestamp refund_deadline;
/**
* Amount to be deposited, excluding fee. Calculated from the
@ -334,8 +334,8 @@ handle_deposit_finished (void *cls,
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("transaction_base_url",
&dr.details.success.transaction_base_url)),
TALER_JSON_spec_absolute_time ("exchange_timestamp",
&dh->exchange_timestamp),
GNUNET_JSON_spec_timestamp ("exchange_timestamp",
&dh->exchange_timestamp),
GNUNET_JSON_spec_end ()
};
@ -481,9 +481,9 @@ verify_signatures (const struct TALER_EXCHANGE_DenomPublicKey *dki,
const struct TALER_DenominationSignature *denom_sig,
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_DenominationHash *denom_pub_hash,
struct GNUNET_TIME_Absolute timestamp,
struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
struct GNUNET_TIME_Absolute refund_deadline,
struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_CoinSpendSignatureP *coin_sig)
{
if (GNUNET_OK !=
@ -543,7 +543,7 @@ struct TALER_EXCHANGE_DepositHandle *
TALER_EXCHANGE_deposit (
struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_Amount *amount,
struct GNUNET_TIME_Absolute wire_deadline,
struct GNUNET_TIME_Timestamp wire_deadline,
const char *merchant_payto_uri,
const struct TALER_WireSalt *wire_salt,
const struct TALER_PrivateContractHash *h_contract_terms,
@ -551,9 +551,9 @@ TALER_EXCHANGE_deposit (
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_DenominationSignature *denom_sig,
const struct TALER_DenominationPublicKey *denom_pub,
struct GNUNET_TIME_Absolute timestamp,
struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
struct GNUNET_TIME_Absolute refund_deadline,
struct GNUNET_TIME_Timestamp refund_deadline,
const struct TALER_CoinSpendSignatureP *coin_sig,
TALER_EXCHANGE_DepositResultCallback cb,
void *cb_cls,
@ -589,9 +589,9 @@ TALER_EXCHANGE_deposit (
"/coins/%s/deposit",
pub_str);
}
(void) GNUNET_TIME_round_abs (&wire_deadline);
(void) GNUNET_TIME_round_abs (&refund_deadline);
if (refund_deadline.abs_value_us > wire_deadline.abs_value_us)
if (GNUNET_TIME_timestamp_cmp (refund_deadline,
>,
wire_deadline))
{
GNUNET_break_op (0);
*ec = TALER_EC_EXCHANGE_DEPOSIT_REFUND_DEADLINE_AFTER_WIRE_DEADLINE;
@ -658,15 +658,15 @@ TALER_EXCHANGE_deposit (
&denom_pub_hash),
TALER_JSON_pack_denom_sig ("ub_sig",
denom_sig),
GNUNET_JSON_pack_time_abs ("timestamp",
timestamp),
GNUNET_JSON_pack_timestamp ("timestamp",
timestamp),
GNUNET_JSON_pack_data_auto ("merchant_pub",
merchant_pub),
GNUNET_JSON_pack_allow_null (
GNUNET_JSON_pack_time_abs ("refund_deadline",
refund_deadline)),
GNUNET_JSON_pack_time_abs ("wire_transfer_deadline",
wire_deadline),
GNUNET_JSON_pack_timestamp ("refund_deadline",
refund_deadline)),
GNUNET_JSON_pack_timestamp ("wire_transfer_deadline",
wire_deadline),
GNUNET_JSON_pack_data_auto ("coin_sig",
coin_sig));
dh = GNUNET_new (struct TALER_EXCHANGE_DepositHandle);

View File

@ -147,8 +147,8 @@ handle_deposit_wtid_finished (void *cls,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("wtid",
&dr.details.success.wtid),
TALER_JSON_spec_absolute_time ("execution_time",
&dr.details.success.execution_time),
GNUNET_JSON_spec_timestamp ("execution_time",
&dr.details.success.execution_time),
TALER_JSON_spec_amount_any ("coin_contribution",
&dr.details.success.coin_contribution),
GNUNET_JSON_spec_fixed_auto ("exchange_sig",
@ -168,7 +168,7 @@ handle_deposit_wtid_finished (void *cls,
dr.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
break;
}
dwh->depconf.execution_time = GNUNET_TIME_absolute_hton (
dwh->depconf.execution_time = GNUNET_TIME_timestamp_hton (
dr.details.success.execution_time);
dwh->depconf.wtid = dr.details.success.wtid;
TALER_amount_hton (&dwh->depconf.coin_contribution,
@ -192,8 +192,8 @@ handle_deposit_wtid_finished (void *cls,
{
/* Transaction known, but not executed yet */
struct GNUNET_JSON_Specification spec[] = {
TALER_JSON_spec_absolute_time ("execution_time",
&dr.details.accepted.execution_time),
GNUNET_JSON_spec_timestamp ("execution_time",
&dr.details.accepted.execution_time),
GNUNET_JSON_spec_uint64 ("payment_target_uuid",
&dr.details.accepted.payment_target_uuid),
GNUNET_JSON_spec_bool ("kyc_ok",

View File

@ -39,7 +39,7 @@
* Which version of the Taler protocol is implemented
* by this library? Used to determine compatibility.
*/
#define EXCHANGE_PROTOCOL_CURRENT 10
#define EXCHANGE_PROTOCOL_CURRENT 11
/**
* How many versions are we backwards compatible with?
@ -161,7 +161,7 @@ struct KeysRequest
* Expiration time according to "Expire:" header.
* 0 if not provided by the server.
*/
struct GNUNET_TIME_Absolute expire;
struct GNUNET_TIME_Timestamp expire;
};
@ -264,12 +264,12 @@ parse_json_signkey (struct TALER_EXCHANGE_SigningPublicKey *sign_key,
&sign_key_issue_sig),
GNUNET_JSON_spec_fixed_auto ("key",
&sign_key->key),
TALER_JSON_spec_absolute_time ("stamp_start",
&sign_key->valid_from),
TALER_JSON_spec_absolute_time ("stamp_expire",
&sign_key->valid_until),
TALER_JSON_spec_absolute_time ("stamp_end",
&sign_key->valid_legal),
GNUNET_JSON_spec_timestamp ("stamp_start",
&sign_key->valid_from),
GNUNET_JSON_spec_timestamp ("stamp_expire",
&sign_key->valid_until),
GNUNET_JSON_spec_timestamp ("stamp_end",
&sign_key->valid_legal),
GNUNET_JSON_spec_end ()
};
@ -322,14 +322,14 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("master_sig",
&denom_key->master_sig),
TALER_JSON_spec_absolute_time ("stamp_expire_deposit",
&denom_key->expire_deposit),
TALER_JSON_spec_absolute_time ("stamp_expire_withdraw",
&denom_key->withdraw_valid_until),
TALER_JSON_spec_absolute_time ("stamp_start",
&denom_key->valid_from),
TALER_JSON_spec_absolute_time ("stamp_expire_legal",
&denom_key->expire_legal),
GNUNET_JSON_spec_timestamp ("stamp_expire_deposit",
&denom_key->expire_deposit),
GNUNET_JSON_spec_timestamp ("stamp_expire_withdraw",
&denom_key->withdraw_valid_until),
GNUNET_JSON_spec_timestamp ("stamp_start",
&denom_key->valid_from),
GNUNET_JSON_spec_timestamp ("stamp_expire_legal",
&denom_key->expire_legal),
TALER_JSON_spec_amount_any ("value",
&denom_key->value),
TALER_JSON_spec_amount_any ("fee_withdraw",
@ -675,10 +675,10 @@ decode_keys_json (const json_t *resp_obj,
&pub),
GNUNET_JSON_spec_fixed_auto ("master_public_key",
&key_data->master_pub),
TALER_JSON_spec_absolute_time ("list_issue_date",
&key_data->list_issue_date),
TALER_JSON_spec_relative_time ("reserve_closing_delay",
&key_data->reserve_closing_delay),
GNUNET_JSON_spec_timestamp ("list_issue_date",
&key_data->list_issue_date),
GNUNET_JSON_spec_relative_time ("reserve_closing_delay",
&key_data->reserve_closing_delay),
GNUNET_JSON_spec_string ("currency",
&currency),
GNUNET_JSON_spec_mark_optional (
@ -843,10 +843,10 @@ decode_keys_json (const json_t *resp_obj,
/* Update "last_denom_issue_date" */
TALER_LOG_DEBUG ("Adding denomination key that is valid_until %s\n",
GNUNET_STRINGS_absolute_time_to_string (dk.valid_from));
GNUNET_TIME_timestamp2s (dk.valid_from));
key_data->last_denom_issue_date
= GNUNET_TIME_absolute_max (key_data->last_denom_issue_date,
dk.valid_from);
= GNUNET_TIME_timestamp_max (key_data->last_denom_issue_date,
dk.valid_from);
};
}
@ -970,7 +970,7 @@ decode_keys_json (const json_t *resp_obj,
struct TALER_ExchangeKeySetPS ks = {
.purpose.size = htonl (sizeof (ks)),
.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_KEY_SET),
.list_issue_date = GNUNET_TIME_absolute_hton (key_data->list_issue_date)
.list_issue_date = GNUNET_TIME_timestamp_hton (key_data->list_issue_date)
};
GNUNET_CRYPTO_hash_context_finish (hash_context,
@ -1040,16 +1040,16 @@ request_keys (void *cls);
void
TALER_EXCHANGE_set_last_denom (struct TALER_EXCHANGE_Handle *exchange,
struct GNUNET_TIME_Absolute last_denom_new)
struct GNUNET_TIME_Timestamp last_denom_new)
{
TALER_LOG_DEBUG (
"Application explicitly set last denomination validity to %s\n",
GNUNET_STRINGS_absolute_time_to_string (last_denom_new));
GNUNET_TIME_timestamp2s (last_denom_new));
exchange->key_data.last_denom_issue_date = last_denom_new;
}
struct GNUNET_TIME_Absolute
struct GNUNET_TIME_Timestamp
TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange,
enum TALER_EXCHANGE_CheckKeysFlags flags)
{
@ -1057,7 +1057,7 @@ TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange,
bool pull_all_keys = 0 != (flags & TALER_EXCHANGE_CKF_PULL_ALL_KEYS);
if (NULL != exchange->kr)
return GNUNET_TIME_UNIT_ZERO_ABS;
return GNUNET_TIME_UNIT_ZERO_TS;
if (pull_all_keys)
{
@ -1067,12 +1067,13 @@ TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange,
exchange->state = MHS_INIT;
}
if ( (! force_download) &&
(GNUNET_TIME_absolute_is_future (exchange->key_data_expiration)) )
(GNUNET_TIME_absolute_is_future (
exchange->key_data_expiration.abs_time)) )
return exchange->key_data_expiration;
if (NULL == exchange->retry_task)
exchange->retry_task = GNUNET_SCHEDULER_add_now (&request_keys,
exchange);
return GNUNET_TIME_UNIT_ZERO_ABS;
return GNUNET_TIME_UNIT_ZERO_TS;
}
@ -1104,15 +1105,16 @@ keys_completed_cb (void *cls,
"Received keys from URL `%s' with status %ld and expiration %s.\n",
kr->url,
response_code,
GNUNET_STRINGS_absolute_time_to_string (kr->expire));
if (GNUNET_TIME_absolute_is_past (kr->expire))
GNUNET_TIME_timestamp2s (kr->expire));
if (GNUNET_TIME_absolute_is_past (kr->expire.abs_time))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Exchange failed to give expiration time, assuming in %s\n",
GNUNET_STRINGS_relative_time_to_string (DEFAULT_EXPIRATION,
GNUNET_YES));
kr->expire = GNUNET_TIME_relative_to_absolute (DEFAULT_EXPIRATION);
(void) GNUNET_TIME_round_abs (&kr->expire);
GNUNET_TIME_relative2s (DEFAULT_EXPIRATION,
true));
kr->expire
= GNUNET_TIME_absolute_to_timestamp (
GNUNET_TIME_relative_to_absolute (DEFAULT_EXPIRATION));
}
kd_old = exchange->key_data;
memset (&kd,
@ -1250,13 +1252,14 @@ keys_completed_cb (void *cls,
break;
}
exchange->key_data = kd;
if (GNUNET_TIME_absolute_is_past (exchange->key_data.last_denom_issue_date))
if (GNUNET_TIME_absolute_is_past (
exchange->key_data.last_denom_issue_date.abs_time))
TALER_LOG_WARNING ("Last DK issue date from exchange is in the past: %s\n",
GNUNET_STRINGS_absolute_time_to_string (
GNUNET_TIME_timestamp2s (
exchange->key_data.last_denom_issue_date));
else
TALER_LOG_DEBUG ("Last DK issue date updated to: %s\n",
GNUNET_STRINGS_absolute_time_to_string (
GNUNET_TIME_timestamp2s (
exchange->key_data.last_denom_issue_date));
@ -1340,7 +1343,7 @@ TEAH_path_to_url (struct TALER_EXCHANGE_Handle *h,
*/
static enum GNUNET_GenericReturnValue
parse_date_string (const char *dateline,
struct GNUNET_TIME_Absolute *at)
struct GNUNET_TIME_Timestamp *at)
{
static const char *MONTHS[] =
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
@ -1422,7 +1425,7 @@ parse_date_string (const char *dateline,
}
if (t < 0)
t = 0; /* can happen due to timezone issues if date was 1.1.1970 */
at->abs_value_us = 1000LL * 1000LL * t;
*at = GNUNET_TIME_timestamp_from_s (t);
return GNUNET_OK;
}
@ -1464,7 +1467,7 @@ header_cb (char *buffer,
"Failed to parse %s-header `%s'\n",
MHD_HTTP_HEADER_EXPIRES,
val);
kr->expire = GNUNET_TIME_UNIT_ZERO_ABS;
kr->expire = GNUNET_TIME_UNIT_ZERO_TS;
}
GNUNET_free (val);
return total;
@ -1490,7 +1493,7 @@ deserialize_data (struct TALER_EXCHANGE_Handle *exchange,
json_t *keys;
const char *url;
uint32_t version;
struct GNUNET_TIME_Absolute expire;
struct GNUNET_TIME_Timestamp expire;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_uint32 ("version",
&version),
@ -1498,8 +1501,8 @@ deserialize_data (struct TALER_EXCHANGE_Handle *exchange,
&keys),
GNUNET_JSON_spec_string ("exchange_url",
&url),
TALER_JSON_spec_absolute_time ("expire",
&expire),
GNUNET_JSON_spec_timestamp ("expire",
&expire),
GNUNET_JSON_spec_end ()
};
struct TALER_EXCHANGE_Keys key_data;
@ -1566,13 +1569,13 @@ json_t *
TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
{
const struct TALER_EXCHANGE_Keys *kd = &exchange->key_data;
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Timestamp now;
json_t *keys;
json_t *signkeys;
json_t *denoms;
json_t *auditors;
now = GNUNET_TIME_absolute_get ();
now = GNUNET_TIME_timestamp_get ();
signkeys = json_array ();
if (NULL == signkeys)
{
@ -1584,19 +1587,21 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
const struct TALER_EXCHANGE_SigningPublicKey *sk = &kd->sign_keys[i];
json_t *signkey;
if (now.abs_value_us > sk->valid_until.abs_value_us)
if (GNUNET_TIME_timestamp_cmp (now,
>,
sk->valid_until))
continue; /* skip keys that have expired */
signkey = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("key",
&sk->key),
GNUNET_JSON_pack_data_auto ("master_sig",
&sk->master_sig),
GNUNET_JSON_pack_time_abs ("stamp_start",
sk->valid_from),
GNUNET_JSON_pack_time_abs ("stamp_expire",
sk->valid_until),
GNUNET_JSON_pack_time_abs ("stamp_end",
sk->valid_legal));
GNUNET_JSON_pack_timestamp ("stamp_start",
sk->valid_from),
GNUNET_JSON_pack_timestamp ("stamp_expire",
sk->valid_until),
GNUNET_JSON_pack_timestamp ("stamp_end",
sk->valid_legal));
if (NULL == signkey)
{
GNUNET_break (0);
@ -1623,17 +1628,19 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
const struct TALER_EXCHANGE_DenomPublicKey *dk = &kd->denom_keys[i];
json_t *denom;
if (now.abs_value_us > dk->expire_deposit.abs_value_us)
if (GNUNET_TIME_timestamp_cmp (now,
>,
dk->expire_deposit))
continue; /* skip keys that have expired */
denom = GNUNET_JSON_PACK (
GNUNET_JSON_pack_time_abs ("stamp_expire_deposit",
dk->expire_deposit),
GNUNET_JSON_pack_time_abs ("stamp_expire_withdraw",
dk->withdraw_valid_until),
GNUNET_JSON_pack_time_abs ("stamp_start",
dk->valid_from),
GNUNET_JSON_pack_time_abs ("stamp_expire_legal",
dk->expire_legal),
GNUNET_JSON_pack_timestamp ("stamp_expire_deposit",
dk->expire_deposit),
GNUNET_JSON_pack_timestamp ("stamp_expire_withdraw",
dk->withdraw_valid_until),
GNUNET_JSON_pack_timestamp ("stamp_start",
dk->valid_from),
GNUNET_JSON_pack_timestamp ("stamp_expire_legal",
dk->expire_legal),
TALER_JSON_pack_amount ("value",
&dk->value),
TALER_JSON_pack_amount ("fee_withdraw",
@ -1677,7 +1684,9 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
&kd->denom_keys[adi->denom_key_offset];
json_t *k;
if (now.abs_value_us > dk->expire_deposit.abs_value_us)
if (GNUNET_TIME_timestamp_cmp (now,
>,
dk->expire_deposit))
continue; /* skip auditor signatures for denomination keys that have expired */
GNUNET_assert (adi->denom_key_offset < kd->num_denom_keys);
k = GNUNET_JSON_PACK (
@ -1710,8 +1719,8 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
&kd->master_pub),
GNUNET_JSON_pack_time_rel ("reserve_closing_delay",
kd->reserve_closing_delay),
GNUNET_JSON_pack_time_abs ("list_issue_date",
kd->list_issue_date),
GNUNET_JSON_pack_timestamp ("list_issue_date",
kd->list_issue_date),
GNUNET_JSON_pack_array_steal ("signkeys",
signkeys),
GNUNET_JSON_pack_array_steal ("denoms",
@ -1721,8 +1730,8 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
return GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("version",
EXCHANGE_SERIALIZATION_FORMAT_VERSION),
GNUNET_JSON_pack_time_abs ("expire",
exchange->key_data_expiration),
GNUNET_JSON_pack_timestamp ("expire",
exchange->key_data_expiration),
GNUNET_JSON_pack_string ("exchange_url",
exchange->url),
GNUNET_JSON_pack_object_steal ("keys",
@ -1823,12 +1832,12 @@ request_keys (void *cls)
if (GNUNET_YES == TEAH_handle_is_ready (exchange))
{
TALER_LOG_DEBUG ("Last DK issue date (before GETting /keys): %s\n",
GNUNET_STRINGS_absolute_time_to_string (
GNUNET_TIME_timestamp2s (
exchange->key_data.last_denom_issue_date));
sprintf (&url[strlen (url)],
"last_issue_date=%llu&",
(unsigned long
long) exchange->key_data.last_denom_issue_date.abs_value_us
(unsigned long long)
exchange->key_data.last_denom_issue_date.abs_time.abs_value_us
/ 1000000LLU);
}
@ -1951,18 +1960,22 @@ TALER_EXCHANGE_test_signing_key (const struct TALER_EXCHANGE_Keys *keys,
/* we will check using a tolerance of 1h for the time */
now = GNUNET_TIME_absolute_get ();
for (unsigned int i = 0; i<keys->num_sign_keys; i++)
if ( (keys->sign_keys[i].valid_from.abs_value_us <=
GNUNET_TIME_absolute_add (now,
LIFETIME_TOLERANCE).abs_value_us) &&
(keys->sign_keys[i].valid_until.abs_value_us >
GNUNET_TIME_absolute_subtract (now,
LIFETIME_TOLERANCE).abs_value_us) &&
if ( (GNUNET_TIME_absolute_cmp (
keys->sign_keys[i].valid_from.abs_time,
<=,
GNUNET_TIME_absolute_add (now,
LIFETIME_TOLERANCE))) &&
(GNUNET_TIME_absolute_cmp (
keys->sign_keys[i].valid_until.abs_time,
>,
GNUNET_TIME_absolute_subtract (now,
LIFETIME_TOLERANCE))) &&
(0 == GNUNET_memcmp (pub,
&keys->sign_keys[i].key)) )
return GNUNET_OK;
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Signing key not valid at time %llu\n",
(unsigned long long) now.abs_value_us);
"Signing key not valid at time %s\n",
GNUNET_TIME_absolute2s (now));
return GNUNET_SYSERR;
}

View File

@ -147,7 +147,7 @@ struct TALER_EXCHANGE_Handle
/**
* When does @e key_data expire?
*/
struct GNUNET_TIME_Absolute key_data_expiration;
struct GNUNET_TIME_Timestamp key_data_expiration;
/**
* Number of subsequent failed requests to /keys.

View File

@ -100,8 +100,8 @@ handle_kyc_check_finished (void *cls,
&ks.details.kyc_ok.exchange_sig),
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
&ks.details.kyc_ok.exchange_pub),
TALER_JSON_spec_absolute_time ("now",
&ks.details.kyc_ok.timestamp),
GNUNET_JSON_spec_timestamp ("now",
&ks.details.kyc_ok.timestamp),
GNUNET_JSON_spec_end ()
};
const struct TALER_EXCHANGE_Keys *key_state;
@ -122,7 +122,7 @@ handle_kyc_check_finished (void *cls,
ks.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
break;
}
kyc_purpose.timestamp = GNUNET_TIME_absolute_hton (
kyc_purpose.timestamp = GNUNET_TIME_timestamp_hton (
ks.details.kyc_ok.timestamp);
key_state = TALER_EXCHANGE_get_keys (kch->exchange);
if (GNUNET_OK !=

View File

@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@ -128,7 +129,7 @@ TALER_EXCHANGE_management_disable_auditor (
struct GNUNET_CURL_Context *ctx,
const char *url,
const struct TALER_AuditorPublicKeyP *auditor_pub,
struct GNUNET_TIME_Absolute validity_end,
struct GNUNET_TIME_Timestamp validity_end,
const struct TALER_MasterSignatureP *master_sig,
TALER_EXCHANGE_ManagementAuditorDisableCallback cb,
void *cb_cls)
@ -169,9 +170,9 @@ TALER_EXCHANGE_management_disable_auditor (
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("master_sig",
master_sig),
GNUNET_JSON_pack_time_abs ("validity_end",
validity_end));
eh = curl_easy_init ();
GNUNET_JSON_pack_timestamp ("validity_end",
validity_end));
eh = TALER_EXCHANGE_curl_easy_get_ (ah->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&ah->post_ctx,
@ -188,9 +189,6 @@ TALER_EXCHANGE_management_disable_auditor (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
ah->url);
GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
CURLOPT_URL,
ah->url));
ah->job = GNUNET_CURL_job_add2 (ctx,
eh,
ah->post_ctx.headers,

View File

@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@ -127,7 +128,7 @@ TALER_EXCHANGE_management_enable_auditor (
const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url,
const char *auditor_name,
struct GNUNET_TIME_Absolute validity_start,
struct GNUNET_TIME_Timestamp validity_start,
const struct TALER_MasterSignatureP *master_sig,
TALER_EXCHANGE_ManagementAuditorEnableCallback cb,
void *cb_cls)
@ -159,9 +160,9 @@ TALER_EXCHANGE_management_enable_auditor (
auditor_pub),
GNUNET_JSON_pack_data_auto ("master_sig",
master_sig),
GNUNET_JSON_pack_time_abs ("validity_start",
validity_start));
eh = curl_easy_init ();
GNUNET_JSON_pack_timestamp ("validity_start",
validity_start));
eh = TALER_EXCHANGE_curl_easy_get_ (ah->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&ah->post_ctx,
@ -178,9 +179,6 @@ TALER_EXCHANGE_management_enable_auditor (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
ah->url);
GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
CURLOPT_URL,
ah->url));
ah->job = GNUNET_CURL_job_add2 (ctx,
eh,
ah->post_ctx.headers,

View File

@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_crypto_lib.h"
@ -124,12 +125,12 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
&sign_key->key),
GNUNET_JSON_spec_fixed_auto ("signkey_secmod_sig",
&sign_key->signkey_secmod_sig),
TALER_JSON_spec_absolute_time ("stamp_start",
&sign_key->valid_from),
TALER_JSON_spec_absolute_time ("stamp_expire",
&sign_key->valid_until),
TALER_JSON_spec_absolute_time ("stamp_end",
&sign_key->valid_legal),
GNUNET_JSON_spec_timestamp ("stamp_start",
&sign_key->valid_from),
GNUNET_JSON_spec_timestamp ("stamp_expire",
&sign_key->valid_until),
GNUNET_JSON_spec_timestamp ("stamp_end",
&sign_key->valid_legal),
GNUNET_JSON_spec_end ()
};
@ -144,8 +145,8 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
}
{
struct GNUNET_TIME_Relative duration
= GNUNET_TIME_absolute_get_difference (sign_key->valid_from,
sign_key->valid_until);
= GNUNET_TIME_absolute_get_difference (sign_key->valid_from.abs_time,
sign_key->valid_until.abs_time);
if (GNUNET_OK !=
TALER_exchange_secmod_eddsa_verify (
@ -171,14 +172,14 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
struct GNUNET_JSON_Specification spec[] = {
TALER_JSON_spec_amount_any ("value",
&denom_key->value),
TALER_JSON_spec_absolute_time ("stamp_start",
&denom_key->valid_from),
TALER_JSON_spec_absolute_time ("stamp_expire_withdraw",
&denom_key->withdraw_valid_until),
TALER_JSON_spec_absolute_time ("stamp_expire_deposit",
&denom_key->expire_deposit),
TALER_JSON_spec_absolute_time ("stamp_expire_legal",
&denom_key->expire_legal),
GNUNET_JSON_spec_timestamp ("stamp_start",
&denom_key->valid_from),
GNUNET_JSON_spec_timestamp ("stamp_expire_withdraw",
&denom_key->withdraw_valid_until),
GNUNET_JSON_spec_timestamp ("stamp_expire_deposit",
&denom_key->expire_deposit),
GNUNET_JSON_spec_timestamp ("stamp_expire_legal",
&denom_key->expire_legal),
TALER_JSON_spec_denom_pub ("denom_pub",
&denom_key->key),
TALER_JSON_spec_amount_any ("fee_withdraw",
@ -214,8 +215,9 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
{
struct TALER_DenominationHash h_denom_pub;
struct GNUNET_TIME_Relative duration
= GNUNET_TIME_absolute_get_difference (denom_key->valid_from,
denom_key->withdraw_valid_until);
= GNUNET_TIME_absolute_get_difference (
denom_key->valid_from.abs_time,
denom_key->withdraw_valid_until.abs_time);
TALER_denom_pub_hash (&denom_key->key,
&h_denom_pub);
@ -335,16 +337,6 @@ handle_get_keys_finished (void *cls,
};
/**
* Request future keys from the exchange. The obtained information will be
* passed to the @a cb.
*
* @param ctx the context
* @param url HTTP base URL for the exchange
* @param cb function to call with the exchange's future keys result
* @param cb_cls closure for @a cb
* @return the request handle; NULL upon error
*/
struct TALER_EXCHANGE_ManagementGetKeysHandle *
TALER_EXCHANGE_get_management_keys (struct GNUNET_CURL_Context *ctx,
const char *url,
@ -368,14 +360,10 @@ TALER_EXCHANGE_get_management_keys (struct GNUNET_CURL_Context *ctx,
GNUNET_free (gh);
return NULL;
}
eh = curl_easy_init ();
eh = TALER_EXCHANGE_curl_easy_get_ (gh->url);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
gh->url);
GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh,
CURLOPT_URL,
gh->url));
gh->job = GNUNET_CURL_job_add (ctx,
eh,
&handle_get_keys_finished,
@ -389,11 +377,6 @@ TALER_EXCHANGE_get_management_keys (struct GNUNET_CURL_Context *ctx,
}
/**
* Cancel #TALER_EXCHANGE_get_management_keys() operation.
*
* @param gh handle of the operation to cancel
*/
void
TALER_EXCHANGE_get_management_keys_cancel (
struct TALER_EXCHANGE_ManagementGetKeysHandle *gh)

View File

@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@ -189,7 +190,7 @@ TALER_EXCHANGE_post_management_keys (
denom_sigs),
GNUNET_JSON_pack_array_steal ("signkey_sigs",
signkey_sigs));
eh = curl_easy_init ();
eh = TALER_EXCHANGE_curl_easy_get_ (ph->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&ph->post_ctx,
@ -206,9 +207,6 @@ TALER_EXCHANGE_post_management_keys (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
ph->url);
GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
CURLOPT_URL,
ph->url));
ph->job = GNUNET_CURL_job_add2 (ctx,
eh,
ph->post_ctx.headers,

View File

@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@ -173,7 +174,7 @@ TALER_EXCHANGE_management_revoke_denomination_key (
GNUNET_free (rh);
return NULL;
}
eh = curl_easy_init ();
eh = TALER_EXCHANGE_curl_easy_get_ (rh->url);
if (GNUNET_OK !=
TALER_curl_easy_post (&rh->post_ctx,
eh,
@ -189,9 +190,6 @@ TALER_EXCHANGE_management_revoke_denomination_key (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
rh->url);
GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
CURLOPT_URL,
rh->url));
rh->job = GNUNET_CURL_job_add2 (ctx,
eh,
rh->post_ctx.headers,

View File

@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@ -163,7 +164,7 @@ TALER_EXCHANGE_management_revoke_signing_key (
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("master_sig",
master_sig));
eh = curl_easy_init ();
eh = TALER_EXCHANGE_curl_easy_get_ (rh->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&rh->post_ctx,
@ -180,9 +181,6 @@ TALER_EXCHANGE_management_revoke_signing_key (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
rh->url);
GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
CURLOPT_URL,
rh->url));
rh->job = GNUNET_CURL_job_add2 (ctx,
eh,
rh->post_ctx.headers,

View File

@ -22,6 +22,7 @@
#include "platform.h"
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "exchange_api_curl_defaults.h"
#include "taler_exchange_service.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
@ -126,8 +127,8 @@ TALER_EXCHANGE_management_set_wire_fees (
struct GNUNET_CURL_Context *ctx,
const char *exchange_base_url,
const char *wire_method,
struct GNUNET_TIME_Absolute validity_start,
struct GNUNET_TIME_Absolute validity_end,
struct GNUNET_TIME_Timestamp validity_start,
struct GNUNET_TIME_Timestamp validity_end,
const struct TALER_Amount *wire_fee,
const struct TALER_Amount *closing_fee,
const struct TALER_MasterSignatureP *master_sig,
@ -157,15 +158,15 @@ TALER_EXCHANGE_management_set_wire_fees (
wire_method),
GNUNET_JSON_pack_data_auto ("master_sig",
master_sig),
GNUNET_JSON_pack_time_abs ("fee_start",
validity_start),
GNUNET_JSON_pack_time_abs ("fee_end",
validity_end),
GNUNET_JSON_pack_timestamp ("fee_start",
validity_start),
GNUNET_JSON_pack_timestamp ("fee_end",
validity_end),
TALER_JSON_pack_amount ("closing_fee",
closing_fee),
TALER_JSON_pack_amount ("wire_fee",
wire_fee));
eh = curl_easy_init ();
eh = TALER_EXCHANGE_curl_easy_get_ (swfh->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&swfh->post_ctx,
@ -182,9 +183,6 @@ TALER_EXCHANGE_management_set_wire_fees (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
swfh->url);
GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
CURLOPT_URL,
swfh->url));
swfh->job = GNUNET_CURL_job_add2 (ctx,
eh,
swfh->post_ctx.headers,

View File

@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@ -131,7 +132,7 @@ TALER_EXCHANGE_management_disable_wire (
struct GNUNET_CURL_Context *ctx,
const char *url,
const char *payto_uri,
struct GNUNET_TIME_Absolute validity_end,
struct GNUNET_TIME_Timestamp validity_end,
const struct TALER_MasterSignatureP *master_sig,
TALER_EXCHANGE_ManagementWireDisableCallback cb,
void *cb_cls)
@ -159,9 +160,9 @@ TALER_EXCHANGE_management_disable_wire (
payto_uri),
GNUNET_JSON_pack_data_auto ("master_sig_del",
master_sig),
GNUNET_JSON_pack_time_abs ("validity_end",
validity_end));
eh = curl_easy_init ();
GNUNET_JSON_pack_timestamp ("validity_end",
validity_end));
eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&wh->post_ctx,
@ -178,9 +179,6 @@ TALER_EXCHANGE_management_disable_wire (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
wh->url);
GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
CURLOPT_URL,
wh->url));
wh->job = GNUNET_CURL_job_add2 (ctx,
eh,
wh->post_ctx.headers,

View File

@ -23,6 +23,7 @@
#include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler_exchange_service.h"
#include "exchange_api_curl_defaults.h"
#include "taler_signatures.h"
#include "taler_curl_lib.h"
#include "taler_json_lib.h"
@ -127,7 +128,7 @@ TALER_EXCHANGE_management_enable_wire (
struct GNUNET_CURL_Context *ctx,
const char *url,
const char *payto_uri,
struct GNUNET_TIME_Absolute validity_start,
struct GNUNET_TIME_Timestamp validity_start,
const struct TALER_MasterSignatureP *master_sig1,
const struct TALER_MasterSignatureP *master_sig2,
TALER_EXCHANGE_ManagementWireEnableCallback cb,
@ -158,9 +159,9 @@ TALER_EXCHANGE_management_enable_wire (
master_sig1),
GNUNET_JSON_pack_data_auto ("master_sig_wire",
master_sig2),
GNUNET_JSON_pack_time_abs ("validity_start",
validity_start));
eh = curl_easy_init ();
GNUNET_JSON_pack_timestamp ("validity_start",
validity_start));
eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=
TALER_curl_easy_post (&wh->post_ctx,
@ -177,9 +178,6 @@ TALER_EXCHANGE_management_enable_wire (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
wh->url);
GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
CURLOPT_URL,
wh->url));
wh->job = GNUNET_CURL_job_add2 (ctx,
eh,
wh->post_ctx.headers,

View File

@ -305,6 +305,7 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_EXCHANGE_DenomPublicKey *pk,
const struct TALER_DenominationSignature *denom_sig,
const struct TALER_PlanchetSecretsP *ps,
const struct TALER_Amount *amount,
bool was_refreshed,
TALER_EXCHANGE_RecoupResultCallback recoup_cb,
void *recoup_cb_cls)
@ -336,6 +337,8 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
&h_denom_pub),
TALER_JSON_pack_denom_sig ("denom_sig",
denom_sig),
TALER_JSON_pack_amount ("amount",
amount),
GNUNET_JSON_pack_data_auto ("coin_sig",
&coin_sig),
GNUNET_JSON_pack_data_auto ("coin_blind_key_secret",

View File

@ -89,8 +89,8 @@ serialize_melted_coin (const struct MeltedCoin *mc)
&mc->original_value),
TALER_JSON_pack_amount ("melt_fee",
&mc->fee_melt),
GNUNET_JSON_pack_time_abs ("expire_deposit",
mc->expire_deposit),
GNUNET_JSON_pack_timestamp ("expire_deposit",
mc->expire_deposit),
GNUNET_JSON_pack_array_steal ("transfer_privs",
tprivs));
}
@ -126,8 +126,8 @@ deserialize_melted_coin (struct MeltedCoin *mc,
TALER_JSON_spec_amount ("melt_fee",
currency,
&mc->fee_melt),
TALER_JSON_spec_absolute_time ("expire_deposit",
&mc->expire_deposit),
GNUNET_JSON_spec_timestamp ("expire_deposit",
&mc->expire_deposit),
GNUNET_JSON_spec_json ("transfer_privs",
&trans_privs),
GNUNET_JSON_spec_end ()

View File

@ -60,7 +60,7 @@ struct MeltedCoin
/**
* Timestamp indicating when coins of this denomination become invalid.
*/
struct GNUNET_TIME_Absolute expire_deposit;
struct GNUNET_TIME_Timestamp expire_deposit;
/**
* Denomination key of the original coin.

View File

@ -203,9 +203,9 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
struct TALER_PrivateContractHash h_contract_terms;
// struct TALER_ExtensionContractHash h_extensions; // FIXME!
struct TALER_DenominationHash h_denom_pub;
struct GNUNET_TIME_Absolute wallet_timestamp;
struct GNUNET_TIME_Timestamp wallet_timestamp;
struct TALER_MerchantPublicKeyP merchant_pub;
struct GNUNET_TIME_Absolute refund_deadline;
struct GNUNET_TIME_Timestamp refund_deadline;
struct TALER_CoinSpendSignatureP sig;
struct GNUNET_JSON_Specification ispec[] = {
GNUNET_JSON_spec_fixed_auto ("coin_sig",
@ -216,10 +216,10 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&h_wire),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
&h_denom_pub),
TALER_JSON_spec_absolute_time ("timestamp",
&wallet_timestamp),
TALER_JSON_spec_absolute_time ("refund_deadline",
&refund_deadline),
GNUNET_JSON_spec_timestamp ("timestamp",
&wallet_timestamp),
GNUNET_JSON_spec_timestamp ("refund_deadline",
&refund_deadline),
TALER_JSON_spec_amount_any ("deposit_fee",
&deposit_fee),
GNUNET_JSON_spec_fixed_auto ("merchant_pub",

View File

@ -93,7 +93,7 @@ check_transfers_get_response_ok (
TALER_JSON_spec_amount_any ("wire_fee", &td.wire_fee),
GNUNET_JSON_spec_fixed_auto ("merchant_pub", &merchant_pub),
GNUNET_JSON_spec_fixed_auto ("h_payto", &td.h_payto),
TALER_JSON_spec_absolute_time ("execution_time", &td.execution_time),
GNUNET_JSON_spec_timestamp ("execution_time", &td.execution_time),
GNUNET_JSON_spec_json ("deposits", &details_j),
GNUNET_JSON_spec_fixed_auto ("exchange_sig", &td.exchange_sig),
GNUNET_JSON_spec_fixed_auto ("exchange_pub", &td.exchange_pub),
@ -181,7 +181,7 @@ check_transfers_get_response_ok (
struct TALER_WireDepositDetailP dd;
dd.h_contract_terms = detail->h_contract_terms;
dd.execution_time = GNUNET_TIME_absolute_hton (td.execution_time);
dd.execution_time = GNUNET_TIME_timestamp_hton (td.execution_time);
dd.coin_pub = detail->coin_pub;
TALER_amount_hton (&dd.deposit_value,
&detail->coin_value);

View File

@ -147,10 +147,10 @@ parse_fees (json_t *fees)
&wa->wire_fee),
TALER_JSON_spec_amount_any ("closing_fee",
&wa->closing_fee),
TALER_JSON_spec_absolute_time ("start_date",
&wa->start_date),
TALER_JSON_spec_absolute_time ("end_date",
&wa->end_date),
GNUNET_JSON_spec_timestamp ("start_date",
&wa->start_date),
GNUNET_JSON_spec_timestamp ("end_date",
&wa->end_date),
GNUNET_JSON_spec_end ()
};

View File

@ -474,123 +474,4 @@ TALER_PQ_query_param_json (const json_t *x)
}
/**
* Function called to convert input argument into SQL parameters.
*
* @param cls closure
* @param data pointer to input argument
* @param data_len number of bytes in @a data (if applicable)
* @param[out] param_values SQL data to set
* @param[out] param_lengths SQL length data to set
* @param[out] param_formats SQL format data to set
* @param param_length number of entries available in the @a param_values, @a param_lengths and @a param_formats arrays
* @param[out] scratch buffer for dynamic allocations (to be done via #GNUNET_malloc()
* @param scratch_length number of entries left in @a scratch
* @return -1 on error, number of offsets used in @a scratch otherwise
*/
static int
qconv_round_time (void *cls,
const void *data,
size_t data_len,
void *param_values[],
int param_lengths[],
int param_formats[],
unsigned int param_length,
void *scratch[],
unsigned int scratch_length)
{
const struct GNUNET_TIME_Absolute *at = data;
struct GNUNET_TIME_Absolute tmp;
struct GNUNET_TIME_AbsoluteNBO *buf;
(void) cls;
GNUNET_assert (1 == param_length);
GNUNET_assert (sizeof (struct GNUNET_TIME_AbsoluteNBO) == data_len);
GNUNET_assert (scratch_length > 0);
GNUNET_break (NULL == cls);
tmp = *at;
GNUNET_assert (GNUNET_OK ==
GNUNET_TIME_round_abs (&tmp));
buf = GNUNET_new (struct GNUNET_TIME_AbsoluteNBO);
*buf = GNUNET_TIME_absolute_hton (tmp);
scratch[0] = buf;
param_values[0] = (void *) buf;
param_lengths[0] = sizeof (struct GNUNET_TIME_AbsoluteNBO);
param_formats[0] = 1;
return 1;
}
struct GNUNET_PQ_QueryParam
TALER_PQ_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x)
{
struct GNUNET_PQ_QueryParam res = {
.conv = &qconv_round_time,
.data = x,
.size = sizeof (*x),
.num_params = 1
};
return res;
}
/**
* Function called to convert input argument into SQL parameters.
*
* @param cls closure
* @param data pointer to input argument
* @param data_len number of bytes in @a data (if applicable)
* @param[out] param_values SQL data to set
* @param[out] param_lengths SQL length data to set
* @param[out] param_formats SQL format data to set
* @param param_length number of entries available in the @a param_values, @a param_lengths and @a param_formats arrays
* @param[out] scratch buffer for dynamic allocations (to be done via #GNUNET_malloc()
* @param scratch_length number of entries left in @a scratch
* @return -1 on error, number of offsets used in @a scratch otherwise
*/
static int
qconv_round_time_abs (void *cls,
const void *data,
size_t data_len,
void *param_values[],
int param_lengths[],
int param_formats[],
unsigned int param_length,
void *scratch[],
unsigned int scratch_length)
{
const struct GNUNET_TIME_AbsoluteNBO *at = data;
struct GNUNET_TIME_Absolute tmp;
(void) cls;
(void) scratch;
(void) scratch_length;
GNUNET_assert (1 == param_length);
GNUNET_assert (sizeof (struct GNUNET_TIME_AbsoluteNBO) == data_len);
GNUNET_break (NULL == cls);
tmp = GNUNET_TIME_absolute_ntoh (*at);
GNUNET_assert (GNUNET_OK ==
GNUNET_TIME_round_abs (&tmp));
param_values[0] = (void *) at;
param_lengths[0] = sizeof (struct GNUNET_TIME_AbsoluteNBO);
param_formats[0] = 1;
return 0;
}
struct GNUNET_PQ_QueryParam
TALER_PQ_query_param_absolute_time_nbo (const struct GNUNET_TIME_AbsoluteNBO *x)
{
struct GNUNET_PQ_QueryParam res = {
.conv = &qconv_round_time_abs,
.data = x,
.size = sizeof (*x),
.num_params = 1
};
return res;
}
/* end of pq/pq_query_helper.c */

View File

@ -352,146 +352,6 @@ TALER_PQ_result_spec_json (const char *name,
}
/**
* Extract data from a Postgres database @a result at row @a row.
*
* @param cls closure
* @param result where to extract data from
* @param row the row to extract data from
* @param fname name (or prefix) of the fields to extract from
* @param[in,out] dst_size where to store size of result, may be NULL
* @param[out] dst where to store the result
* @return
* #GNUNET_YES if all results could be extracted
* #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
*/
static enum GNUNET_GenericReturnValue
extract_round_time (void *cls,
PGresult *result,
int row,
const char *fname,
size_t *dst_size,
void *dst)
{
struct GNUNET_TIME_Absolute *udst = dst;
const struct GNUNET_TIME_AbsoluteNBO *res;
struct GNUNET_TIME_Absolute tmp;
int fnum;
(void) cls;
fnum = PQfnumber (result,
fname);
if (fnum < 0)
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
if (PQgetisnull (result,
row,
fnum))
return GNUNET_NO;
GNUNET_assert (NULL != dst);
if (sizeof (struct GNUNET_TIME_Absolute) != *dst_size)
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
res = (struct GNUNET_TIME_AbsoluteNBO *) PQgetvalue (result,
row,
fnum);
tmp = GNUNET_TIME_absolute_ntoh (*res);
GNUNET_break (GNUNET_OK ==
GNUNET_TIME_round_abs (&tmp));
*udst = tmp;
return GNUNET_OK;
}
struct GNUNET_PQ_ResultSpec
TALER_PQ_result_spec_absolute_time (const char *name,
struct GNUNET_TIME_Absolute *at)
{
struct GNUNET_PQ_ResultSpec res = {
.conv = &extract_round_time,
.dst = (void *) at,
.dst_size = sizeof (struct GNUNET_TIME_Absolute),
.fname = name
};
return res;
}
/**
* Extract data from a Postgres database @a result at row @a row.
*
* @param cls closure
* @param result where to extract data from
* @param row the row to extract data from
* @param fname name (or prefix) of the fields to extract from
* @param[in,out] dst_size where to store size of result, may be NULL
* @param[out] dst where to store the result
* @return
* #GNUNET_YES if all results could be extracted
* #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
*/
static enum GNUNET_GenericReturnValue
extract_round_time_nbo (void *cls,
PGresult *result,
int row,
const char *fname,
size_t *dst_size,
void *dst)
{
struct GNUNET_TIME_AbsoluteNBO *udst = dst;
const struct GNUNET_TIME_AbsoluteNBO *res;
struct GNUNET_TIME_Absolute tmp;
int fnum;
(void) cls;
fnum = PQfnumber (result,
fname);
if (fnum < 0)
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
if (PQgetisnull (result,
row,
fnum))
return GNUNET_NO;
GNUNET_assert (NULL != dst);
if (sizeof (struct GNUNET_TIME_AbsoluteNBO) != *dst_size)
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
res = (struct GNUNET_TIME_AbsoluteNBO *) PQgetvalue (result,
row,
fnum);
tmp = GNUNET_TIME_absolute_ntoh (*res);
GNUNET_break (GNUNET_OK ==
GNUNET_TIME_round_abs (&tmp));
*udst = GNUNET_TIME_absolute_hton (tmp);
return GNUNET_OK;
}
struct GNUNET_PQ_ResultSpec
TALER_PQ_result_spec_absolute_time_nbo (const char *name,
struct GNUNET_TIME_AbsoluteNBO *at)
{
struct GNUNET_PQ_ResultSpec res = {
.conv = &extract_round_time_nbo,
.dst = (void *) at,
.dst_size = sizeof (struct GNUNET_TIME_AbsoluteNBO),
.fname = name
};
return res;
}
/**
* Extract data from a Postgres database @a result at row @a row.
*

View File

@ -36,7 +36,7 @@
* so immediately suitable for passing to `sqlite3_bind`-functions.
* @return #GNUNET_SYSERR on error, #GNUNET_OK on success
*/
static int
static enum GNUNET_GenericReturnValue
qconv_amount (void *cls,
const void *data,
size_t data_len,
@ -59,18 +59,16 @@ qconv_amount (void *cls,
}
/**
* Generate query parameter for a currency, consisting of the
* components "value", "fraction" in this order. The
* types must be a 64-bit integer and a 64-bit integer.
*
* @param x pointer to the query parameter to pass
*/
struct GNUNET_SQ_QueryParam
TALER_SQ_query_param_amount (const struct TALER_Amount *x)
{
struct GNUNET_SQ_QueryParam res =
{ &qconv_amount, NULL, x, sizeof (*x), 2 };
struct GNUNET_SQ_QueryParam res = {
.conv = &qconv_amount,
.data = x,
.size = sizeof (*x),
.num_params = 2
};
return res;
}
@ -86,7 +84,7 @@ TALER_SQ_query_param_amount (const struct TALER_Amount *x)
* so immediately suitable for passing to `sqlite3_bind`-functions.
* @return #GNUNET_SYSERR on error, #GNUNET_OK on success
*/
static int
static enum GNUNET_GenericReturnValue
qconv_amount_nbo (void *cls,
const void *data,
size_t data_len,
@ -108,18 +106,16 @@ qconv_amount_nbo (void *cls,
}
/**
* Generate query parameter for a currency, consisting of the
* components "value", "fraction" in this order. The
* types must be a 64-bit integer and a 64-bit integer.
*
* @param x pointer to the query parameter to pass
*/
struct GNUNET_SQ_QueryParam
TALER_SQ_query_param_amount_nbo (const struct TALER_AmountNBO *x)
{
struct GNUNET_SQ_QueryParam res =
{ &qconv_amount_nbo, NULL, x, sizeof (*x), 2 };
struct GNUNET_SQ_QueryParam res = {
.conv = &qconv_amount_nbo,
.data = x,
.size = sizeof (*x),
.num_params = 2
};
return res;
}
@ -135,7 +131,7 @@ TALER_SQ_query_param_amount_nbo (const struct TALER_AmountNBO *x)
* so immediately suitable for passing to `sqlite3_bind`-functions.
* @return #GNUNET_SYSERR on error, #GNUNET_OK on success
*/
static int
static enum GNUNET_GenericReturnValue
qconv_json (void *cls,
const void *data,
size_t data_len,
@ -162,126 +158,16 @@ qconv_json (void *cls,
}
/**
* Generate query parameter for a JSON object (stored as a string
* in the DB). Note that @a x must really be a JSON object or array,
* passing just a value (string, integer) is not supported and will
* result in an abort.
*
* @param x pointer to the json object to pass
*/
struct GNUNET_SQ_QueryParam
TALER_SQ_query_param_json (const json_t *x)
{
struct GNUNET_SQ_QueryParam res =
{ &qconv_json, NULL, x, sizeof (*x), 1 };
return res;
}
struct GNUNET_SQ_QueryParam res = {
.conv = &qconv_json,
.data = x,
.size = sizeof (*x),
.num_params = 1
};
/**
* Function called to convert input argument into SQL parameters.
*
* @param cls closure
* @param data pointer to input argument, here a `struct TALER_Amount`
* @param data_len number of bytes in @a data (if applicable)
* @param stmt sqlite statement to parameters for
* @param off offset of the argument to bind in @a stmt, numbered from 1,
* so immediately suitable for passing to `sqlite3_bind`-functions.
* @return #GNUNET_SYSERR on error, #GNUNET_OK on success
*/
static int
qconv_round_time (void *cls,
const void *data,
size_t data_len,
sqlite3_stmt *stmt,
unsigned int off)
{
const struct GNUNET_TIME_Absolute *at = data;
struct GNUNET_TIME_Absolute tmp;
(void) cls;
GNUNET_assert (sizeof (struct GNUNET_TIME_AbsoluteNBO) == data_len);
GNUNET_break (NULL == cls);
tmp = *at;
GNUNET_assert (GNUNET_OK ==
GNUNET_TIME_round_abs (&tmp));
if (SQLITE_OK != sqlite3_bind_int64 (stmt,
(int) off,
(sqlite3_int64) at->abs_value_us))
return GNUNET_SYSERR;
return GNUNET_OK;
}
/**
* Generate query parameter for an absolute time value.
* In contrast to
* #GNUNET_SQ_query_param_absolute_time(), this function
* will abort (!) if the time given is not rounded!
* The database must store a 64-bit integer.
*
* @param x pointer to the query parameter to pass
*/
struct GNUNET_SQ_QueryParam
TALER_SQ_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x)
{
struct GNUNET_SQ_QueryParam res =
{ &qconv_round_time, NULL, x, sizeof (*x), 1 };
return res;
}
/**
* Function called to convert input argument into SQL parameters.
*
* @param cls closure
* @param data pointer to input argument, here a `struct TALER_Amount`
* @param data_len number of bytes in @a data (if applicable)
* @param stmt sqlite statement to parameters for
* @param off offset of the argument to bind in @a stmt, numbered from 1,
* so immediately suitable for passing to `sqlite3_bind`-functions.
* @return #GNUNET_SYSERR on error, #GNUNET_OK on success
*/
static int
qconv_round_time_abs (void *cls,
const void *data,
size_t data_len,
sqlite3_stmt *stmt,
unsigned int off)
{
const struct GNUNET_TIME_AbsoluteNBO *at = data;
struct GNUNET_TIME_Absolute tmp;
(void) cls;
GNUNET_assert (sizeof (struct GNUNET_TIME_AbsoluteNBO) == data_len);
GNUNET_break (NULL == cls);
tmp = GNUNET_TIME_absolute_ntoh (*at);
GNUNET_assert (GNUNET_OK ==
GNUNET_TIME_round_abs (&tmp));
if (SQLITE_OK != sqlite3_bind_int64 (stmt,
(int) off,
(sqlite3_int64) tmp.abs_value_us))
return GNUNET_SYSERR;
return GNUNET_OK;
}
/**
* Generate query parameter for an absolute time value.
* In contrast to
* #GNUNET_SQ_query_param_absolute_time(), this function
* will abort (!) if the time given is not rounded!
* The database must store a 64-bit integer.
*
* @param x pointer to the query parameter to pass
*/
struct GNUNET_SQ_QueryParam
TALER_SQ_query_param_absolute_time_nbo (const struct
GNUNET_TIME_AbsoluteNBO *x)
{
struct GNUNET_SQ_QueryParam res =
{ &qconv_round_time_abs, NULL, x, sizeof (*x), 1 };
return res;
}

View File

@ -38,7 +38,7 @@
* #GNUNET_YES if all results could be extracted
* #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
*/
static int
static enum GNUNET_GenericReturnValue
extract_amount (void *cls,
sqlite3_stmt *result,
unsigned int column,
@ -68,13 +68,6 @@ extract_amount (void *cls,
}
/**
* Currency amount expected.
*
* @param currency the currency to use for @a amount
* @param[out] amount where to store the result
* @return array entry for the result specification to use
*/
struct GNUNET_SQ_ResultSpec
TALER_SQ_result_spec_amount (const char *currency,
struct TALER_Amount *amount)
@ -103,7 +96,7 @@ TALER_SQ_result_spec_amount (const char *currency,
* #GNUNET_YES if all results could be extracted
* #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
*/
static int
static enum GNUNET_GenericReturnValue
extract_amount_nbo (void *cls,
sqlite3_stmt *result,
unsigned int column,
@ -132,13 +125,6 @@ extract_amount_nbo (void *cls,
}
/**
* Currency amount expected.
*
* @param currency the currency to use for @a amount
* @param[out] amount where to store the result
* @return array entry for the result specification to use
*/
struct GNUNET_SQ_ResultSpec
TALER_SQ_result_spec_amount_nbo (const char *currency,
struct TALER_AmountNBO *amount)
@ -167,7 +153,7 @@ TALER_SQ_result_spec_amount_nbo (const char *currency,
* #GNUNET_YES if all results could be extracted
* #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
*/
static int
static enum GNUNET_GenericReturnValue
extract_json (void *cls,
sqlite3_stmt *result,
unsigned int column,
@ -248,138 +234,4 @@ TALER_SQ_result_spec_json (json_t **jp)
}
/**
* Extract amount data from a SQLite database
*
* @param cls closure
* @param result where to extract data from
* @param column column to extract data from
* @param[in,out] dst_size where to store size of result, may be NULL
* @param[out] dst where to store the result
* @return
* #GNUNET_YES if all results could be extracted
* #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
*/
static int
extract_round_time (void *cls,
sqlite3_stmt *result,
unsigned int column,
size_t *dst_size,
void *dst)
{
struct GNUNET_TIME_Absolute *udst = dst;
struct GNUNET_TIME_Absolute tmp;
(void) cls;
if (SQLITE_INTEGER != sqlite3_column_type (result,
(int) column))
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
GNUNET_assert (NULL != dst);
if (sizeof (struct GNUNET_TIME_Absolute) != *dst_size)
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
tmp.abs_value_us = sqlite3_column_int64 (result,
(int) column);
GNUNET_break (GNUNET_OK ==
GNUNET_TIME_round_abs (&tmp));
*udst = tmp;
return GNUNET_OK;
}
/**
* Rounded absolute time expected.
* In contrast to #GNUNET_SQ_query_param_absolute_time_nbo(),
* this function ensures that the result is rounded and can
* be converted to JSON.
*
* @param[out] at where to store the result
* @return array entry for the result specification to use
*/
struct GNUNET_SQ_ResultSpec
TALER_SQ_result_spec_absolute_time (struct GNUNET_TIME_Absolute *at)
{
struct GNUNET_SQ_ResultSpec res = {
.conv = &extract_round_time,
.dst = (void *) at,
.dst_size = sizeof (struct GNUNET_TIME_Absolute),
.num_params = 1
};
return res;
}
/**
* Extract amount data from a SQLite database
*
* @param cls closure
* @param result where to extract data from
* @param column column to extract data from
* @param[in,out] dst_size where to store size of result, may be NULL
* @param[out] dst where to store the result
* @return
* #GNUNET_YES if all results could be extracted
* #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
*/
static int
extract_round_time_nbo (void *cls,
sqlite3_stmt *result,
unsigned int column,
size_t *dst_size,
void *dst)
{
struct GNUNET_TIME_AbsoluteNBO *udst = dst;
struct GNUNET_TIME_Absolute tmp;
(void) cls;
if (SQLITE_INTEGER != sqlite3_column_type (result,
(int) column))
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
GNUNET_assert (NULL != dst);
if (sizeof (struct GNUNET_TIME_AbsoluteNBO) != *dst_size)
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
tmp.abs_value_us = sqlite3_column_int64 (result,
(int) column);
GNUNET_break (GNUNET_OK ==
GNUNET_TIME_round_abs (&tmp));
*udst = GNUNET_TIME_absolute_hton (tmp);
return GNUNET_OK;
}
/**
* Rounded absolute time expected.
* In contrast to #GNUNET_SQ_result_spec_absolute_time_nbo(),
* this function ensures that the result is rounded and can
* be converted to JSON.
*
* @param[out] at where to store the result
* @return array entry for the result specification to use
*/
struct GNUNET_SQ_ResultSpec
TALER_SQ_result_spec_absolute_time_nbo (struct GNUNET_TIME_AbsoluteNBO *at)
{
struct GNUNET_SQ_ResultSpec res = {
.conv = &extract_round_time_nbo,
.dst = (void *) at,
.dst_size = sizeof (struct GNUNET_TIME_AbsoluteNBO),
.num_params = 1
};
return res;
}
/* end of sq/sq_result_helper.c */

View File

@ -33,8 +33,6 @@ run_queries (sqlite3 *db)
struct TALER_Amount hamount;
struct TALER_AmountNBO namount;
json_t *json;
struct GNUNET_TIME_Absolute htime = GNUNET_TIME_absolute_get ();
struct GNUNET_TIME_AbsoluteNBO ntime;
sqlite3_stmt *test_insert;
sqlite3_stmt *test_select;
struct GNUNET_SQ_PrepareStatement ps[] = {
@ -44,10 +42,8 @@ run_queries (sqlite3 *db)
",namount_val"
",namount_frac"
",json"
",htime"
",ntime"
") VALUES "
"($1, $2, $3, $4, $5, $6, $7)",
"($1, $2, $3, $4, $5)",
&test_insert),
GNUNET_SQ_make_prepare ("SELECT"
" hamount_val"
@ -55,8 +51,6 @@ run_queries (sqlite3 *db)
",namount_val"
",namount_frac"
",json"
",htime"
",ntime"
" FROM test_sq",
&test_select),
GNUNET_SQ_PREPARE_END
@ -71,19 +65,15 @@ run_queries (sqlite3 *db)
json = json_object ();
json_object_set_new (json, "foo", json_integer (42));
GNUNET_assert (NULL != json);
GNUNET_TIME_round_abs (&htime);
ntime = GNUNET_TIME_absolute_hton (htime);
GNUNET_assert (GNUNET_OK == GNUNET_SQ_prepare (db,
ps));
GNUNET_assert (GNUNET_OK ==
GNUNET_SQ_prepare (db,
ps));
{
struct GNUNET_SQ_QueryParam params_insert[] = {
TALER_SQ_query_param_amount (&hamount),
TALER_SQ_query_param_amount_nbo (&namount),
TALER_SQ_query_param_json (json),
TALER_SQ_query_param_absolute_time (&htime),
TALER_SQ_query_param_absolute_time_nbo (&ntime),
GNUNET_SQ_query_param_end
};
GNUNET_SQ_reset (db,
@ -99,8 +89,6 @@ run_queries (sqlite3 *db)
struct TALER_AmountNBO nresult_amount;
struct TALER_Amount nresult_amount_converted;
json_t *result_json;
struct GNUNET_TIME_Absolute hresult_time;
struct GNUNET_TIME_AbsoluteNBO nresult_time;
struct GNUNET_SQ_QueryParam params_select[] = {
GNUNET_SQ_query_param_end
};
@ -110,8 +98,6 @@ run_queries (sqlite3 *db)
TALER_SQ_result_spec_amount_nbo ("EUR",
&nresult_amount),
TALER_SQ_result_spec_json (&result_json),
TALER_SQ_result_spec_absolute_time (&hresult_time),
TALER_SQ_result_spec_absolute_time_nbo (&nresult_time),
GNUNET_SQ_result_spec_end
};
@ -134,9 +120,7 @@ run_queries (sqlite3 *db)
(0 != TALER_amount_cmp (&hamount,
&nresult_amount_converted)) ||
(1 != json_equal (json,
result_json)) ||
(htime.abs_value_us != hresult_time.abs_value_us) ||
(ntime.abs_value_us__ != nresult_time.abs_value_us__))
result_json)) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Result from database doesn't match input\n");
@ -162,8 +146,6 @@ main (int argc,
",namount_val INT8 NOT NULL"
",namount_frac INT8 NOT NULL"
",json VARCHAR NOT NULL"
",htime INT8 NOT NULL"
",ntime INT8 NOT NULL"
")"),
GNUNET_SQ_EXECUTE_STATEMENT_END
};

View File

@ -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"),

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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,

View File

@ -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 ()

View File

@ -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 ()
};

View File

@ -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 ()
};

View File

@ -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,

View File

@ -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;

View File

@ -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",

Some files were not shown because too many files have changed in this diff Show More