only check tiny/done in internal mode

This commit is contained in:
Christian Grothoff 2021-01-07 21:14:26 +01:00
parent 9473ef4d86
commit 9d5a3ef659
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

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