From 9d5a3ef6597a6a4d44a1737b9234011bc94328db Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 7 Jan 2021 21:14:26 +0100 Subject: only check tiny/done in internal mode --- src/auditor/taler-helper-auditor-wire.c | 53 ++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/auditor/taler-helper-auditor-wire.c b/src/auditor/taler-helper-auditor-wire.c index fc91048a0..5e870813d 100644 --- a/src/auditor/taler-helper-auditor-wire.c +++ b/src/auditor/taler-helper-auditor-wire.c @@ -825,7 +825,9 @@ commit (enum GNUNET_DB_QueryStatus qs) * @param wire where should the funds be wired * @param deadline what was the requested wire transfer deadline * @param tiny did the exchange defer this transfer because it is too small? + * NOTE: only valid in internal audit mode! * @param done did the exchange claim that it made a transfer? + * NOTE: only valid in internal audit mode! */ static void wire_missing_cb (void *cls, @@ -837,25 +839,48 @@ wire_missing_cb (void *cls, /* bool? */ int tiny, /* bool? */ int done) { + json_t *rep; + (void) cls; TALER_ARL_amount_add (&total_amount_lag, &total_amount_lag, amount); - if ( (GNUNET_YES == tiny) && - (0 > TALER_amount_cmp (amount, - &tiny_amount)) ) - return; /* acceptable, amount was tiny */ + if (internal_checks) + { + /* In internal mode, we insist that the entry was + actually marked as tiny. */ + if ( (GNUNET_YES == tiny) && + (0 > TALER_amount_cmp (amount, + &tiny_amount)) ) + return; /* acceptable, amount was tiny */ + } + else + { + /* External auditors do not replicate tiny, so they + only check that the amount is tiny */ + if (0 > TALER_amount_cmp (amount, + &tiny_amount)) + return; /* acceptable, amount was tiny */ + } + rep = json_pack ("{s:I, s:o, s:o, s:o, s:O}", + "row", (json_int_t) rowid, + "amount", TALER_JSON_from_amount (amount), + "deadline", TALER_ARL_json_from_time_abs ( + deadline), + "coin_pub", GNUNET_JSON_from_data_auto ( + coin_pub), + "account", wire); + GNUNET_break (NULL != rep); + if (internal_checks) + { + /* the 'done' bit is only useful in 'internal' mode */ + GNUNET_break (0 == + json_object_set (rep, + "claimed_done", + json_string ((done) ? "yes" : "no"))); + } TALER_ARL_report (report_lags, - json_pack ("{s:I, s:o, s:o, s:s, s:o, s:O}", - "row", (json_int_t) rowid, - "amount", TALER_JSON_from_amount (amount), - "deadline", TALER_ARL_json_from_time_abs ( - deadline), - "claimed_done", (done) ? "yes" : "no", - "coin_pub", GNUNET_JSON_from_data_auto ( - coin_pub), - "account", wire)); - + rep); } -- cgit v1.2.3