From 01456098909a4ebddf5a84729242be235af2fdbb Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 17 Jan 2020 15:00:22 +0100 Subject: fix FIXME: total up irregular paybacks and add to report --- src/auditor/taler-auditor.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'src/auditor') diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c index a3f6eae21..3a44c55f7 100644 --- a/src/auditor/taler-auditor.c +++ b/src/auditor/taler-auditor.c @@ -318,6 +318,11 @@ static struct TALER_Amount total_risk; */ static struct TALER_Amount total_payback_loss; +/** + * Paybacks we made on denominations that were not revoked (!?). + */ +static struct TALER_Amount total_irregular_paybacks; + /** * Total withdraw fees earned. */ @@ -1339,9 +1344,10 @@ handle_payback_by_reserve (void *cls, report_row_inconsistency ("payback", rowid, "denomination key not in revocation set"); - /* FIXME: add amount involved to some loss statistic!? - It's kind-of not a loss (we just paid back), OTOH, it is - certainly irregular and involves some amount. */ + GNUNET_break (GNUNET_OK == + TALER_amount_add (&total_irregular_paybacks, + &total_irregular_paybacks, + amount)); } else { @@ -4628,7 +4634,8 @@ analyze_coins (void *cls) &total_melt_fee_income, &total_refund_fee_income, &total_risk, - &total_payback_loss); + &total_payback_loss, + &total_irregular_paybacks); if (0 > qsx) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsx); @@ -4727,7 +4734,8 @@ analyze_coins (void *cls) &total_melt_fee_income, &total_refund_fee_income, &total_risk, - &total_payback_loss); + &total_payback_loss, + &total_irregular_paybacks); else qs = adb->insert_balance_summary (adb->cls, asession, @@ -4737,7 +4745,8 @@ analyze_coins (void *cls) &total_melt_fee_income, &total_refund_fee_income, &total_risk, - &total_payback_loss); + &total_payback_loss, + &total_irregular_paybacks); if (0 >= qs) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); @@ -5316,6 +5325,9 @@ run (void *cls, GNUNET_assert (GNUNET_OK == TALER_amount_get_zero (currency, &total_payback_loss)); + GNUNET_assert (GNUNET_OK == + TALER_amount_get_zero (currency, + &total_irregular_paybacks)); GNUNET_assert (GNUNET_OK == TALER_amount_get_zero (currency, &total_withdraw_fee_income)); @@ -5598,7 +5610,9 @@ run (void *cls, GNUNET_STRINGS_absolute_time_to_string (start_time)), "auditor_end_time", json_string ( GNUNET_STRINGS_absolute_time_to_string ( - GNUNET_TIME_absolute_get ())) + GNUNET_TIME_absolute_get ())), + "total_irregular_paybacks", + TALER_JSON_from_amount (&total_irregular_paybacks) ); GNUNET_break (NULL != report); json_dumpf (report, -- cgit v1.2.3