summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-05-13 12:12:46 +0200
committerChristian Grothoff <christian@grothoff.org>2024-05-13 12:13:04 +0200
commitf35f5bd0f4e872215e0c9cab0949c8a37e768646 (patch)
tree062ce496fd0d52d04918a5af328da4e16d1ce9eb
parent977843f68941c475a703f74bcda3eabc9c8fcd18 (diff)
downloadexchange-f35f5bd0f4e872215e0c9cab0949c8a37e768646.tar.gz
exchange-f35f5bd0f4e872215e0c9cab0949c8a37e768646.tar.bz2
exchange-f35f5bd0f4e872215e0c9cab0949c8a37e768646.zip
fix taler-helper-auditor-wire crash and clean up logic and remove JSON generation code
-rw-r--r--src/auditor/taler-helper-auditor-wire.c465
-rwxr-xr-xsrc/auditor/test-auditor.sh36
2 files changed, 142 insertions, 359 deletions
diff --git a/src/auditor/taler-helper-auditor-wire.c b/src/auditor/taler-helper-auditor-wire.c
index 015ee8b98..5717b7a59 100644
--- a/src/auditor/taler-helper-auditor-wire.c
+++ b/src/auditor/taler-helper-auditor-wire.c
@@ -223,63 +223,6 @@ static TALER_ARL_DEF_PP (wire_batch_deposit_id);
static TALER_ARL_DEF_PP (wire_aggregation_id);
/**
- * Array of reports about row inconsistencies in wire_out table.
- */
-static json_t *report_wire_out_inconsistencies;
-
-/**
- * Array of reports about row inconsistencies in reserves_in table.
- */
-static json_t *report_reserve_in_inconsistencies;
-
-/**
- * Array of reports about wrong bank account being recorded for
- * incoming wire transfers.
- */
-static json_t *report_misattribution_in_inconsistencies;
-
-/**
- * Array of reports about row inconsistencies.
- */
-static json_t *report_row_inconsistencies;
-
-/**
- * Array of reports about inconsistencies in the database about
- * the incoming wire transfers (exchange is not exactly to blame).
- */
-static json_t *report_wire_format_inconsistencies;
-
-/**
- * Array of reports about minor row inconsistencies.
- */
-static json_t *report_row_minor_inconsistencies;
-
-/**
- * Array of reports about lagging transactions from deposits.
- */
-static json_t *report_lags;
-
-/**
- * Array of reports about lagging transactions from deposits due to missing KYC.
- */
-static json_t *report_kyc_lags;
-
-/**
- * Array of reports about lagging transactions from deposits due to pending or frozen AML decisions.
- */
-static json_t *report_aml_lags;
-
-/**
- * Array of reports about lagging transactions from reserve closures.
- */
-static json_t *report_closure_lags;
-
-/**
- * Array of per-account progress data.
- */
-static json_t *report_account_progress;
-
-/**
* Amount that is considered "tiny"
*/
static struct TALER_Amount tiny_amount;
@@ -535,113 +478,17 @@ do_shutdown (void *cls)
struct WireAccount *wa;
(void) cls;
-
- if (test_mode != 1)
+ if (NULL != eh)
{
db_plugin->event_listen_cancel (eh);
eh = NULL;
- TALER_AUDITORDB_plugin_unload (db_plugin);
- db_plugin = NULL;
- TALER_ARL_done (NULL);
- }
-
- if (NULL != report_row_inconsistencies)
- {
- GNUNET_assert (NULL != report_row_minor_inconsistencies);
- TALER_ARL_done (
- GNUNET_JSON_PACK (
- /* Tested in test-auditor.sh #11, #15, #20 */
- GNUNET_JSON_pack_array_steal ("wire_out_amount_inconsistencies",
- report_wire_out_inconsistencies),
- TALER_JSON_pack_amount ("total_wire_out_delta_plus",
- &total_bad_amount_out_plus),
- /* Tested in test-auditor.sh #11, #15, #19 */
- TALER_JSON_pack_amount ("total_wire_out_delta_minus",
- &total_bad_amount_out_minus),
- /* Tested in test-auditor.sh #2 */
- GNUNET_JSON_pack_array_steal ("reserve_in_amount_inconsistencies",
- report_reserve_in_inconsistencies),
- /* Tested in test-auditor.sh #2 */
- TALER_JSON_pack_amount ("total_wire_in_delta_plus",
- &total_bad_amount_in_plus),
- /* Tested in test-auditor.sh #3 */
- TALER_JSON_pack_amount ("total_wire_in_delta_minus",
- &total_bad_amount_in_minus),
- /* Tested in test-auditor.sh #9 */
- GNUNET_JSON_pack_array_steal ("misattribution_in_inconsistencies",
- report_misattribution_in_inconsistencies),
- /* Tested in test-auditor.sh #9 */
- TALER_JSON_pack_amount ("total_misattribution_in",
- &total_misattribution_in),
- GNUNET_JSON_pack_array_steal ("row_inconsistencies",
- report_row_inconsistencies),
- /* Tested in test-auditor.sh #10/#17 */
- GNUNET_JSON_pack_array_steal ("row_minor_inconsistencies",
- report_row_minor_inconsistencies),
- /* Tested in test-auditor.sh #19 */
- TALER_JSON_pack_amount ("total_wire_format_amount",
- &total_wire_format_amount),
- /* Tested in test-auditor.sh #19 */
- GNUNET_JSON_pack_array_steal ("wire_format_inconsistencies",
- report_wire_format_inconsistencies),
- TALER_JSON_pack_amount ("total_wire_in",
- &total_wire_in),
- TALER_JSON_pack_amount ("total_wire_out",
- &total_wire_out),
- TALER_JSON_pack_amount ("total_drained",
- &TALER_ARL_USE_AB (total_drained)),
- TALER_JSON_pack_amount ("final_balance",
- &TALER_ARL_USE_AB (final_balance)),
- /* Tested in test-auditor.sh #1 */
- TALER_JSON_pack_amount ("total_amount_lag",
- &total_amount_lag),
- /* Tested in test-auditor.sh #1 */
- GNUNET_JSON_pack_array_steal ("lag_details",
- report_lags),
- GNUNET_JSON_pack_array_steal ("lag_aml_details",
- report_aml_lags),
- GNUNET_JSON_pack_array_steal ("lag_kyc_details",
- report_kyc_lags),
- /* Tested in test-auditor.sh #22 */
- TALER_JSON_pack_amount ("total_closure_amount_lag",
- &total_closure_amount_lag),
- /* Tested in test-auditor.sh #22 */
- GNUNET_JSON_pack_array_steal ("reserve_lag_details",
- report_closure_lags),
- TALER_JSON_pack_time_abs_human ("wire_auditor_start_time",
- start_time),
- TALER_JSON_pack_time_abs_human ("wire_auditor_end_time",
- GNUNET_TIME_absolute_get ()),
- GNUNET_JSON_pack_uint64 ("start_pp_reserve_close_id",
- 0 /* no longer supported */),
- GNUNET_JSON_pack_uint64 ("end_pp_reserve_close_id",
- TALER_ARL_USE_PP (wire_reserve_close_id)),
- GNUNET_JSON_pack_uint64 ("start_pp_last_batch_deposit_id",
- 0 /* no longer supported */),
- GNUNET_JSON_pack_uint64 ("end_pp_last_batch_deposit_id",
- TALER_ARL_USE_PP (wire_batch_deposit_id)),
- GNUNET_JSON_pack_uint64 ("start_pp_last_aggregation_serial_id",
- 0 /* no longer supported */),
- GNUNET_JSON_pack_uint64 ("end_pp_last_aggregation_serial_id",
- TALER_ARL_USE_PP (wire_aggregation_id)),
- GNUNET_JSON_pack_array_steal ("account_progress",
- report_account_progress)));
- report_wire_out_inconsistencies = NULL;
- report_reserve_in_inconsistencies = NULL;
- report_row_inconsistencies = NULL;
- report_row_minor_inconsistencies = NULL;
- report_misattribution_in_inconsistencies = NULL;
- report_lags = NULL;
- report_kyc_lags = NULL;
- report_aml_lags = NULL;
- report_closure_lags = NULL;
- report_account_progress = NULL;
- report_wire_format_inconsistencies = NULL;
}
- else
+ if (NULL != db_plugin)
{
- TALER_ARL_done (NULL);
+ TALER_AUDITORDB_plugin_unload (db_plugin);
+ db_plugin = NULL;
}
+ TALER_ARL_done (NULL);
if (NULL != reserve_closures)
{
GNUNET_CONTAINER_multihashmap_iterate (reserve_closures,
@@ -724,8 +571,9 @@ check_pending_rc (void *cls,
TALER_ARL_amount_add (&total_closure_amount_lag,
&total_closure_amount_lag,
&rc->amount);
- if ((0 != rc->amount.value) ||
- (0 != rc->amount.fraction))
+ if (! TALER_amount_is_zero (&rc->amount))
+ {
+#if FIXME
TALER_ARL_report (
report_closure_lags,
GNUNET_JSON_PACK (
@@ -739,6 +587,8 @@ check_pending_rc (void *cls,
&rc->wtid),
GNUNET_JSON_pack_string ("account",
rc->receiver_account)));
+#endif
+ }
TALER_ARL_USE_PP (wire_reserve_close_id)
= GNUNET_MIN (TALER_ARL_USE_PP (wire_reserve_close_id),
rc->rowid);
@@ -813,12 +663,6 @@ commit (enum GNUNET_DB_QueryStatus qs)
NULL);
}
}
- else
- {
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (TALER_ARL_currency,
- &TALER_ARL_USE_AB (final_balance)));
- }
if (0 > qs)
{
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
@@ -835,23 +679,8 @@ commit (enum GNUNET_DB_QueryStatus qs)
NULL != wa;
wa = wa->next)
{
- GNUNET_assert (
- 0 ==
- json_array_append_new (
- report_account_progress,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("account",
- wa->ai->section_name),
- GNUNET_JSON_pack_uint64 ("start_reserve_in",
- wa->start_pp.last_reserve_in_serial_id),
- GNUNET_JSON_pack_uint64 ("end_reserve_in",
- wa->pp.last_reserve_in_serial_id),
- GNUNET_JSON_pack_uint64 ("start_wire_out",
- wa->start_pp.last_wire_out_serial_id),
- GNUNET_JSON_pack_uint64 ("end_wire_out",
- wa->pp.last_wire_out_serial_id))));
- if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == wa->qsx && had_start_progress ==
- true)
+ if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == wa->qsx &&
+ had_start_progress)
qs = TALER_ARL_adb->update_auditor_progress (
TALER_ARL_adb->cls,
wa->label_reserve_in_serial_id,
@@ -1127,6 +956,7 @@ generate_report (void *cls,
&rd->total_amount);
if (NULL != rd->kyc_pending)
{
+#if FIXME_CG
json_t *rep;
rep = GNUNET_JSON_PACK (
@@ -1141,9 +971,11 @@ generate_report (void *cls,
rd->payto_uri)));
TALER_ARL_report (report_kyc_lags,
rep);
+#endif
}
else if (TALER_AML_NORMAL != rd->status)
{
+#if FIXME_CG
const char *sstatus = "<undefined>";
json_t *rep;
@@ -1176,9 +1008,11 @@ generate_report (void *cls,
rd->payto_uri)));
TALER_ARL_report (report_aml_lags,
rep);
+#endif
}
else
{
+#if FIXME
json_t *rep;
rep = GNUNET_JSON_PACK (
@@ -1191,6 +1025,7 @@ generate_report (void *cls,
rd->payto_uri)));
TALER_ARL_report (report_lags,
rep);
+#endif
}
return free_report_entry (cls,
@@ -1418,6 +1253,7 @@ check_time_difference (const char *table,
"execution date mismatch (%s)",
GNUNET_TIME_relative2s (delta,
true));
+#if FIXME
TALER_ARL_report (report_row_minor_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("table",
@@ -1426,6 +1262,7 @@ check_time_difference (const char *table,
rowid),
GNUNET_JSON_pack_string ("diagnostic",
details)));
+#endif
GNUNET_free (details);
}
@@ -1473,6 +1310,7 @@ 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 aggregator
has not yet fully caught up with the transfers it should do. */
+#if FIXME
TALER_ARL_report (
report_wire_out_inconsistencies,
GNUNET_JSON_PACK (
@@ -1490,6 +1328,7 @@ wire_out_cb (void *cls,
"wire transfer not made (yet?)"),
GNUNET_JSON_pack_string ("account_section",
wa->ai->section_name)));
+#endif
TALER_ARL_amount_add (&total_bad_amount_out_minus,
&total_bad_amount_out_minus,
amount);
@@ -1503,6 +1342,7 @@ 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. */
+#if FIXME
TALER_ARL_report (
report_wire_out_inconsistencies,
GNUNET_JSON_PACK (
@@ -1522,9 +1362,11 @@ wire_out_cb (void *cls,
payto_uri),
GNUNET_JSON_pack_string ("account_section",
wa->ai->section_name)));
+#endif
TALER_ARL_amount_add (&total_bad_amount_out_plus,
&total_bad_amount_out_plus,
&roi->details.amount);
+#if FIXME
TALER_ARL_report (
report_wire_out_inconsistencies,
GNUNET_JSON_PACK (
@@ -1545,6 +1387,7 @@ wire_out_cb (void *cls,
credit_account_uri),
GNUNET_JSON_pack_string ("account_section",
wa->ai->section_name)));
+#endif
TALER_ARL_amount_add (&total_bad_amount_out_minus,
&total_bad_amount_out_minus,
amount);
@@ -1553,6 +1396,7 @@ wire_out_cb (void *cls,
if (0 != TALER_amount_cmp (&roi->details.amount,
amount))
{
+#if FIXME
TALER_ARL_report (
report_wire_out_inconsistencies,
GNUNET_JSON_PACK (
@@ -1570,6 +1414,7 @@ wire_out_cb (void *cls,
"wire amount does not match"),
GNUNET_JSON_pack_string ("account_section",
wa->ai->section_name)));
+#endif
if (0 < TALER_amount_cmp (amount,
&roi->details.amount))
{
@@ -1750,6 +1595,7 @@ complain_out_not_found (void *cls,
&master_sig))
{
GNUNET_break (0);
+#if FIXME
TALER_ARL_report (report_row_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("table",
@@ -1760,6 +1606,7 @@ complain_out_not_found (void *cls,
&roi->details.wtid),
GNUNET_JSON_pack_string ("diagnostic",
"invalid signature")));
+#endif
TALER_ARL_amount_add (&total_bad_amount_out_plus,
&total_bad_amount_out_plus,
&amount);
@@ -1768,6 +1615,7 @@ complain_out_not_found (void *cls,
strcasecmp (payto_uri,
roi->details.credit_account_uri))
{
+#if FIXME
TALER_ARL_report (
report_wire_out_inconsistencies,
GNUNET_JSON_PACK (
@@ -1780,11 +1628,13 @@ complain_out_not_found (void *cls,
GNUNET_JSON_pack_data_auto ("wtid",
&roi->details.wtid),
TALER_JSON_pack_time_abs_human ("timestamp",
- roi->details.execution_date.abs_time),
+ roi->details.execution_date.abs_time
+ ),
GNUNET_JSON_pack_string ("account",
wa->ai->section_name),
GNUNET_JSON_pack_string ("diagnostic",
"wrong target account")));
+#endif
TALER_ARL_amount_add (&total_bad_amount_out_plus,
&total_bad_amount_out_plus,
&amount);
@@ -1793,6 +1643,7 @@ complain_out_not_found (void *cls,
TALER_amount_cmp (&amount,
&roi->details.amount))
{
+#if FIXME
TALER_ARL_report (
report_wire_out_inconsistencies,
GNUNET_JSON_PACK (
@@ -1805,11 +1656,13 @@ complain_out_not_found (void *cls,
GNUNET_JSON_pack_data_auto ("wtid",
&roi->details.wtid),
TALER_JSON_pack_time_abs_human ("timestamp",
- roi->details.execution_date.abs_time),
+ roi->details.execution_date.abs_time
+ ),
GNUNET_JSON_pack_string ("account",
wa->ai->section_name),
GNUNET_JSON_pack_string ("diagnostic",
"profit drain amount incorrect")));
+#endif
TALER_ARL_amount_add (&total_bad_amount_out_minus,
&total_bad_amount_out_minus,
&roi->details.amount);
@@ -1826,7 +1679,7 @@ complain_out_not_found (void *cls,
return GNUNET_OK;
}
}
-
+#if FIXME
TALER_ARL_report (
report_wire_out_inconsistencies,
GNUNET_JSON_PACK (
@@ -1844,6 +1697,7 @@ complain_out_not_found (void *cls,
wa->ai->section_name),
GNUNET_JSON_pack_string ("diagnostic",
"justification for wire transfer not found")));
+#endif
TALER_ARL_amount_add (&total_bad_amount_out_plus,
&total_bad_amount_out_plus,
&roi->details.amount);
@@ -1959,6 +1813,7 @@ history_debit_cb (void *cls,
TALER_ARL_amount_add (&total_wire_format_amount,
&total_wire_format_amount,
&dd->amount);
+#if FIXME
TALER_ARL_report (report_wire_format_inconsistencies,
GNUNET_JSON_PACK (
TALER_JSON_pack_amount ("amount",
@@ -1967,6 +1822,7 @@ history_debit_cb (void *cls,
dd->serial_id),
GNUNET_JSON_pack_string ("diagnostic",
diagnostic)));
+#endif
GNUNET_free (diagnostic);
}
}
@@ -2132,6 +1988,7 @@ reserve_in_cb (void *cls,
rii,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
{
+#if FIXME
TALER_ARL_report (report_row_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("table",
@@ -2142,6 +1999,7 @@ reserve_in_cb (void *cls,
&rii->row_off_hash),
GNUNET_JSON_pack_string ("diagnostic",
"duplicate wire offset")));
+#endif
GNUNET_free (rii);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
@@ -2171,6 +2029,7 @@ complain_in_not_found (void *cls,
struct ReserveInInfo *rii = value;
(void) key;
+#if FIXME
TALER_ARL_report (
report_reserve_in_inconsistencies,
GNUNET_JSON_PACK (
@@ -2188,6 +2047,7 @@ complain_in_not_found (void *cls,
wa->ai->section_name),
GNUNET_JSON_pack_string ("diagnostic",
"incoming wire transfer claimed by exchange not found")));
+#endif
TALER_ARL_amount_add (&total_bad_amount_in_minus,
&total_bad_amount_in_minus,
&rii->details.amount);
@@ -2270,6 +2130,7 @@ analyze_credit (struct WireAccount *wa,
if (0 != GNUNET_memcmp (&details->reserve_pub,
&rii->details.reserve_pub))
{
+#if FIXME
TALER_ARL_report (
report_reserve_in_inconsistencies,
GNUNET_JSON_PACK (
@@ -2287,9 +2148,11 @@ analyze_credit (struct WireAccount *wa,
rii->details.execution_date.abs_time),
GNUNET_JSON_pack_string ("diagnostic",
"wire subject does not match")));
+#endif
TALER_ARL_amount_add (&total_bad_amount_in_minus,
&total_bad_amount_in_minus,
&rii->details.amount);
+#if FIXME
TALER_ARL_report (
report_reserve_in_inconsistencies,
GNUNET_JSON_PACK (
@@ -2307,7 +2170,7 @@ analyze_credit (struct WireAccount *wa,
details->execution_date.abs_time),
GNUNET_JSON_pack_string ("diagnostic",
"wire subject does not match")));
-
+#endif
TALER_ARL_amount_add (&total_bad_amount_in_plus,
&total_bad_amount_in_plus,
&details->amount);
@@ -2316,6 +2179,7 @@ analyze_credit (struct WireAccount *wa,
if (0 != TALER_amount_cmp (&rii->details.amount,
&details->amount))
{
+#if FIXME
TALER_ARL_report (
report_reserve_in_inconsistencies,
GNUNET_JSON_PACK (
@@ -2333,6 +2197,7 @@ analyze_credit (struct WireAccount *wa,
details->execution_date.abs_time),
GNUNET_JSON_pack_string ("diagnostic",
"wire amount does not match")));
+#endif
if (0 < TALER_amount_cmp (&details->amount,
&rii->details.amount))
{
@@ -2363,6 +2228,7 @@ analyze_credit (struct WireAccount *wa,
if (0 != strcasecmp (details->debit_account_uri,
rii->details.debit_account_uri))
{
+#if FIXME
TALER_ARL_report (report_misattribution_in_inconsistencies,
GNUNET_JSON_PACK (
TALER_JSON_pack_amount ("amount",
@@ -2374,6 +2240,7 @@ analyze_credit (struct WireAccount *wa,
GNUNET_JSON_pack_data_auto (
"reserve_pub",
&rii->details.reserve_pub)));
+#endif
TALER_ARL_amount_add (&total_misattribution_in,
&total_misattribution_in,
&rii->details.amount);
@@ -2382,6 +2249,7 @@ analyze_credit (struct WireAccount *wa,
!=,
rii->details.execution_date))
{
+#if FIXME
TALER_ARL_report (report_row_minor_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("table",
@@ -2392,6 +2260,7 @@ analyze_credit (struct WireAccount *wa,
details->serial_id),
GNUNET_JSON_pack_string ("diagnostic",
"execution date mismatch")));
+#endif
}
cleanup:
GNUNET_assert (GNUNET_OK ==
@@ -2578,6 +2447,7 @@ reserve_closed_cb (void *cls,
amount_with_fee,
closing_fee))
{
+#if FIXME
TALER_ARL_report (report_row_inconsistencies,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("table",
@@ -2592,6 +2462,7 @@ reserve_closed_cb (void *cls,
closing_fee),
GNUNET_JSON_pack_string ("diagnostic",
"closing fee above total amount")));
+#endif
GNUNET_free (rc);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
@@ -2657,7 +2528,31 @@ begin_transaction (void)
}
GNUNET_assert (GNUNET_OK ==
TALER_amount_set_zero (TALER_ARL_currency,
- &TALER_ARL_USE_AB (total_drained)));
+ &total_bad_amount_out_plus));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (TALER_ARL_currency,
+ &total_bad_amount_out_minus));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (TALER_ARL_currency,
+ &total_bad_amount_in_plus));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (TALER_ARL_currency,
+ &total_bad_amount_in_minus));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (TALER_ARL_currency,
+ &total_misattribution_in));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (TALER_ARL_currency,
+ &total_amount_lag));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (TALER_ARL_currency,
+ &total_closure_amount_lag));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (TALER_ARL_currency,
+ &total_wire_format_amount));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (TALER_ARL_currency,
+ &zero));
GNUNET_assert (GNUNET_OK ==
TALER_amount_set_zero (TALER_ARL_currency,
&total_wire_in));
@@ -2678,6 +2573,12 @@ begin_transaction (void)
GNUNET_break (0);
return qs;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (TALER_ARL_currency,
+ &TALER_ARL_USE_AB (total_drained)));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (TALER_ARL_currency,
+ &TALER_ARL_USE_AB (final_balance)));
had_start_balance = false;
break;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
@@ -2811,109 +2712,12 @@ db_notify (void *cls,
const void *extra,
size_t extra_size)
{
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Received notification to wake wire helper\n");
-
(void) cls;
(void) extra;
(void) extra_size;
- if (NULL ==
- (db_plugin = TALER_AUDITORDB_plugin_load (cfg)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to initialize DB subsystem\n");
- GNUNET_SCHEDULER_shutdown ();
- }
-
-
- if (GNUNET_OK !=
- TALER_config_get_amount (TALER_ARL_cfg,
- "auditor",
- "TINY_AMOUNT",
- &tiny_amount))
- {
- global_ret = EXIT_NOTCONFIGURED;
- return;
- }
- GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
- NULL);
- ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule,
- &rc);
- rc = GNUNET_CURL_gnunet_rc_create (ctx);
- if (NULL == ctx)
- {
- GNUNET_break (0);
- global_ret = EXIT_FAILURE;
- return;
- }
- reserve_closures = GNUNET_CONTAINER_multihashmap_create (1024,
- GNUNET_NO);
- GNUNET_assert (NULL !=
- (report_wire_out_inconsistencies = json_array ()));
- GNUNET_assert (NULL !=
- (report_reserve_in_inconsistencies = json_array ()));
- GNUNET_assert (NULL !=
- (report_row_minor_inconsistencies = json_array ()));
- GNUNET_assert (NULL !=
- (report_wire_format_inconsistencies
- = json_array ()));
- GNUNET_assert (NULL !=
- (report_row_inconsistencies = json_array ()));
- GNUNET_assert (NULL !=
- (report_misattribution_in_inconsistencies
- = json_array ()));
- GNUNET_assert (NULL !=
- (report_lags = json_array ()));
- GNUNET_assert (NULL !=
- (report_aml_lags = json_array ()));
- GNUNET_assert (NULL !=
- (report_kyc_lags = json_array ()));
- GNUNET_assert (NULL !=
- (report_closure_lags = json_array ()));
- GNUNET_assert (NULL !=
- (report_account_progress = json_array ()));
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (TALER_ARL_currency,
- &total_bad_amount_out_plus));
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (TALER_ARL_currency,
- &total_bad_amount_out_minus));
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (TALER_ARL_currency,
- &total_bad_amount_in_plus));
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (TALER_ARL_currency,
- &total_bad_amount_in_minus));
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (TALER_ARL_currency,
- &total_misattribution_in));
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (TALER_ARL_currency,
- &total_amount_lag));
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (TALER_ARL_currency,
- &total_closure_amount_lag));
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (TALER_ARL_currency,
- &total_wire_format_amount));
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (TALER_ARL_currency,
- &zero));
- if (GNUNET_OK !=
- TALER_EXCHANGEDB_load_accounts (TALER_ARL_cfg,
- TALER_EXCHANGEDB_ALO_DEBIT
- | TALER_EXCHANGEDB_ALO_CREDIT
- | TALER_EXCHANGEDB_ALO_AUTHDATA))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "No bank accounts configured\n");
- global_ret = EXIT_NOTCONFIGURED;
- GNUNET_SCHEDULER_shutdown ();
- }
- TALER_EXCHANGEDB_find_accounts (&process_account_cb,
- NULL);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Received notification to wake wire helper\n");
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
begin_transaction ())
{
@@ -2945,6 +2749,7 @@ run (void *cls,
(void) cls;
(void) args;
(void) cfgfile;
+ cfg = c;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Launching wire auditor\n");
if (GNUNET_OK !=
@@ -2954,39 +2759,25 @@ run (void *cls,
return;
}
- if (test_mode != 1)
+ reserve_closures
+ = GNUNET_CONTAINER_multihashmap_create (1024,
+ GNUNET_NO);
+ if (NULL ==
+ (db_plugin = TALER_AUDITORDB_plugin_load (cfg)))
{
- if (NULL ==
- (db_plugin = TALER_AUDITORDB_plugin_load (cfg)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to initialize DB subsystem\n");
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
- if (GNUNET_OK !=
- db_plugin->preflight (db_plugin->cls))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to connect to database\n");
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
-
-
- struct GNUNET_DB_EventHeaderP es = {
- .size = htons (sizeof (es)),
- .type = htons (TALER_DBEVENT_EXCHANGE_AUDITOR_WAKE_HELPER_WIRE)
- };
- eh = db_plugin->event_listen (db_plugin->cls,
- &es,
- GNUNET_TIME_UNIT_FOREVER_REL,
- &db_notify,
- NULL);
-
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to initialize DB subsystem\n");
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ if (GNUNET_OK !=
+ db_plugin->preflight (db_plugin->cls))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to connect to database\n");
+ GNUNET_SCHEDULER_shutdown ();
return;
}
-
if (GNUNET_OK !=
TALER_config_get_amount (TALER_ARL_cfg,
@@ -3010,30 +2801,6 @@ run (void *cls,
}
reserve_closures = GNUNET_CONTAINER_multihashmap_create (1024,
GNUNET_NO);
- GNUNET_assert (NULL !=
- (report_wire_out_inconsistencies = json_array ()));
- GNUNET_assert (NULL !=
- (report_reserve_in_inconsistencies = json_array ()));
- GNUNET_assert (NULL !=
- (report_row_minor_inconsistencies = json_array ()));
- GNUNET_assert (NULL !=
- (report_wire_format_inconsistencies
- = json_array ()));
- GNUNET_assert (NULL !=
- (report_row_inconsistencies = json_array ()));
- GNUNET_assert (NULL !=
- (report_misattribution_in_inconsistencies
- = json_array ()));
- GNUNET_assert (NULL !=
- (report_lags = json_array ()));
- GNUNET_assert (NULL !=
- (report_aml_lags = json_array ()));
- GNUNET_assert (NULL !=
- (report_kyc_lags = json_array ()));
- GNUNET_assert (NULL !=
- (report_closure_lags = json_array ()));
- GNUNET_assert (NULL !=
- (report_account_progress = json_array ()));
GNUNET_assert (GNUNET_OK ==
TALER_amount_set_zero (TALER_ARL_currency,
&total_bad_amount_out_plus));
@@ -3071,15 +2838,31 @@ run (void *cls,
"No bank accounts configured\n");
global_ret = EXIT_NOTCONFIGURED;
GNUNET_SCHEDULER_shutdown ();
+ return;
}
TALER_EXCHANGEDB_find_accounts (&process_account_cb,
NULL);
+
+ {
+ struct GNUNET_DB_EventHeaderP es = {
+ .size = htons (sizeof (es)),
+ .type = htons (TALER_DBEVENT_EXCHANGE_AUDITOR_WAKE_HELPER_WIRE)
+ };
+
+ eh = db_plugin->event_listen (db_plugin->cls,
+ &es,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ &db_notify,
+ NULL);
+ GNUNET_assert (NULL != eh);
+ }
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
begin_transaction ())
{
GNUNET_break (0);
global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
+ return;
}
}
diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh
index e384fd26d..fcc0f588d 100755
--- a/src/auditor/test-auditor.sh
+++ b/src/auditor/test-auditor.sh
@@ -228,24 +228,24 @@ function audit_only () {
2> "${MY_TMP_DIR}/test-audit-reserves-inc.err" \
|| exit_fail "incremental reserves audit failed (see ${MY_TMP_DIR}/test-audit-reserves-inc.*)"
echo -n "."
- #$VALGRIND taler-helper-auditor-wire \
- # -i \
- # -L DEBUG \
- # -c "$CONF" \
- # -t \
- # > "${MY_TMP_DIR}/test-audit-wire.out" \
- # 2> "${MY_TMP_DIR}/test-audit-wire.err" \
- # || exit_fail "wire audit failed (see ${MY_TMP_DIR}/test-audit-wire.*)"
- #echo -n "."
- #$VALGRIND taler-helper-auditor-wire \
- # -i \
- # -L DEBUG \
- # -c "$CONF" \
- # -t \
- # > "${MY_TMP_DIR}/test-audit-wire-inc.out" \
- # 2> "${MY_TMP_DIR}/test-audit-wire-inc.err" \
- # || exit_fail "wire audit inc failed (see ${MY_TMP_DIR}/test-audit-wire-inc.*)"
- #echo -n "."
+ $VALGRIND taler-helper-auditor-wire \
+ -i \
+ -L DEBUG \
+ -c "$CONF" \
+ -t \
+ > "${MY_TMP_DIR}/test-audit-wire.out" \
+ 2> "${MY_TMP_DIR}/test-audit-wire.err" \
+ || exit_fail "wire audit failed (see ${MY_TMP_DIR}/test-audit-wire.*)"
+ echo -n "."
+ $VALGRIND taler-helper-auditor-wire \
+ -i \
+ -L DEBUG \
+ -c "$CONF" \
+ -t \
+ > "${MY_TMP_DIR}/test-audit-wire-inc.out" \
+ 2> "${MY_TMP_DIR}/test-audit-wire-inc.err" \
+ || exit_fail "wire audit inc failed (see ${MY_TMP_DIR}/test-audit-wire-inc.*)"
+ echo -n "."
$VALGRIND taler-helper-auditor-purses \
-i \
-L DEBUG \