aboutsummaryrefslogtreecommitdiff
path: root/src/auditor
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-12-14 16:04:32 +0100
committerChristian Grothoff <christian@grothoff.org>2021-12-14 16:04:40 +0100
commit1a1fafbd438f3f21a15c990d904e192b045d2391 (patch)
treecdd32023fd1d7c530caeae0487528d7eaac2aa29 /src/auditor
parentbf54ee30d4727217264f470321cc2f91facf63cc (diff)
introducing GNUNET_TIME_Timestamp, recoup now with amounts
Diffstat (limited to 'src/auditor')
-rw-r--r--src/auditor/Makefile.am13
-rw-r--r--src/auditor/report-lib.c8
-rw-r--r--src/auditor/taler-auditor-httpd_deposit-confirmation.c36
-rw-r--r--src/auditor/taler-helper-auditor-aggregation.c48
-rw-r--r--src/auditor/taler-helper-auditor-coins.c109
-rw-r--r--src/auditor/taler-helper-auditor-deposits.c23
-rw-r--r--src/auditor/taler-helper-auditor-reserves.c97
-rw-r--r--src/auditor/taler-helper-auditor-wire.c403
8 files changed, 384 insertions, 353 deletions
diff --git a/src/auditor/Makefile.am b/src/auditor/Makefile.am
index b876805b2..49f4030ea 100644
--- a/src/auditor/Makefile.am
+++ b/src/auditor/Makefile.am
@@ -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/ \
diff --git a/src/auditor/report-lib.c b/src/auditor/report-lib.c
index e6468f692..0dea786da 100644
--- a/src/auditor/report-lib.c
+++ b/src/auditor/report-lib.c
@@ -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
{
diff --git a/src/auditor/taler-auditor-httpd_deposit-confirmation.c b/src/auditor/taler-auditor-httpd_deposit-confirmation.c
index 8f16f36fe..d2ab03705 100644
--- a/src/auditor/taler-auditor-httpd_deposit-confirmation.c
+++ b/src/auditor/taler-auditor-httpd_deposit-confirmation.c
@@ -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 ()
diff --git a/src/auditor/taler-helper-auditor-aggregation.c b/src/auditor/taler-helper-auditor-aggregation.c
index edb9f8b39..7fffcd284 100644
--- a/src/auditor/taler-helper-auditor-aggregation.c
+++ b/src/auditor/taler-helper-auditor-aggregation.c
@@ -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;
diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c
index 4267cd0c2..937613cce 100644
--- a/src/auditor/taler-helper-auditor-coins.c
+++ b/src/auditor/taler-helper-auditor-coins.c
@@ -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)));
}
}
diff --git a/src/auditor/taler-helper-auditor-deposits.c b/src/auditor/taler-helper-auditor-deposits.c
index f7e1cb0dc..2499df2eb 100644
--- a/src/auditor/taler-helper-auditor-deposits.c
+++ b/src/auditor/taler-helper-auditor-deposits.c
@@ -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++;
diff --git a/src/auditor/taler-helper-auditor-reserves.c b/src/auditor/taler-helper-auditor-reserves.c
index 52a7b0748..2ce120202 100644
--- a/src/auditor/taler-helper-auditor-reserves.c
+++ b/src/auditor/taler-helper-auditor-reserves.c
@@ -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")));
}
}
diff --git a/src/auditor/taler-helper-auditor-wire.c b/src/auditor/taler-helper-auditor-wire.c
index f275a453b..89758c2fc 100644
--- a/src/auditor/taler-helper-auditor-wire.c
+++ b/src/auditor/taler-helper-auditor-wire.c
@@ -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);
}