aboutsummaryrefslogtreecommitdiff
path: root/src/auditor
diff options
context:
space:
mode:
Diffstat (limited to 'src/auditor')
-rw-r--r--src/auditor/.gitignore5
-rw-r--r--src/auditor/Makefile.am64
-rw-r--r--src/auditor/report-lib.c243
-rw-r--r--src/auditor/report-lib.h85
-rw-r--r--src/auditor/taler-helper-auditor-aggregation.c (renamed from src/auditor/taler-auditor-aggregation.c)373
-rw-r--r--src/auditor/taler-helper-auditor-coins.c (renamed from src/auditor/taler-auditor-coins.c)660
-rw-r--r--src/auditor/taler-helper-auditor-deposits.c (renamed from src/auditor/taler-auditor-deposits.c)133
-rw-r--r--src/auditor/taler-helper-auditor-reserves.c (renamed from src/auditor/taler-auditor-reserves.c)607
-rw-r--r--src/auditor/taler-helper-auditor-wire.c (renamed from src/auditor/taler-wire-auditor.c)843
-rwxr-xr-xsrc/auditor/test-auditor.sh22
10 files changed, 1519 insertions, 1516 deletions
diff --git a/src/auditor/.gitignore b/src/auditor/.gitignore
index fe067a536..d065d10a5 100644
--- a/src/auditor/.gitignore
+++ b/src/auditor/.gitignore
@@ -13,3 +13,8 @@ test-wire-audit-inc.json
wirefees/
bank.err
libauditor.a
+taler-helper-auditor-aggregation
+taler-helper-auditor-coins
+taler-helper-auditor-deposits
+taler-helper-auditor-reserves
+taler-helper-auditor-wire
diff --git a/src/auditor/Makefile.am b/src/auditor/Makefile.am
index 819789efd..13410a16b 100644
--- a/src/auditor/Makefile.am
+++ b/src/auditor/Makefile.am
@@ -13,11 +13,11 @@ pkgcfg_DATA = \
bin_PROGRAMS = \
taler-auditor \
- taler-auditor-reserves \
- taler-auditor-coins \
- taler-auditor-aggregation \
- taler-auditor-deposits \
- taler-wire-auditor \
+ taler-helper-auditor-reserves \
+ taler-helper-auditor-coins \
+ taler-helper-auditor-aggregation \
+ taler-helper-auditor-deposits \
+ taler-helper-auditor-wire \
taler-auditor-exchange \
taler-auditor-httpd \
taler-auditor-sign \
@@ -44,9 +44,9 @@ taler_auditor_dbinit_CPPFLAGS = \
-I$(top_srcdir)/src/pq/ \
$(POSTGRESQL_CPPFLAGS)
-taler_auditor_reserves_SOURCES = \
- taler-auditor-reserves.c
-taler_auditor_reserves_LDADD = \
+taler_helper_auditor_reserves_SOURCES = \
+ taler-helper-auditor-reserves.c
+taler_helper_auditor_reserves_LDADD = \
$(LIBGCRYPT_LIBS) \
$(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/json/libtalerjson.la \
@@ -58,9 +58,9 @@ taler_auditor_reserves_LDADD = \
-lgnunetjson \
-lgnunetutil
-taler_auditor_coins_SOURCES = \
- taler-auditor-coins.c
-taler_auditor_coins_LDADD = \
+taler_helper_auditor_coins_SOURCES = \
+ taler-helper-auditor-coins.c
+taler_helper_auditor_coins_LDADD = \
$(LIBGCRYPT_LIBS) \
$(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/json/libtalerjson.la \
@@ -72,9 +72,9 @@ taler_auditor_coins_LDADD = \
-lgnunetjson \
-lgnunetutil
-taler_auditor_aggregation_SOURCES = \
- taler-auditor-aggregation.c
-taler_auditor_aggregation_LDADD = \
+taler_helper_auditor_aggregation_SOURCES = \
+ taler-helper-auditor-aggregation.c
+taler_helper_auditor_aggregation_LDADD = \
$(LIBGCRYPT_LIBS) \
$(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/json/libtalerjson.la \
@@ -86,9 +86,9 @@ taler_auditor_aggregation_LDADD = \
-lgnunetjson \
-lgnunetutil
-taler_auditor_deposits_SOURCES = \
- taler-auditor-deposits.c
-taler_auditor_deposits_LDADD = \
+taler_helper_auditor_deposits_SOURCES = \
+ taler-helper-auditor-deposits.c
+taler_helper_auditor_deposits_LDADD = \
$(LIBGCRYPT_LIBS) \
$(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/json/libtalerjson.la \
@@ -100,6 +100,22 @@ taler_auditor_deposits_LDADD = \
-lgnunetjson \
-lgnunetutil
+taler_helper_auditor_wire_SOURCES = \
+ taler-helper-auditor-wire.c
+taler_helper_auditor_wire_LDADD = \
+ $(LIBGCRYPT_LIBS) \
+ $(top_builddir)/src/util/libtalerutil.la \
+ $(top_builddir)/src/json/libtalerjson.la \
+ $(top_builddir)/src/bank-lib/libtalerbank.la \
+ $(top_builddir)/src/exchangedb/libtalerexchangedb.la \
+ $(top_builddir)/src/auditordb/libtalerauditordb.la \
+ libauditor.a \
+ -ljansson \
+ -lgnunetjson \
+ -lgnunetcurl \
+ -lgnunetutil
+
+
taler_auditor_SOURCES = \
taler-auditor.c
taler_auditor_LDADD = \
@@ -131,20 +147,6 @@ taler_auditor_httpd_LDADD = \
-lgnunetutil \
-lz
-taler_wire_auditor_SOURCES = \
- taler-wire-auditor.c
-taler_wire_auditor_LDADD = \
- $(LIBGCRYPT_LIBS) \
- $(top_builddir)/src/util/libtalerutil.la \
- $(top_builddir)/src/json/libtalerjson.la \
- $(top_builddir)/src/bank-lib/libtalerbank.la \
- $(top_builddir)/src/exchangedb/libtalerexchangedb.la \
- $(top_builddir)/src/auditordb/libtalerauditordb.la \
- -ljansson \
- -lgnunetjson \
- -lgnunetcurl \
- -lgnunetutil
-
taler_auditor_sign_SOURCES = \
taler-auditor-sign.c
taler_auditor_sign_LDADD = \
diff --git a/src/auditor/report-lib.c b/src/auditor/report-lib.c
index b2df8a14d..b00a522a7 100644
--- a/src/auditor/report-lib.c
+++ b/src/auditor/report-lib.c
@@ -22,49 +22,49 @@
#include "report-lib.h"
/**
- * Command-line option "-r": restart audit from scratch
+ * Command-line option "-r": TALER_ARL_restart audit from scratch
*/
-int restart;
+int TALER_ARL_restart;
/**
* Handle to access the exchange's database.
*/
-struct TALER_EXCHANGEDB_Plugin *edb;
+struct TALER_EXCHANGEDB_Plugin *TALER_ARL_edb;
/**
- * Which currency are we doing the audit for?
+ * Which TALER_ARL_currency are we doing the audit for?
*/
-char *currency;
+char *TALER_ARL_currency;
/**
- * How many fractional digits does the currency use?
+ * How many fractional digits does the TALER_ARL_currency use?
*/
-struct TALER_Amount currency_round_unit;
+struct TALER_Amount TALER_ARL_currency_round_unit;
/**
* Our configuration.
*/
-const struct GNUNET_CONFIGURATION_Handle *cfg;
+const struct GNUNET_CONFIGURATION_Handle *TALER_ARL_cfg;
/**
- * Our session with the #edb.
+ * Our session with the #TALER_ARL_edb.
*/
-struct TALER_EXCHANGEDB_Session *esession;
+struct TALER_EXCHANGEDB_Session *TALER_ARL_esession;
/**
* Handle to access the auditor's database.
*/
-struct TALER_AUDITORDB_Plugin *adb;
+struct TALER_AUDITORDB_Plugin *TALER_ARL_adb;
/**
- * Our session with the #adb.
+ * Our session with the #TALER_ARL_adb.
*/
-struct TALER_AUDITORDB_Session *asession;
+struct TALER_AUDITORDB_Session *TALER_ARL_asession;
/**
* Master public key of the exchange to audit.
*/
-struct TALER_MasterPublicKeyP master_pub;
+struct TALER_MasterPublicKeyP TALER_ARL_master_pub;
/**
* At what time did the auditor process start?
@@ -85,7 +85,7 @@ static struct GNUNET_CONTAINER_MultiHashMap *denominations;
* @return human-readable string representing the time
*/
json_t *
-json_from_time_abs_nbo (struct GNUNET_TIME_AbsoluteNBO at)
+TALER_ARL_TALER_ARL_json_from_time_abs_nbo (struct GNUNET_TIME_AbsoluteNBO at)
{
return json_string
(GNUNET_STRINGS_absolute_time_to_string
@@ -100,7 +100,7 @@ json_from_time_abs_nbo (struct GNUNET_TIME_AbsoluteNBO at)
* @return human-readable string representing the time
*/
json_t *
-json_from_time_abs (struct GNUNET_TIME_Absolute at)
+TALER_ARL_json_from_time_abs (struct GNUNET_TIME_Absolute at)
{
return json_string
(GNUNET_STRINGS_absolute_time_to_string (at));
@@ -108,14 +108,14 @@ json_from_time_abs (struct GNUNET_TIME_Absolute at)
/**
- * Add @a object to the report @a array. Fail hard if this fails.
+ * Add @a object to the TALER_ARL_report @a array. Fail hard if this fails.
*
- * @param array report array to append @a object to
+ * @param array TALER_ARL_report array to append @a object to
* @param object object to append, should be check that it is not NULL
*/
void
-report (json_t *array,
- json_t *object)
+TALER_ARL_report (json_t *array,
+ json_t *object)
{
GNUNET_assert (NULL != object);
GNUNET_assert (0 ==
@@ -185,9 +185,9 @@ add_denomination (void *cls,
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
-get_denomination_info_by_hash (const struct GNUNET_HashCode *dh,
- const struct
- TALER_DenominationKeyValidityPS **issue)
+TALER_ARL_get_denomination_info_by_hash (const struct GNUNET_HashCode *dh,
+ const struct
+ TALER_DenominationKeyValidityPS **issue)
{
const struct TALER_DenominationKeyValidityPS *i;
enum GNUNET_DB_QueryStatus qs;
@@ -196,11 +196,11 @@ get_denomination_info_by_hash (const struct GNUNET_HashCode *dh,
{
denominations = GNUNET_CONTAINER_multihashmap_create (256,
GNUNET_NO);
- qs = adb->select_denomination_info (adb->cls,
- asession,
- &master_pub,
- &add_denomination,
- NULL);
+ qs = TALER_ARL_adb->select_denomination_info (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &add_denomination,
+ NULL);
if (0 > qs)
{
*issue = NULL;
@@ -216,11 +216,11 @@ get_denomination_info_by_hash (const struct GNUNET_HashCode *dh,
return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
}
/* maybe database changed since we last iterated, give it one more shot */
- qs = adb->select_denomination_info (adb->cls,
- asession,
- &master_pub,
- &add_denomination,
- NULL);
+ qs = TALER_ARL_adb->select_denomination_info (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &add_denomination,
+ NULL);
if (qs <= 0)
{
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
@@ -255,10 +255,11 @@ get_denomination_info_by_hash (const struct GNUNET_HashCode *dh,
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
-get_denomination_info (const struct TALER_DenominationPublicKey *denom_pub,
- const struct
- TALER_DenominationKeyValidityPS **issue,
- struct GNUNET_HashCode *dh)
+TALER_ARL_get_denomination_info (const struct
+ TALER_DenominationPublicKey *denom_pub,
+ const struct
+ TALER_DenominationKeyValidityPS **issue,
+ struct GNUNET_HashCode *dh)
{
struct GNUNET_HashCode hc;
@@ -266,8 +267,8 @@ get_denomination_info (const struct TALER_DenominationPublicKey *denom_pub,
dh = &hc;
GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key,
dh);
- return get_denomination_info_by_hash (dh,
- issue);
+ return TALER_ARL_get_denomination_info_by_hash (dh,
+ issue);
}
@@ -281,25 +282,25 @@ get_denomination_info (const struct TALER_DenominationPublicKey *denom_pub,
* #GNUNET_NO if we had an error on commit (retry may help)
* #GNUNET_SYSERR on hard errors
*/
-int
-transact (Analysis analysis,
+static int
+transact (TALER_ARL_Analysis analysis,
void *analysis_cls)
{
int ret;
enum GNUNET_DB_QueryStatus qs;
- ret = adb->start (adb->cls,
- asession);
+ ret = TALER_ARL_adb->start (TALER_ARL_adb->cls,
+ TALER_ARL_asession);
if (GNUNET_OK != ret)
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
- edb->preflight (edb->cls,
- esession);
- ret = edb->start (edb->cls,
- esession,
- "auditor");
+ TALER_ARL_edb->preflight (TALER_ARL_edb->cls,
+ TALER_ARL_esession);
+ ret = TALER_ARL_edb->start (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ "auditor");
if (GNUNET_OK != ret)
{
GNUNET_break (0);
@@ -308,20 +309,20 @@ transact (Analysis analysis,
qs = analysis (analysis_cls);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
{
- qs = edb->commit (edb->cls,
- esession);
+ qs = TALER_ARL_edb->commit (TALER_ARL_edb->cls,
+ TALER_ARL_esession);
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Exchange DB commit failed, rolling back transaction\n");
- adb->rollback (adb->cls,
- asession);
+ TALER_ARL_adb->rollback (TALER_ARL_adb->cls,
+ TALER_ARL_asession);
}
else
{
- qs = adb->commit (adb->cls,
- asession);
+ qs = TALER_ARL_adb->commit (TALER_ARL_adb->cls,
+ TALER_ARL_asession);
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -334,10 +335,10 @@ transact (Analysis analysis,
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Processing failed (or no changes), rolling back transaction\n");
- adb->rollback (adb->cls,
- asession);
- edb->rollback (edb->cls,
- esession);
+ TALER_ARL_adb->rollback (TALER_ARL_adb->cls,
+ TALER_ARL_asession);
+ TALER_ARL_edb->rollback (TALER_ARL_edb->cls,
+ TALER_ARL_esession);
}
switch (qs)
{
@@ -362,18 +363,18 @@ transact (Analysis analysis,
* @return #GNUNET_OK on success
*/
int
-setup_sessions_and_run (Analysis ana,
- void *ana_cls)
+TALER_ARL_setup_sessions_and_run (TALER_ARL_Analysis ana,
+ void *ana_cls)
{
- esession = edb->get_session (edb->cls);
- if (NULL == esession)
+ TALER_ARL_esession = TALER_ARL_edb->get_session (TALER_ARL_edb->cls);
+ if (NULL == TALER_ARL_esession)
{
fprintf (stderr,
"Failed to initialize exchange session.\n");
return GNUNET_SYSERR;
}
- asession = adb->get_session (adb->cls);
- if (NULL == asession)
+ TALER_ARL_asession = TALER_ARL_adb->get_session (TALER_ARL_adb->cls);
+ if (NULL == TALER_ARL_asession)
{
fprintf (stderr,
"Failed to initialize auditor session.\n");
@@ -388,7 +389,7 @@ setup_sessions_and_run (Analysis ana,
/**
- * Test if the given @a mpub matches the #master_pub.
+ * Test if the given @a mpub matches the #TALER_ARL_master_pub.
* If so, set "found" to GNUNET_YES.
*
* @param cls a `int *` pointing to "found"
@@ -404,29 +405,35 @@ test_master_present (void *cls,
(void) exchange_url;
if (0 == GNUNET_memcmp (mpub,
- &master_pub))
+ &TALER_ARL_master_pub))
*found = GNUNET_YES;
}
+/**
+ * Setup global variables based on configuration.
+ *
+ * @param c configuration to use
+ * @return #GNUNET_OK on success
+ */
int
-setup_globals (const struct GNUNET_CONFIGURATION_Handle *c)
+TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c)
{
int found;
struct TALER_AUDITORDB_Session *as;
- cfg = c;
+ TALER_ARL_cfg = c;
start_time = GNUNET_TIME_absolute_get ();
- if (0 == GNUNET_is_zero (&master_pub))
+ if (0 == GNUNET_is_zero (&TALER_ARL_master_pub))
{
/* -m option not given, try configuration */
- char *master_public_key_str;
+ char *TALER_ARL_master_public_key_str;
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (cfg,
+ GNUNET_CONFIGURATION_get_value_string (TALER_ARL_cfg,
"exchange",
"MASTER_PUBLIC_KEY",
- &master_public_key_str))
+ &TALER_ARL_master_public_key_str))
{
fprintf (stderr,
"Pass option -m or set it in the configuration!\n");
@@ -436,35 +443,37 @@ setup_globals (const struct GNUNET_CONFIGURATION_Handle *c)
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_public_key_from_string (master_public_key_str,
- strlen (
- master_public_key_str),
- &master_pub.eddsa_pub))
+ GNUNET_CRYPTO_eddsa_public_key_from_string (
+ TALER_ARL_master_public_key_str,
+ strlen (
+ TALER_ARL_master_public_key_str),
+ &TALER_ARL_master_pub.
+ eddsa_pub))
{
fprintf (stderr,
"Invalid master public key given in configuration file.");
- GNUNET_free (master_public_key_str);
+ GNUNET_free (TALER_ARL_master_public_key_str);
return GNUNET_SYSERR;
}
- GNUNET_free (master_public_key_str);
+ GNUNET_free (TALER_ARL_master_public_key_str);
} /* end of -m not given */
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Taler auditor running for exchange master public key %s\n",
- TALER_B2S (&master_pub));
+ TALER_B2S (&TALER_ARL_master_pub));
if (GNUNET_OK !=
- TALER_config_get_currency (cfg,
- &currency))
+ TALER_config_get_currency (TALER_ARL_cfg,
+ &TALER_ARL_currency))
{
return GNUNET_SYSERR;
}
{
if (GNUNET_OK !=
- TALER_config_get_amount (cfg,
+ TALER_config_get_amount (TALER_ARL_cfg,
"taler",
"CURRENCY_ROUND_UNIT",
- &currency_round_unit))
+ &TALER_ARL_currency_round_unit))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid or missing amount in `TALER' under `CURRENCY_ROUND_UNIT'\n");
@@ -472,78 +481,86 @@ setup_globals (const struct GNUNET_CONFIGURATION_Handle *c)
}
}
if (NULL ==
- (edb = TALER_EXCHANGEDB_plugin_load (cfg)))
+ (TALER_ARL_edb = TALER_EXCHANGEDB_plugin_load (TALER_ARL_cfg)))
{
fprintf (stderr,
"Failed to initialize exchange database plugin.\n");
return GNUNET_SYSERR;
}
if (NULL ==
- (adb = TALER_AUDITORDB_plugin_load (cfg)))
+ (TALER_ARL_adb = TALER_AUDITORDB_plugin_load (TALER_ARL_cfg)))
{
fprintf (stderr,
"Failed to initialize auditor database plugin.\n");
- TALER_EXCHANGEDB_plugin_unload (edb);
+ TALER_EXCHANGEDB_plugin_unload (TALER_ARL_edb);
return GNUNET_SYSERR;
}
found = GNUNET_NO;
- as = adb->get_session (adb->cls);
+ as = TALER_ARL_adb->get_session (TALER_ARL_adb->cls);
if (NULL == as)
{
fprintf (stderr,
"Failed to start session with auditor database.\n");
- TALER_AUDITORDB_plugin_unload (adb);
- TALER_EXCHANGEDB_plugin_unload (edb);
+ TALER_AUDITORDB_plugin_unload (TALER_ARL_adb);
+ TALER_EXCHANGEDB_plugin_unload (TALER_ARL_edb);
return GNUNET_SYSERR;
}
- (void) adb->list_exchanges (adb->cls,
- as,
- &test_master_present,
- &found);
+ (void) TALER_ARL_adb->list_exchanges (TALER_ARL_adb->cls,
+ as,
+ &test_master_present,
+ &found);
if (GNUNET_NO == found)
{
fprintf (stderr,
"Exchange's master public key `%s' not known to auditor DB. Did you forget to run `taler-auditor-exchange`?\n",
- GNUNET_p2s (&master_pub.eddsa_pub));
- TALER_AUDITORDB_plugin_unload (adb);
- TALER_EXCHANGEDB_plugin_unload (edb);
+ GNUNET_p2s (&TALER_ARL_master_pub.eddsa_pub));
+ TALER_AUDITORDB_plugin_unload (TALER_ARL_adb);
+ TALER_EXCHANGEDB_plugin_unload (TALER_ARL_edb);
return GNUNET_SYSERR;
}
- if (restart)
+ if (TALER_ARL_restart)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Full audit restart requested, dropping old audit data.\n");
+ "Full audit TALER_ARL_restart requested, dropping old audit data.\n");
GNUNET_break (GNUNET_OK ==
- adb->drop_tables (adb->cls,
- GNUNET_NO));
- TALER_AUDITORDB_plugin_unload (adb);
+ TALER_ARL_adb->drop_tables (TALER_ARL_adb->cls,
+ GNUNET_NO));
+ TALER_AUDITORDB_plugin_unload (TALER_ARL_adb);
if (NULL ==
- (adb = TALER_AUDITORDB_plugin_load (cfg)))
+ (TALER_ARL_adb = TALER_AUDITORDB_plugin_load (TALER_ARL_cfg)))
{
fprintf (stderr,
"Failed to initialize auditor database plugin after drop.\n");
- TALER_EXCHANGEDB_plugin_unload (edb);
+ TALER_EXCHANGEDB_plugin_unload (TALER_ARL_edb);
return GNUNET_SYSERR;
}
GNUNET_break (GNUNET_OK ==
- adb->create_tables (adb->cls));
+ TALER_ARL_adb->create_tables (TALER_ARL_adb->cls));
}
return GNUNET_OK;
}
+/**
+ * Generate the report and close connectios to the database.
+ *
+ * @param report the report to output, may be NULL for no report
+ */
void
-finish_report (json_t *report)
+TALER_ARL_done (json_t *report)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Audit complete\n");
- TALER_AUDITORDB_plugin_unload (adb);
- adb = NULL;
- TALER_EXCHANGEDB_plugin_unload (edb);
- edb = NULL;
- json_dumpf (report,
- stdout,
- JSON_INDENT (2));
- json_decref (report);
+ TALER_AUDITORDB_plugin_unload (TALER_ARL_adb);
+ TALER_ARL_adb = NULL;
+ TALER_EXCHANGEDB_plugin_unload (TALER_ARL_edb);
+ TALER_ARL_edb = NULL;
+ if (NULL != report)
+ {
+ json_dumpf (report,
+ stdout,
+ JSON_INDENT (2));
+ json_decref (report);
+ }
}
diff --git a/src/auditor/report-lib.h b/src/auditor/report-lib.h
index 334ac198e..59229ad14 100644
--- a/src/auditor/report-lib.h
+++ b/src/auditor/report-lib.h
@@ -30,49 +30,49 @@
/**
- * Command-line option "-r": restart audit from scratch
+ * Command-line option "-r": TALER_ARL_restart audit from scratch
*/
-extern int restart;
+extern int TALER_ARL_restart;
/**
* Handle to access the exchange's database.
*/
-extern struct TALER_EXCHANGEDB_Plugin *edb;
+extern struct TALER_EXCHANGEDB_Plugin *TALER_ARL_edb;
/**
- * Which currency are we doing the audit for?
+ * Which TALER_ARL_currency are we doing the audit for?
*/
-extern char *currency;
+extern char *TALER_ARL_currency;
/**
- * How many fractional digits does the currency use?
+ * How many fractional digits does the TALER_ARL_currency use?
*/
-extern struct TALER_Amount currency_round_unit;
+extern struct TALER_Amount TALER_ARL_currency_round_unit;
/**
* Our configuration.
*/
-extern const struct GNUNET_CONFIGURATION_Handle *cfg;
+extern const struct GNUNET_CONFIGURATION_Handle *TALER_ARL_cfg;
/**
- * Our session with the #edb.
+ * Our session with the #TALER_ARL_edb.
*/
-extern struct TALER_EXCHANGEDB_Session *esession;
+extern struct TALER_EXCHANGEDB_Session *TALER_ARL_esession;
/**
* Handle to access the auditor's database.
*/
-extern struct TALER_AUDITORDB_Plugin *adb;
+extern struct TALER_AUDITORDB_Plugin *TALER_ARL_adb;
/**
- * Our session with the #adb.
+ * Our session with the #TALER_ARL_adb.
*/
-extern struct TALER_AUDITORDB_Session *asession;
+extern struct TALER_AUDITORDB_Session *TALER_ARL_asession;
/**
* Master public key of the exchange to audit.
*/
-extern struct TALER_MasterPublicKeyP master_pub;
+extern struct TALER_MasterPublicKeyP TALER_ARL_master_pub;
/**
* At what time did the auditor process start?
@@ -87,7 +87,7 @@ extern struct GNUNET_TIME_Absolute start_time;
* @return human-readable string representing the time
*/
json_t *
-json_from_time_abs_nbo (struct GNUNET_TIME_AbsoluteNBO at);
+TALER_ARL_TALER_ARL_json_from_time_abs_nbo (struct GNUNET_TIME_AbsoluteNBO at);
/**
@@ -97,18 +97,18 @@ json_from_time_abs_nbo (struct GNUNET_TIME_AbsoluteNBO at);
* @return human-readable string representing the time
*/
json_t *
-json_from_time_abs (struct GNUNET_TIME_Absolute at);
+TALER_ARL_json_from_time_abs (struct GNUNET_TIME_Absolute at);
/**
- * Add @a object to the report @a array. Fail hard if this fails.
+ * Add @a object to the TALER_ARL_report @a array. Fail hard if this fails.
*
- * @param array report array to append @a object to
+ * @param array TALER_ARL_report array to append @a object to
* @param object object to append, should be check that it is not NULL
*/
void
-report (json_t *array,
- json_t *object);
+TALER_ARL_report (json_t *array,
+ json_t *object);
/**
@@ -117,10 +117,10 @@ report (json_t *array,
* @param dh hash of the denomination public key to look up
* @param[out] issue set to detailed information about @a denom_pub, NULL if not found, must
* NOT be freed by caller
- * @return transaction status code
+ * @return TALER_ARL_transaction status code
*/
enum GNUNET_DB_QueryStatus
-get_denomination_info_by_hash (
+TALER_ARL_get_denomination_info_by_hash (
const struct GNUNET_HashCode *dh,
const struct TALER_DenominationKeyValidityPS **issue);
@@ -132,14 +132,15 @@ get_denomination_info_by_hash (
* @param[out] issue set to detailed information about @a denom_pub, NULL if not found, must
* NOT be freed by caller
* @param[out] dh set to the hash of @a denom_pub, may be NULL
- * @return transaction status code
+ * @return TALER_ARL_transaction status code
*/
enum GNUNET_DB_QueryStatus
-get_denomination_info (
+TALER_ARL_get_denomination_info (
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_DenominationKeyValidityPS **issue,
struct GNUNET_HashCode *dh);
+
/**
* Type of an analysis function. Each analysis function runs in
* its own transaction scope and must thus be internally consistent.
@@ -148,22 +149,7 @@ get_denomination_info (
* @return transaction status code
*/
typedef enum GNUNET_DB_QueryStatus
-(*Analysis)(void *cls);
-
-
-/**
- * Perform the given @a analysis within a transaction scope.
- * Commit on success.
- *
- * @param analysis analysis to run
- * @param analysis_cls closure for @a analysis
- * @return #GNUNET_OK if @a analysis succeessfully committed,
- * #GNUNET_NO if we had an error on commit (retry may help)
- * #GNUNET_SYSERR on hard errors
- */
-int
-transact (Analysis analysis,
- void *analysis_cls);
+(*TALER_ARL_Analysis)(void *cls);
/**
@@ -174,15 +160,26 @@ transact (Analysis analysis,
* @return #GNUNET_OK on success
*/
int
-setup_sessions_and_run (Analysis ana,
- void *ana_cls);
+TALER_ARL_setup_sessions_and_run (TALER_ARL_Analysis ana,
+ void *ana_cls);
+/**
+ * Setup global variables based on configuration.
+ *
+ * @param c configuration to use
+ * @return #GNUNET_OK on success
+ */
int
-setup_globals (const struct GNUNET_CONFIGURATION_Handle *c);
+TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c);
+/**
+ * Generate the report and close connectios to the database.
+ *
+ * @param report the report to output, may be NULL for no report
+ */
void
-finish_report (json_t *report);
+TALER_ARL_done (json_t *report);
#endif
diff --git a/src/auditor/taler-auditor-aggregation.c b/src/auditor/taler-helper-auditor-aggregation.c
index de249ed52..bbad71252 100644
--- a/src/auditor/taler-auditor-aggregation.c
+++ b/src/auditor/taler-helper-auditor-aggregation.c
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file auditor/taler-auditor-aggregation.c
+ * @file auditor/taler-helper-auditor-aggregation.c
* @brief audits an exchange's aggregations.
* @author Christian Grothoff
*/
@@ -133,8 +133,10 @@ static struct TALER_Amount total_bad_sig_loss;
static void
report_amount_arithmetic_inconsistency (const char *operation,
uint64_t rowid,
- const struct TALER_Amount *exchange,
- const struct TALER_Amount *auditor,
+ const struct
+ TALER_Amount *exchange,
+ const struct
+ TALER_Amount *auditor,
int profitable)
{
struct TALER_Amount delta;
@@ -158,13 +160,13 @@ report_amount_arithmetic_inconsistency (const char *operation,
auditor,
exchange));
}
- report (report_amount_arithmetic_inconsistencies,
- json_pack ("{s:s, s:I, s:o, s:o, s:I}",
- "operation", operation,
- "rowid", (json_int_t) rowid,
- "exchange", TALER_JSON_from_amount (exchange),
- "auditor", TALER_JSON_from_amount (auditor),
- "profitable", (json_int_t) profitable));
+ TALER_ARL_report (report_amount_arithmetic_inconsistencies,
+ json_pack ("{s:s, s:I, s:o, s:o, s:I}",
+ "operation", operation,
+ "rowid", (json_int_t) rowid,
+ "exchange", TALER_JSON_from_amount (exchange),
+ "auditor", TALER_JSON_from_amount (auditor),
+ "profitable", (json_int_t) profitable));
if (0 != profitable)
{
target = (1 == profitable)
@@ -194,9 +196,12 @@ report_amount_arithmetic_inconsistency (const char *operation,
static void
report_coin_arithmetic_inconsistency (const char *operation,
const struct
- TALER_CoinSpendPublicKeyP *coin_pub,
- const struct TALER_Amount *exchange,
- const struct TALER_Amount *auditor,
+ TALER_CoinSpendPublicKeyP *
+ coin_pub,
+ const struct
+ TALER_Amount *exchange,
+ const struct
+ TALER_Amount *auditor,
int profitable)
{
struct TALER_Amount delta;
@@ -220,13 +225,14 @@ report_coin_arithmetic_inconsistency (const char *operation,
auditor,
exchange));
}
- report (report_coin_inconsistencies,
- json_pack ("{s:s, s:o, s:o, s:o, s:I}",
- "operation", operation,
- "coin_pub", GNUNET_JSON_from_data_auto (coin_pub),
- "exchange", TALER_JSON_from_amount (exchange),
- "auditor", TALER_JSON_from_amount (auditor),
- "profitable", (json_int_t) profitable));
+ TALER_ARL_report (report_coin_inconsistencies,
+ json_pack ("{s:s, s:o, s:o, s:o, s:I}",
+ "operation", operation,
+ "coin_pub", GNUNET_JSON_from_data_auto (
+ coin_pub),
+ "exchange", TALER_JSON_from_amount (exchange),
+ "auditor", TALER_JSON_from_amount (auditor),
+ "profitable", (json_int_t) profitable));
if (0 != profitable)
{
target = (1 == profitable)
@@ -252,11 +258,11 @@ report_row_inconsistency (const char *table,
uint64_t rowid,
const char *diagnostic)
{
- report (report_row_inconsistencies,
- json_pack ("{s:s, s:I, s:s}",
- "table", table,
- "row", (json_int_t) rowid,
- "diagnostic", diagnostic));
+ TALER_ARL_report (report_row_inconsistencies,
+ json_pack ("{s:s, s:I, s:s}",
+ "table", table,
+ "row", (json_int_t) rowid,
+ "diagnostic", diagnostic));
}
@@ -368,7 +374,7 @@ struct WireCheckContext
* the amounts for the aggregation table and checks that the total
* claimed coin value is within the value of the coin's denomination.
*
- * @param coin_pub public key of the coin (for reporting)
+ * @param coin_pub public key of the coin (for TALER_ARL_reporting)
* @param h_contract_terms hash of the proposal for which we calculate the amount
* @param merchant_pub public key of the merchant (who is allowed to issue refunds)
* @param issue denomination information about the coin
@@ -379,17 +385,24 @@ struct WireCheckContext
*/
static int
check_transaction_history_for_deposit (const struct
- TALER_CoinSpendPublicKeyP *coin_pub,
+ TALER_CoinSpendPublicKeyP *
+ coin_pub,
const struct
- GNUNET_HashCode *h_contract_terms,
+ GNUNET_HashCode *
+ h_contract_terms,
const struct
- TALER_MerchantPublicKeyP *merchant_pub,
+ TALER_MerchantPublicKeyP *
+ merchant_pub,
const struct
- TALER_DenominationKeyValidityPS *issue,
+ TALER_DenominationKeyValidityPS
+ *issue,
const struct
- TALER_EXCHANGEDB_TransactionList *tl_head,
- struct TALER_Amount *merchant_gain,
- struct TALER_Amount *deposit_gain)
+ TALER_EXCHANGEDB_TransactionList
+ *tl_head,
+ struct TALER_Amount *
+ merchant_gain,
+ struct TALER_Amount *
+ deposit_gain)
{
struct TALER_Amount expenditures;
struct TALER_Amount refunds;
@@ -406,16 +419,16 @@ check_transaction_history_for_deposit (const struct
GNUNET_assert (NULL != tl_head);
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&expenditures));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&refunds));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
merchant_gain));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&merchant_loss));
/* Go over transaction history to compute totals; note that we do not
know the order, so instead of subtracting we compute positive
@@ -762,11 +775,11 @@ wire_transfer_information_cb (
}
/* Obtain coin's transaction history */
- qs = edb->get_coin_transactions (edb->cls,
- esession,
- coin_pub,
- GNUNET_YES,
- &tl);
+ qs = TALER_ARL_edb->get_coin_transactions (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ coin_pub,
+ GNUNET_YES,
+ &tl);
if ( (qs < 0) ||
(NULL == tl) )
{
@@ -776,10 +789,10 @@ wire_transfer_information_cb (
"no transaction history for coin claimed in aggregation");
return;
}
- qs = edb->get_known_coin (edb->cls,
- esession,
- coin_pub,
- &coin);
+ qs = TALER_ARL_edb->get_known_coin (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ coin_pub,
+ &coin);
if (qs < 0)
{
GNUNET_break (0); /* this should be a foreign key violation at this point! */
@@ -790,13 +803,13 @@ wire_transfer_information_cb (
return;
}
- qs = get_denomination_info_by_hash (&coin.denom_pub_hash,
- &issue);
+ qs = TALER_ARL_get_denomination_info_by_hash (&coin.denom_pub_hash,
+ &issue);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
GNUNET_CRYPTO_rsa_signature_free (coin.denom_sig.rsa_signature);
- edb->free_coin_transaction_list (edb->cls,
- tl);
+ TALER_ARL_edb->free_coin_transaction_list (TALER_ARL_edb->cls,
+ tl);
if (0 == qs)
report_row_inconsistency ("aggregation",
rowid,
@@ -809,20 +822,20 @@ wire_transfer_information_cb (
TALER_test_coin_valid (&coin,
denom_pub))
{
- report (report_bad_sig_losses,
- json_pack ("{s:s, s:I, s:o, s:o}",
- "operation", "wire",
- "row", (json_int_t) rowid,
- "loss", TALER_JSON_from_amount (coin_value),
- "key_pub", GNUNET_JSON_from_data_auto (
- &issue->denom_hash)));
+ TALER_ARL_report (report_bad_sig_losses,
+ json_pack ("{s:s, s:I, s:o, s:o}",
+ "operation", "wire",
+ "row", (json_int_t) rowid,
+ "loss", TALER_JSON_from_amount (coin_value),
+ "key_pub", GNUNET_JSON_from_data_auto (
+ &issue->denom_hash)));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
coin_value));
GNUNET_CRYPTO_rsa_signature_free (coin.denom_sig.rsa_signature);
- edb->free_coin_transaction_list (edb->cls,
- tl);
+ TALER_ARL_edb->free_coin_transaction_list (TALER_ARL_edb->cls,
+ tl);
wcc->qs = GNUNET_DB_STATUS_HARD_ERROR;
report_row_inconsistency ("deposit",
rowid,
@@ -841,7 +854,8 @@ wire_transfer_information_cb (
issue,
tl,
&computed_value,
- &total_deposit_without_refunds))
+ &
+ total_deposit_without_refunds))
{
wcc->qs = GNUNET_DB_STATUS_HARD_ERROR;
report_row_inconsistency ("coin history",
@@ -858,11 +872,12 @@ wire_transfer_information_cb (
deposit_fee))
{
wcc->qs = GNUNET_DB_STATUS_HARD_ERROR;
- report_amount_arithmetic_inconsistency ("aggregation (fee structure)",
- rowid,
- coin_value,
- deposit_fee,
- -1);
+ report_amount_arithmetic_inconsistency (
+ "aggregation (fee structure)",
+ rowid,
+ coin_value,
+ deposit_fee,
+ -1);
return;
}
if (0 !=
@@ -873,14 +888,16 @@ wire_transfer_information_cb (
"Expected coin contribution of %s to aggregate\n",
TALER_amount2s (&coin_value_without_fee));
wcc->qs = GNUNET_DB_STATUS_HARD_ERROR;
- report_amount_arithmetic_inconsistency ("aggregation (contribution)",
- rowid,
- &coin_value_without_fee,
- &total_deposit_without_refunds,
- -1);
+ report_amount_arithmetic_inconsistency (
+ "aggregation (contribution)",
+ rowid,
+ &coin_value_without_fee,
+ &
+ total_deposit_without_refunds,
+ -1);
}
- edb->free_coin_transaction_list (edb->cls,
- tl);
+ TALER_ARL_edb->free_coin_transaction_list (TALER_ARL_edb->cls,
+ tl);
/* Check other details of wire transfer match */
if (0 != GNUNET_memcmp (h_wire,
@@ -949,15 +966,15 @@ get_wire_fee (struct AggregationContext *ac,
/* Lookup fee in exchange database */
wfi = GNUNET_new (struct WireFeeInfo);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
- edb->get_wire_fee (edb->cls,
- esession,
- method,
- timestamp,
- &wfi->start_date,
- &wfi->end_date,
- &wfi->wire_fee,
- &wfi->closing_fee,
- &master_sig))
+ TALER_ARL_edb->get_wire_fee (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ method,
+ timestamp,
+ &wfi->start_date,
+ &wfi->end_date,
+ &wfi->wire_fee,
+ &wfi->closing_fee,
+ &master_sig))
{
GNUNET_break (0);
GNUNET_free (wfi);
@@ -985,7 +1002,7 @@ get_wire_fee (struct AggregationContext *ac,
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_WIRE_FEES,
&wf.purpose,
&master_sig.eddsa_signature,
- &master_pub.eddsa_pub))
+ &TALER_ARL_master_pub.eddsa_pub))
{
report_row_inconsistency ("wire-fee",
timestamp.abs_value_us,
@@ -1012,20 +1029,24 @@ get_wire_fee (struct AggregationContext *ac,
if ( (NULL != wfi->prev) &&
(wfi->prev->end_date.abs_value_us > wfi->start_date.abs_value_us) )
{
- report (report_fee_time_inconsistencies,
- json_pack ("{s:s, s:s, s:o}",
- "type", method,
- "diagnostic", "start date before previous end date",
- "time", json_from_time_abs (wfi->start_date)));
+ TALER_ARL_report (report_fee_time_inconsistencies,
+ json_pack ("{s:s, s:s, s:o}",
+ "type", method,
+ "diagnostic",
+ "start date before previous end date",
+ "time", TALER_ARL_json_from_time_abs (
+ wfi->start_date)));
}
if ( (NULL != wfi->next) &&
(wfi->next->start_date.abs_value_us >= wfi->end_date.abs_value_us) )
{
- report (report_fee_time_inconsistencies,
- json_pack ("{s:s, s:s, s:o}",
- "type", method,
- "diagnostic", "end date date after next start date",
- "time", json_from_time_abs (wfi->end_date)));
+ TALER_ARL_report (report_fee_time_inconsistencies,
+ json_pack ("{s:s, s:s, s:o}",
+ "type", method,
+ "diagnostic",
+ "end date date after next start date",
+ "time", TALER_ARL_json_from_time_abs (
+ wfi->end_date)));
}
return &wfi->wire_fee;
}
@@ -1089,11 +1110,11 @@ check_wire_out_cb (void *cls,
GNUNET_free (method);
return GNUNET_SYSERR;
}
- qs = edb->lookup_wire_transfer (edb->cls,
- esession,
- wtid,
- &wire_transfer_information_cb,
- &wcc);
+ qs = TALER_ARL_edb->lookup_wire_transfer (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ wtid,
+ &wire_transfer_information_cb,
+ &wcc);
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -1133,11 +1154,12 @@ check_wire_out_cb (void *cls,
&wcc.total_deposits,
wire_fee))
{
- report_amount_arithmetic_inconsistency ("wire out (fee structure)",
- rowid,
- &wcc.total_deposits,
- wire_fee,
- -1);
+ report_amount_arithmetic_inconsistency (
+ "wire out (fee structure)",
+ rowid,
+ &wcc.total_deposits,
+ wire_fee,
+ -1);
/* If fee arithmetic fails, we just assume the fee is zero */
final_amount = wcc.total_deposits;
}
@@ -1147,7 +1169,7 @@ check_wire_out_cb (void *cls,
/* Round down to amount supported by wire method */
GNUNET_break (GNUNET_SYSERR !=
TALER_amount_round_down (&final_amount,
- &currency_round_unit));
+ &TALER_ARL_currency_round_unit));
/* Calculate the exchange's gain as the fees plus rounding differences! */
if (GNUNET_SYSERR ==
@@ -1203,14 +1225,14 @@ check_wire_out_cb (void *cls,
&delta));
}
- report (report_wire_out_inconsistencies,
- json_pack ("{s:O, s:I, s:o, s:o}",
- "destination_account", wire,
- "rowid", (json_int_t) rowid,
- "expected",
- TALER_JSON_from_amount (&final_amount),
- "claimed",
- TALER_JSON_from_amount (amount)));
+ TALER_ARL_report (report_wire_out_inconsistencies,
+ json_pack ("{s:O, s:I, s:o, s:o}",
+ "destination_account", wire,
+ "rowid", (json_int_t) rowid,
+ "expected",
+ TALER_JSON_from_amount (&final_amount),
+ "claimed",
+ TALER_JSON_from_amount (amount)));
return GNUNET_OK;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -1238,10 +1260,10 @@ analyze_aggregations (void *cls)
(void) cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Analyzing aggregations\n");
- qsp = adb->get_auditor_progress_aggregation (adb->cls,
- asession,
- &master_pub,
- &ppa);
+ qsp = TALER_ARL_adb->get_auditor_progress_aggregation (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &ppa);
if (0 > qsp)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsp);
@@ -1264,21 +1286,22 @@ analyze_aggregations (void *cls)
memset (&ac,
0,
sizeof (ac));
- qsx = adb->get_wire_fee_summary (adb->cls,
- asession,
- &master_pub,
- &total_aggregation_fee_income);
+ qsx = TALER_ARL_adb->get_wire_fee_summary (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &total_aggregation_fee_income);
if (0 > qsx)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsx);
return qsx;
}
ac.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
- qs = edb->select_wire_out_above_serial_id (edb->cls,
- esession,
- ppa.last_wire_out_serial_id,
- &check_wire_out_cb,
- &ac);
+ qs = TALER_ARL_edb->select_wire_out_above_serial_id (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ ppa.
+ last_wire_out_serial_id,
+ &check_wire_out_cb,
+ &ac);
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -1302,30 +1325,34 @@ analyze_aggregations (void *cls)
return ac.qs;
}
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qsx)
- ac.qs = adb->insert_wire_fee_summary (adb->cls,
- asession,
- &master_pub,
- &total_aggregation_fee_income);
+ ac.qs = TALER_ARL_adb->insert_wire_fee_summary (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &
+ total_aggregation_fee_income);
else
- ac.qs = adb->update_wire_fee_summary (adb->cls,
- asession,
- &master_pub,
- &total_aggregation_fee_income);
+ ac.qs = TALER_ARL_adb->update_wire_fee_summary (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &
+ total_aggregation_fee_income);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != ac.qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == ac.qs);
return ac.qs;
}
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsp)
- qs = adb->update_auditor_progress_aggregation (adb->cls,
- asession,
- &master_pub,
- &ppa);
+ qs = TALER_ARL_adb->update_auditor_progress_aggregation (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &
+ TALER_ARL_master_pub,
+ &ppa);
else
- qs = adb->insert_auditor_progress_aggregation (adb->cls,
- asession,
- &master_pub,
- &ppa);
+ qs = TALER_ARL_adb->insert_auditor_progress_aggregation (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &
+ TALER_ARL_master_pub,
+ &ppa);
if (0 >= qs)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -1346,24 +1373,24 @@ analyze_aggregations (void *cls)
*
* @param cls closure
* @param args remaining command-line arguments
- * @param cfgfile name of the configuration file used (for saving, can be NULL!)
+ * @param TALER_ARL_cfgfile name of the configuration file used (for saving, can be NULL!)
* @param c configuration
*/
static void
run (void *cls,
char *const *args,
- const char *cfgfile,
+ const char *TALER_ARL_cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
{
json_t *report;
(void) cls;
(void) args;
- (void) cfgfile;
+ (void) TALER_ARL_cfgfile;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Launching auditor\n");
if (GNUNET_OK !=
- setup_globals (c))
+ TALER_ARL_init (c))
{
global_ret = 1;
return;
@@ -1371,28 +1398,28 @@ run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting audit\n");
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_aggregation_fee_income));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_wire_out_delta_plus));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_wire_out_delta_minus));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_arithmetic_delta_plus));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_arithmetic_delta_minus));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_coin_delta_plus));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_coin_delta_minus));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_bad_sig_loss));
GNUNET_assert (NULL !=
(report_row_inconsistencies = json_array ()));
@@ -1401,13 +1428,14 @@ run (void *cls,
GNUNET_assert (NULL !=
(report_coin_inconsistencies = json_array ()));
GNUNET_assert (NULL !=
- (report_amount_arithmetic_inconsistencies = json_array ()));
+ (report_amount_arithmetic_inconsistencies =
+ json_array ()));
GNUNET_assert (NULL !=
(report_bad_sig_losses = json_array ()));
GNUNET_assert (NULL !=
(report_fee_time_inconsistencies = json_array ()));
- setup_sessions_and_run (&analyze_aggregations,
- NULL);
+ TALER_ARL_setup_sessions_and_run (&analyze_aggregations,
+ NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Audit complete\n");
report = json_pack ("{s:o, s:o, s:o, s:o, s:o,"
@@ -1418,9 +1446,11 @@ run (void *cls,
"wire_out_inconsistencies",
report_wire_out_inconsistencies,
"total_wire_out_delta_plus",
- TALER_JSON_from_amount (&total_wire_out_delta_plus),
+ TALER_JSON_from_amount (
+ &total_wire_out_delta_plus),
"total_wire_out_delta_minus",
- TALER_JSON_from_amount (&total_wire_out_delta_minus),
+ TALER_JSON_from_amount (
+ &total_wire_out_delta_minus),
/* Tested in test-auditor.sh #4/#5/#6/#7/#13 */
"bad_sig_losses",
report_bad_sig_losses,
@@ -1436,27 +1466,34 @@ run (void *cls,
"total_coin_delta_plus",
TALER_JSON_from_amount (&total_coin_delta_plus),
"total_coin_delta_minus",
- TALER_JSON_from_amount (&total_coin_delta_minus),
+ TALER_JSON_from_amount (
+ &total_coin_delta_minus),
"amount_arithmetic_inconsistencies",
report_amount_arithmetic_inconsistencies,
/* block #3 */
"total_arithmetic_delta_plus",
- TALER_JSON_from_amount (&total_arithmetic_delta_plus),
+ TALER_JSON_from_amount (
+ &total_arithmetic_delta_plus),
"total_arithmetic_delta_minus",
- TALER_JSON_from_amount (&total_arithmetic_delta_minus),
+ TALER_JSON_from_amount (
+ &total_arithmetic_delta_minus),
"total_aggregation_fee_income",
- TALER_JSON_from_amount (&total_aggregation_fee_income),
+ TALER_JSON_from_amount (
+ &total_aggregation_fee_income),
"start_ppa_wire_out_serial_id",
(json_int_t) ppa_start.last_wire_out_serial_id,
"end_ppa_wire_out_serial_id",
(json_int_t) ppa.last_wire_out_serial_id,
/* block #4 */
- "auditor_start_time", json_from_time_abs (start_time),
- "auditor_end_time", json_from_time_abs (
+ "auditor_start_time",
+ TALER_ARL_json_from_time_abs (
+ start_time),
+ "auditor_end_time",
+ TALER_ARL_json_from_time_abs (
GNUNET_TIME_absolute_get ())
);
GNUNET_break (NULL != report);
- finish_report (report);
+ TALER_ARL_done (report);
}
@@ -1477,11 +1514,11 @@ main (int argc,
"exchange-key",
"KEY",
"public key of the exchange (Crockford base32 encoded)",
- &master_pub),
+ &TALER_ARL_master_pub),
GNUNET_GETOPT_option_flag ('r',
- "restart",
- "restart audit from the beginning (required on first run)",
- &restart),
+ "TALER_ARL_restart",
+ "TALER_ARL_restart audit from the beginning (required on first run)",
+ &TALER_ARL_restart),
GNUNET_GETOPT_option_timetravel ('T',
"timetravel"),
GNUNET_GETOPT_OPTION_END
diff --git a/src/auditor/taler-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c
index d895c0433..c9250961b 100644
--- a/src/auditor/taler-auditor-coins.c
+++ b/src/auditor/taler-helper-auditor-coins.c
@@ -14,25 +14,10 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file auditor/taler-auditor.c
- * @brief audits an exchange database.
+ * @file auditor/taler-helper-auditor0coins.c
+ * @brief audits coins in an exchange database.
* @author Christian Grothoff
*
- * NOTE:
- * - This auditor does not verify that 'reserves_in' actually matches
- * the wire transfers from the bank. This needs to be checked separately!
- * - Similarly, we do not check that the outgoing wire transfers match those
- * given in the 'wire_out' table. This needs to be checked separately!
- *
- * TODO:
- * - reorganize: different passes are combined in one tool and one
- * file here, we should split this up!
- * - likely should do an iteration over known_coins instead of checking
- * those signatures again and again
- * - might want to bite the bullet and do asynchronous signature
- * verification to improve parallelism / speed -- we'll need to scale
- * this eventually anyway!
- *
* UNDECIDED:
* - do we care about checking the 'done' flag in deposit_cb?
*/
@@ -76,19 +61,19 @@ static struct TALER_AUDITORDB_ProgressPointCoin ppc;
static struct TALER_AUDITORDB_ProgressPointCoin ppc_start;
/**
- * Array of reports about denomination keys with an
+ * Array of TALER_ARL_reports about denomination keys with an
* emergency (more value deposited than withdrawn)
*/
static json_t *report_emergencies;
/**
- * Array of reports about denomination keys with an
+ * Array of TALER_ARL_reports about denomination keys with an
* emergency (more coins deposited than withdrawn)
*/
static json_t *report_emergencies_by_count;
/**
- * Array of reports about row inconsitencies.
+ * Array of TALER_ARL_reports about row inconsitencies.
*/
static json_t *report_row_inconsistencies;
@@ -164,7 +149,7 @@ static struct TALER_Amount total_melt_fee_income;
static struct TALER_Amount total_refund_fee_income;
/**
- * Array of reports about coin operations with bad signatures.
+ * Array of TALER_ARL_reports about coin operations with bad signatures.
*/
static json_t *report_bad_sig_losses;
@@ -200,24 +185,27 @@ static struct TALER_Amount total_refresh_hanging;
* @param loss actual losses already (actualized before denomination was revoked)
*/
static void
-report_emergency_by_amount (const struct TALER_DenominationKeyValidityPS *issue,
+report_emergency_by_amount (const struct
+ TALER_DenominationKeyValidityPS *issue,
const struct TALER_Amount *risk,
const struct TALER_Amount *loss)
{
- report (report_emergencies,
- json_pack ("{s:o, s:o, s:o, s:o, s:o, s:o}",
- "denompub_hash",
- GNUNET_JSON_from_data_auto (&issue->denom_hash),
- "denom_risk",
- TALER_JSON_from_amount (risk),
- "denom_loss",
- TALER_JSON_from_amount (loss),
- "start",
- json_from_time_abs_nbo (issue->start),
- "deposit_end",
- json_from_time_abs_nbo (issue->expire_deposit),
- "value",
- TALER_JSON_from_amount_nbo (&issue->value)));
+ TALER_ARL_report (report_emergencies,
+ json_pack ("{s:o, s:o, s:o, s:o, s:o, s:o}",
+ "denompub_hash",
+ GNUNET_JSON_from_data_auto (&issue->denom_hash),
+ "denom_risk",
+ TALER_JSON_from_amount (risk),
+ "denom_loss",
+ TALER_JSON_from_amount (loss),
+ "start",
+ TALER_ARL_TALER_ARL_json_from_time_abs_nbo (
+ issue->start),
+ "deposit_end",
+ TALER_ARL_TALER_ARL_json_from_time_abs_nbo (
+ issue->expire_deposit),
+ "value",
+ TALER_JSON_from_amount_nbo (&issue->value)));
GNUNET_assert (GNUNET_OK ==
TALER_amount_add (&reported_emergency_risk_by_amount,
&reported_emergency_risk_by_amount,
@@ -244,29 +232,32 @@ report_emergency_by_amount (const struct TALER_DenominationKeyValidityPS *issue,
* @param risk amount that is at risk
*/
static void
-report_emergency_by_count (const struct TALER_DenominationKeyValidityPS *issue,
+report_emergency_by_count (const struct
+ TALER_DenominationKeyValidityPS *issue,
uint64_t num_issued,
uint64_t num_known,
const struct TALER_Amount *risk)
{
struct TALER_Amount denom_value;
- report (report_emergencies_by_count,
- json_pack ("{s:o, s:I, s:I, s:o, s:o, s:o, s:o}",
- "denompub_hash",
- GNUNET_JSON_from_data_auto (&issue->denom_hash),
- "num_issued",
- (json_int_t) num_issued,
- "num_known",
- (json_int_t) num_known,
- "denom_risk",
- TALER_JSON_from_amount (risk),
- "start",
- json_from_time_abs_nbo (issue->start),
- "deposit_end",
- json_from_time_abs_nbo (issue->expire_deposit),
- "value",
- TALER_JSON_from_amount_nbo (&issue->value)));
+ TALER_ARL_report (report_emergencies_by_count,
+ json_pack ("{s:o, s:I, s:I, s:o, s:o, s:o, s:o}",
+ "denompub_hash",
+ GNUNET_JSON_from_data_auto (&issue->denom_hash),
+ "num_issued",
+ (json_int_t) num_issued,
+ "num_known",
+ (json_int_t) num_known,
+ "denom_risk",
+ TALER_JSON_from_amount (risk),
+ "start",
+ TALER_ARL_TALER_ARL_json_from_time_abs_nbo (
+ issue->start),
+ "deposit_end",
+ TALER_ARL_TALER_ARL_json_from_time_abs_nbo (
+ issue->expire_deposit),
+ "value",
+ TALER_JSON_from_amount_nbo (&issue->value)));
GNUNET_assert (GNUNET_OK ==
TALER_amount_add (&reported_emergency_risk_by_count,
&reported_emergency_risk_by_count,
@@ -275,9 +266,10 @@ report_emergency_by_count (const struct TALER_DenominationKeyValidityPS *issue,
&issue->value);
for (uint64_t i = num_issued; i<num_known; i++)
GNUNET_assert (GNUNET_OK ==
- TALER_amount_add (&reported_emergency_loss_by_count,
- &reported_emergency_loss_by_count,
- &denom_value));
+ TALER_amount_add (
+ &reported_emergency_loss_by_count,
+ &reported_emergency_loss_by_count,
+ &denom_value));
}
@@ -298,8 +290,10 @@ report_emergency_by_count (const struct TALER_DenominationKeyValidityPS *issue,
static void
report_amount_arithmetic_inconsistency (const char *operation,
uint64_t rowid,
- const struct TALER_Amount *exchange,
- const struct TALER_Amount *auditor,
+ const struct
+ TALER_Amount *exchange,
+ const struct
+ TALER_Amount *auditor,
int profitable)
{
struct TALER_Amount delta;
@@ -323,13 +317,13 @@ report_amount_arithmetic_inconsistency (const char *operation,
auditor,
exchange));
}
- report (report_amount_arithmetic_inconsistencies,
- json_pack ("{s:s, s:I, s:o, s:o, s:I}",
- "operation", operation,
- "rowid", (json_int_t) rowid,
- "exchange", TALER_JSON_from_amount (exchange),
- "auditor", TALER_JSON_from_amount (auditor),
- "profitable", (json_int_t) profitable));
+ TALER_ARL_report (report_amount_arithmetic_inconsistencies,
+ json_pack ("{s:s, s:I, s:o, s:o, s:I}",
+ "operation", operation,
+ "rowid", (json_int_t) rowid,
+ "exchange", TALER_JSON_from_amount (exchange),
+ "auditor", TALER_JSON_from_amount (auditor),
+ "profitable", (json_int_t) profitable));
if (0 != profitable)
{
target = (1 == profitable)
@@ -355,11 +349,11 @@ report_row_inconsistency (const char *table,
uint64_t rowid,
const char *diagnostic)
{
- report (report_row_inconsistencies,
- json_pack ("{s:s, s:I, s:s}",
- "table", table,
- "row", (json_int_t) rowid,
- "diagnostic", diagnostic));
+ TALER_ARL_report (report_row_inconsistencies,
+ json_pack ("{s:s, s:I, s:s}",
+ "table", table,
+ "row", (json_int_t) rowid,
+ "diagnostic", diagnostic));
}
@@ -416,7 +410,7 @@ struct DenominationSummary
int in_db;
/**
- * Should we report an emergency for this denomination?
+ * Should we TALER_ARL_report an emergency for this denomination?
*/
int report_emergency;
@@ -466,14 +460,14 @@ init_denomination (const struct GNUNET_HashCode *denom_hash,
struct TALER_MasterSignatureP msig;
uint64_t rowid;
- qs = adb->get_denomination_balance (adb->cls,
- asession,
- denom_hash,
- &ds->denom_balance,
- &ds->denom_loss,
- &ds->denom_risk,
- &ds->denom_recoup,
- &ds->num_issued);
+ qs = TALER_ARL_adb->get_denomination_balance (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ denom_hash,
+ &ds->denom_balance,
+ &ds->denom_loss,
+ &ds->denom_risk,
+ &ds->denom_recoup,
+ &ds->num_issued);
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -488,11 +482,11 @@ init_denomination (const struct GNUNET_HashCode *denom_hash,
TALER_amount2s (&ds->denom_balance));
return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
}
- qs = edb->get_denomination_revocation (edb->cls,
- esession,
- denom_hash,
- &msig,
- &rowid);
+ qs = TALER_ARL_edb->get_denomination_revocation (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ denom_hash,
+ &msig,
+ &rowid);
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -512,7 +506,7 @@ init_denomination (const struct GNUNET_HashCode *denom_hash,
TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED,
&rm.purpose,
&msig.eddsa_signature,
- &master_pub.eddsa_pub))
+ &TALER_ARL_master_pub.eddsa_pub))
{
report_row_inconsistency ("denomination revocation table",
rowid,
@@ -524,16 +518,16 @@ init_denomination (const struct GNUNET_HashCode *denom_hash,
}
}
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&ds->denom_balance));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&ds->denom_loss));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&ds->denom_risk));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&ds->denom_recoup));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting balance for denomination `%s' is %s\n",
@@ -582,7 +576,7 @@ get_denomination_summary (struct CoinContext *cc,
/**
* Write information about the current knowledge about a denomination key
- * back to the database and update our global reporting data about the
+ * back to the database and update our global TALER_ARL_reporting data about the
* denomination. Also remove and free the memory of @a value.
*
* @param cls the `struct CoinContext`
@@ -613,9 +607,9 @@ sync_denomination (void *cls,
/* Denominationkey has expired, book remaining balance of
outstanding coins as revenue; and reduce cc->risk exposure. */
if (ds->in_db)
- qs = adb->del_denomination_balance (adb->cls,
- asession,
- denom_hash);
+ qs = TALER_ARL_adb->del_denomination_balance (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ denom_hash);
else
qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
if ( (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs) &&
@@ -646,13 +640,15 @@ sync_denomination (void *cls,
GNUNET_h2s (denom_hash),
TALER_amount2s (&ds->denom_balance));
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
- (qs = adb->insert_historic_denom_revenue (adb->cls,
- asession,
- &master_pub,
- denom_hash,
- expire_deposit,
- &ds->denom_balance,
- &ds->denom_recoup)))
+ (qs = TALER_ARL_adb->insert_historic_denom_revenue (
+ TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &
+ TALER_ARL_master_pub,
+ denom_hash,
+ expire_deposit,
+ &ds->denom_balance,
+ &ds->denom_recoup)))
{
/* Failed to store profits? Bad database */
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -669,9 +665,9 @@ sync_denomination (void *cls,
GNUNET_h2s (denom_hash),
TALER_amount2s (&ds->denom_balance),
(unsigned long long) ds->num_issued);
- cnt = edb->count_known_coins (edb->cls,
- esession,
- denom_hash);
+ cnt = TALER_ARL_edb->count_known_coins (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ denom_hash);
if (0 > cnt)
{
/* Failed to obtain count? Bad database */
@@ -696,23 +692,23 @@ sync_denomination (void *cls,
}
if (ds->in_db)
- qs = adb->update_denomination_balance (adb->cls,
- asession,
- denom_hash,
- &ds->denom_balance,
- &ds->denom_loss,
- &ds->denom_risk,
- &ds->denom_recoup,
- ds->num_issued);
+ qs = TALER_ARL_adb->update_denomination_balance (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ denom_hash,
+ &ds->denom_balance,
+ &ds->denom_loss,
+ &ds->denom_risk,
+ &ds->denom_recoup,
+ ds->num_issued);
else
- qs = adb->insert_denomination_balance (adb->cls,
- asession,
- denom_hash,
- &ds->denom_balance,
- &ds->denom_loss,
- &ds->denom_risk,
- &ds->denom_recoup,
- ds->num_issued);
+ qs = TALER_ARL_adb->insert_denomination_balance (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ denom_hash,
+ &ds->denom_balance,
+ &ds->denom_loss,
+ &ds->denom_risk,
+ &ds->denom_recoup,
+ ds->num_issued);
}
}
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
@@ -774,9 +770,9 @@ withdraw_cb (void *cls,
GNUNET_assert (rowid >= ppc.last_withdraw_serial_id); /* should be monotonically increasing */
ppc.last_withdraw_serial_id = rowid + 1;
- qs = get_denomination_info (denom_pub,
- &issue,
- &dh);
+ qs = TALER_ARL_get_denomination_info (denom_pub,
+ &issue,
+ &dh);
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
report_row_inconsistency ("withdraw",
@@ -902,7 +898,7 @@ reveal_data_cb (void *cls,
/**
* Check that the @a coin_pub is a known coin with a proper
- * signature for denominatinon @a denom_pub. If not, report
+ * signature for denominatinon @a denom_pub. If not, TALER_ARL_report
* a loss of @a loss_potential.
*
* @param coin_pub public key of a coin
@@ -923,10 +919,10 @@ check_known_coin (const struct TALER_CoinSpendPublicKeyP *coin_pub,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Checking denomination signature on %s\n",
TALER_B2S (coin_pub));
- qs = edb->get_known_coin (edb->cls,
- esession,
- coin_pub,
- &ci);
+ qs = TALER_ARL_edb->get_known_coin (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ coin_pub,
+ &ci);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -936,12 +932,14 @@ check_known_coin (const struct TALER_CoinSpendPublicKeyP *coin_pub,
TALER_test_coin_valid (&ci,
denom_pub))
{
- report (report_bad_sig_losses,
- json_pack ("{s:s, s:I, s:o, s:o}",
- "operation", "known-coin",
- "row", (json_int_t) -1,
- "loss", TALER_JSON_from_amount (loss_potential),
- "key_pub", GNUNET_JSON_from_data_auto (coin_pub)));
+ TALER_ARL_report (report_bad_sig_losses,
+ json_pack ("{s:s, s:I, s:o, s:o}",
+ "operation", "known-coin",
+ "row", (json_int_t) -1,
+ "loss", TALER_JSON_from_amount (
+ loss_potential),
+ "key_pub", GNUNET_JSON_from_data_auto (
+ coin_pub)));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
@@ -992,9 +990,9 @@ refresh_session_cb (void *cls,
GNUNET_assert (rowid >= ppc.last_melt_serial_id); /* should be monotonically increasing */
ppc.last_melt_serial_id = rowid + 1;
- qs = get_denomination_info (denom_pub,
- &issue,
- NULL);
+ qs = TALER_ARL_get_denomination_info (denom_pub,
+ &issue,
+ NULL);
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
report_row_inconsistency ("melt",
@@ -1032,12 +1030,14 @@ refresh_session_cb (void *cls,
&coin_sig->eddsa_signature,
&coin_pub->eddsa_pub))
{
- report (report_bad_sig_losses,
- json_pack ("{s:s, s:I, s:o, s:o}",
- "operation", "melt",
- "row", (json_int_t) rowid,
- "loss", TALER_JSON_from_amount (amount_with_fee),
- "key_pub", GNUNET_JSON_from_data_auto (coin_pub)));
+ TALER_ARL_report (report_bad_sig_losses,
+ json_pack ("{s:s, s:I, s:o, s:o}",
+ "operation", "melt",
+ "row", (json_int_t) rowid,
+ "loss", TALER_JSON_from_amount (
+ amount_with_fee),
+ "key_pub", GNUNET_JSON_from_data_auto (
+ coin_pub)));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
@@ -1061,11 +1061,11 @@ refresh_session_cb (void *cls,
memset (&reveal_ctx,
0,
sizeof (reveal_ctx));
- qs = edb->get_refresh_reveal (edb->cls,
- esession,
- rc,
- &reveal_data_cb,
- &reveal_ctx);
+ qs = TALER_ARL_edb->get_refresh_reveal (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ rc,
+ &reveal_data_cb,
+ &reveal_ctx);
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -1077,12 +1077,14 @@ refresh_session_cb (void *cls,
{
/* This can happen if /refresh/reveal was not yet called or only
with invalid data, even if the exchange is correctly
- operating. We still report it. */
- report (report_refreshs_hanging,
- json_pack ("{s:I, s:o, s:o}",
- "row", (json_int_t) rowid,
- "amount", TALER_JSON_from_amount (amount_with_fee),
- "coin_pub", GNUNET_JSON_from_data_auto (coin_pub)));
+ operating. We still TALER_ARL_report it. */
+ TALER_ARL_report (report_refreshs_hanging,
+ json_pack ("{s:I, s:o, s:o}",
+ "row", (json_int_t) rowid,
+ "amount", TALER_JSON_from_amount (
+ amount_with_fee),
+ "coin_pub", GNUNET_JSON_from_data_auto (
+ coin_pub)));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_refresh_hanging,
&total_refresh_hanging,
@@ -1100,9 +1102,9 @@ refresh_session_cb (void *cls,
for (unsigned int i = 0; i<reveal_ctx.num_freshcoins; i++)
{
/* lookup new coin denomination key */
- qs = get_denomination_info (&reveal_ctx.new_dps[i],
- &new_issues[i],
- NULL);
+ qs = TALER_ARL_get_denomination_info (&reveal_ctx.new_dps[i],
+ &new_issues[i],
+ NULL);
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
report_row_inconsistency ("refresh_reveal",
@@ -1369,9 +1371,9 @@ deposit_cb (void *cls,
GNUNET_assert (rowid >= ppc.last_deposit_serial_id); /* should be monotonically increasing */
ppc.last_deposit_serial_id = rowid + 1;
- qs = get_denomination_info (denom_pub,
- &issue,
- NULL);
+ qs = TALER_ARL_get_denomination_info (denom_pub,
+ &issue,
+ NULL);
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
report_row_inconsistency ("deposits",
@@ -1404,12 +1406,14 @@ deposit_cb (void *cls,
TALER_JSON_merchant_wire_signature_hash (receiver_wire_account,
&dr.h_wire))
{
- report (report_bad_sig_losses,
- json_pack ("{s:s, s:I, s:o, s:o}",
- "operation", "deposit",
- "row", (json_int_t) rowid,
- "loss", TALER_JSON_from_amount (amount_with_fee),
- "key_pub", GNUNET_JSON_from_data_auto (coin_pub)));
+ TALER_ARL_report (report_bad_sig_losses,
+ json_pack ("{s:s, s:I, s:o, s:o}",
+ "operation", "deposit",
+ "row", (json_int_t) rowid,
+ "loss", TALER_JSON_from_amount (
+ amount_with_fee),
+ "key_pub", GNUNET_JSON_from_data_auto (
+ coin_pub)));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
@@ -1429,12 +1433,14 @@ deposit_cb (void *cls,
&coin_sig->eddsa_signature,
&coin_pub->eddsa_pub))
{
- report (report_bad_sig_losses,
- json_pack ("{s:s, s:I, s:o, s:o}",
- "operation", "deposit",
- "row", (json_int_t) rowid,
- "loss", TALER_JSON_from_amount (amount_with_fee),
- "key_pub", GNUNET_JSON_from_data_auto (coin_pub)));
+ TALER_ARL_report (report_bad_sig_losses,
+ json_pack ("{s:s, s:I, s:o, s:o}",
+ "operation", "deposit",
+ "row", (json_int_t) rowid,
+ "loss", TALER_JSON_from_amount (
+ amount_with_fee),
+ "key_pub", GNUNET_JSON_from_data_auto (
+ coin_pub)));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
@@ -1560,9 +1566,9 @@ refund_cb (void *cls,
GNUNET_assert (rowid >= ppc.last_refund_serial_id); /* should be monotonically increasing */
ppc.last_refund_serial_id = rowid + 1;
- qs = get_denomination_info (denom_pub,
- &issue,
- NULL);
+ qs = TALER_ARL_get_denomination_info (denom_pub,
+ &issue,
+ NULL);
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
report_row_inconsistency ("refunds",
@@ -1592,12 +1598,14 @@ refund_cb (void *cls,
&merchant_sig->eddsa_sig,
&merchant_pub->eddsa_pub))
{
- report (report_bad_sig_losses,
- json_pack ("{s:s, s:I, s:o, s:o}",
- "operation", "refund",
- "row", (json_int_t) rowid,
- "loss", TALER_JSON_from_amount (amount_with_fee),
- "key_pub", GNUNET_JSON_from_data_auto (merchant_pub)));
+ TALER_ARL_report (report_bad_sig_losses,
+ json_pack ("{s:s, s:I, s:o, s:o}",
+ "operation", "refund",
+ "row", (json_int_t) rowid,
+ "loss", TALER_JSON_from_amount (
+ amount_with_fee),
+ "key_pub", GNUNET_JSON_from_data_auto (
+ merchant_pub)));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
@@ -1723,21 +1731,21 @@ check_recoup (struct CoinContext *cc,
TALER_test_coin_valid (coin,
denom_pub))
{
- report (report_bad_sig_losses,
- json_pack ("{s:s, s:I, s:o, s:o}",
- "operation", "recoup",
- "row", (json_int_t) rowid,
- "loss", TALER_JSON_from_amount (amount),
- "key_pub", GNUNET_JSON_from_data_auto (
- &pr.h_denom_pub)));
+ TALER_ARL_report (report_bad_sig_losses,
+ json_pack ("{s:s, s:I, s:o, s:o}",
+ "operation", "recoup",
+ "row", (json_int_t) rowid,
+ "loss", TALER_JSON_from_amount (amount),
+ "key_pub", GNUNET_JSON_from_data_auto (
+ &pr.h_denom_pub)));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
amount));
}
- qs = get_denomination_info (denom_pub,
- &issue,
- &pr.h_denom_pub);
+ qs = TALER_ARL_get_denomination_info (denom_pub,
+ &issue,
+ &pr.h_denom_pub);
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
report_row_inconsistency ("recoup",
@@ -1763,13 +1771,13 @@ check_recoup (struct CoinContext *cc,
&coin_sig->eddsa_signature,
&coin->coin_pub.eddsa_pub))
{
- report (report_bad_sig_losses,
- json_pack ("{s:s, s:I, s:o, s:o}",
- "operation", "recoup",
- "row", (json_int_t) rowid,
- "loss", TALER_JSON_from_amount (amount),
- "coin_pub", GNUNET_JSON_from_data_auto (
- &coin->coin_pub)));
+ TALER_ARL_report (report_bad_sig_losses,
+ json_pack ("{s:s, s:I, s:o, s:o}",
+ "operation", "recoup",
+ "row", (json_int_t) rowid,
+ "loss", TALER_JSON_from_amount (amount),
+ "coin_pub", GNUNET_JSON_from_data_auto (
+ &coin->coin_pub)));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
@@ -1782,13 +1790,14 @@ check_recoup (struct CoinContext *cc,
if (GNUNET_NO == ds->was_revoked)
{
/* Woopsie, we allowed recoup on non-revoked denomination!? */
- report (report_bad_sig_losses,
- json_pack ("{s:s, s:I, s:o, s:o}",
- "operation", "recoup (denomination not revoked)",
- "row", (json_int_t) rowid,
- "loss", TALER_JSON_from_amount (amount),
- "coin_pub", GNUNET_JSON_from_data_auto (
- &coin->coin_pub)));
+ TALER_ARL_report (report_bad_sig_losses,
+ json_pack ("{s:s, s:I, s:o, s:o}",
+ "operation",
+ "recoup (denomination not revoked)",
+ "row", (json_int_t) rowid,
+ "loss", TALER_JSON_from_amount (amount),
+ "coin_pub", GNUNET_JSON_from_data_auto (
+ &coin->coin_pub)));
}
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&ds->denom_recoup,
@@ -1898,10 +1907,10 @@ analyze_coins (void *cls)
(void) cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Analyzing coins\n");
- qsp = adb->get_auditor_progress_coin (adb->cls,
- asession,
- &master_pub,
- &ppc);
+ qsp = TALER_ARL_adb->get_auditor_progress_coin (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &ppc);
if (0 > qsp)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsp);
@@ -1928,16 +1937,16 @@ analyze_coins (void *cls)
cc.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
cc.denom_summaries = GNUNET_CONTAINER_multihashmap_create (256,
GNUNET_NO);
- qsx = adb->get_balance_summary (adb->cls,
- asession,
- &master_pub,
- &total_escrow_balance,
- &total_deposit_fee_income,
- &total_melt_fee_income,
- &total_refund_fee_income,
- &total_risk,
- &total_recoup_loss,
- &total_irregular_recoups);
+ qsx = TALER_ARL_adb->get_balance_summary (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &total_escrow_balance,
+ &total_deposit_fee_income,
+ &total_melt_fee_income,
+ &total_refund_fee_income,
+ &total_risk,
+ &total_recoup_loss,
+ &total_irregular_recoups);
if (0 > qsx)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsx);
@@ -1946,12 +1955,13 @@ analyze_coins (void *cls)
/* process withdrawals */
if (0 >
- (qs = edb->select_withdrawals_above_serial_id (edb->cls,
- esession,
- ppc.
- last_withdraw_serial_id,
- &withdraw_cb,
- &cc)) )
+ (qs = TALER_ARL_edb->select_withdrawals_above_serial_id (
+ TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ ppc.
+ last_withdraw_serial_id,
+ &withdraw_cb,
+ &cc)) )
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs;
@@ -1961,11 +1971,12 @@ analyze_coins (void *cls)
/* process refunds */
if (0 >
- (qs = edb->select_refunds_above_serial_id (edb->cls,
- esession,
- ppc.last_refund_serial_id,
- &refund_cb,
- &cc)))
+ (qs = TALER_ARL_edb->select_refunds_above_serial_id (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ ppc.
+ last_refund_serial_id,
+ &refund_cb,
+ &cc)))
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs;
@@ -1975,11 +1986,12 @@ analyze_coins (void *cls)
/* process refreshs */
if (0 >
- (qs = edb->select_refreshes_above_serial_id (edb->cls,
- esession,
- ppc.last_melt_serial_id,
- &refresh_session_cb,
- &cc)))
+ (qs = TALER_ARL_edb->select_refreshes_above_serial_id (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ ppc.
+ last_melt_serial_id,
+ &refresh_session_cb,
+ &cc)))
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs;
@@ -1989,11 +2001,12 @@ analyze_coins (void *cls)
/* process deposits */
if (0 >
- (qs = edb->select_deposits_above_serial_id (edb->cls,
- esession,
- ppc.last_deposit_serial_id,
- &deposit_cb,
- &cc)))
+ (qs = TALER_ARL_edb->select_deposits_above_serial_id (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ ppc.
+ last_deposit_serial_id,
+ &deposit_cb,
+ &cc)))
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs;
@@ -2003,11 +2016,12 @@ analyze_coins (void *cls)
/* process recoups */
if (0 >
- (qs = edb->select_recoup_above_serial_id (edb->cls,
- esession,
- ppc.last_recoup_serial_id,
- &recoup_cb,
- &cc)))
+ (qs = TALER_ARL_edb->select_recoup_above_serial_id (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ ppc.
+ last_recoup_serial_id,
+ &recoup_cb,
+ &cc)))
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs;
@@ -2015,12 +2029,14 @@ analyze_coins (void *cls)
if (0 > cc.qs)
return cc.qs;
if (0 >
- (qs = edb->select_recoup_refresh_above_serial_id (edb->cls,
- esession,
- ppc.
- last_recoup_refresh_serial_id,
- &recoup_refresh_cb,
- &cc)))
+ (qs = TALER_ARL_edb->select_recoup_refresh_above_serial_id (
+ TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ ppc.
+ last_recoup_refresh_serial_id,
+ &
+ recoup_refresh_cb,
+ &cc)))
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs;
@@ -2040,27 +2056,27 @@ analyze_coins (void *cls)
return cc.qs;
}
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsx)
- qs = adb->update_balance_summary (adb->cls,
- asession,
- &master_pub,
- &total_escrow_balance,
- &total_deposit_fee_income,
- &total_melt_fee_income,
- &total_refund_fee_income,
- &total_risk,
- &total_recoup_loss,
- &total_irregular_recoups);
+ qs = TALER_ARL_adb->update_balance_summary (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &total_escrow_balance,
+ &total_deposit_fee_income,
+ &total_melt_fee_income,
+ &total_refund_fee_income,
+ &total_risk,
+ &total_recoup_loss,
+ &total_irregular_recoups);
else
- qs = adb->insert_balance_summary (adb->cls,
- asession,
- &master_pub,
- &total_escrow_balance,
- &total_deposit_fee_income,
- &total_melt_fee_income,
- &total_refund_fee_income,
- &total_risk,
- &total_recoup_loss,
- &total_irregular_recoups);
+ qs = TALER_ARL_adb->insert_balance_summary (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &total_escrow_balance,
+ &total_deposit_fee_income,
+ &total_melt_fee_income,
+ &total_refund_fee_income,
+ &total_risk,
+ &total_recoup_loss,
+ &total_irregular_recoups);
if (0 >= qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -2068,15 +2084,15 @@ analyze_coins (void *cls)
}
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsp)
- qs = adb->update_auditor_progress_coin (adb->cls,
- asession,
- &master_pub,
- &ppc);
+ qs = TALER_ARL_adb->update_auditor_progress_coin (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &ppc);
else
- qs = adb->insert_auditor_progress_coin (adb->cls,
- asession,
- &master_pub,
- &ppc);
+ qs = TALER_ARL_adb->insert_auditor_progress_coin (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &ppc);
if (0 >= qs)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -2100,24 +2116,24 @@ analyze_coins (void *cls)
*
* @param cls closure
* @param args remaining command-line arguments
- * @param cfgfile name of the configuration file used (for saving, can be NULL!)
+ * @param TALER_ARL_cfgfile name of the configuration file used (for saving, can be NULL!)
* @param c configuration
*/
static void
run (void *cls,
char *const *args,
- const char *cfgfile,
+ const char *TALER_ARL_cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
{
json_t *report;
(void) cls;
(void) args;
- (void) cfgfile;
+ (void) TALER_ARL_cfgfile;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Launching auditor\n");
if (GNUNET_OK !=
- setup_globals (c))
+ TALER_ARL_init (c))
{
global_ret = 1;
return;
@@ -2125,49 +2141,52 @@ run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting audit\n");
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&reported_emergency_loss));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
- &reported_emergency_risk_by_amount));
+ TALER_amount_get_zero (TALER_ARL_currency,
+ &
+ reported_emergency_risk_by_amount));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
- &reported_emergency_risk_by_count));
+ TALER_amount_get_zero (TALER_ARL_currency,
+ &
+ reported_emergency_risk_by_count));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
- &reported_emergency_loss_by_count));
+ TALER_amount_get_zero (TALER_ARL_currency,
+ &
+ reported_emergency_loss_by_count));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_escrow_balance));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_risk));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_recoup_loss));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_irregular_recoups));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_deposit_fee_income));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_melt_fee_income));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_refund_fee_income));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_arithmetic_delta_plus));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_arithmetic_delta_minus));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_bad_sig_loss));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_refresh_hanging));
GNUNET_assert (NULL !=
(report_emergencies = json_array ()));
@@ -2176,14 +2195,15 @@ run (void *cls,
GNUNET_assert (NULL !=
(report_row_inconsistencies = json_array ()));
GNUNET_assert (NULL !=
- (report_amount_arithmetic_inconsistencies = json_array ()));
+ (report_amount_arithmetic_inconsistencies =
+ json_array ()));
GNUNET_assert (NULL !=
(report_bad_sig_losses = json_array ()));
GNUNET_assert (NULL !=
(report_refreshs_hanging = json_array ()));
if (GNUNET_OK !=
- setup_sessions_and_run (&analyze_coins,
- NULL))
+ TALER_ARL_setup_sessions_and_run (&analyze_coins,
+ NULL))
{
global_ret = 1;
return;
@@ -2203,11 +2223,13 @@ run (void *cls,
"total_active_risk",
TALER_JSON_from_amount (&total_risk),
"total_deposit_fee_income",
- TALER_JSON_from_amount (&total_deposit_fee_income),
+ TALER_JSON_from_amount (
+ &total_deposit_fee_income),
"total_melt_fee_income",
TALER_JSON_from_amount (&total_melt_fee_income),
"total_refund_fee_income",
- TALER_JSON_from_amount (&total_refund_fee_income),
+ TALER_JSON_from_amount (
+ &total_refund_fee_income),
/* Block #2 */
/* Tested in test-auditor.sh #18 */
"emergencies",
@@ -2229,9 +2251,11 @@ run (void *cls,
"amount_arithmetic_inconsistencies",
report_amount_arithmetic_inconsistencies,
"total_arithmetic_delta_plus",
- TALER_JSON_from_amount (&total_arithmetic_delta_plus),
+ TALER_JSON_from_amount (
+ &total_arithmetic_delta_plus),
"total_arithmetic_delta_minus",
- TALER_JSON_from_amount (&total_arithmetic_delta_minus),
+ TALER_JSON_from_amount (
+ &total_arithmetic_delta_minus),
/* Tested in test-auditor.sh #12 */
"total_refresh_hanging",
TALER_JSON_from_amount (&total_refresh_hanging),
@@ -2250,7 +2274,8 @@ run (void *cls,
&reported_emergency_risk_by_count),
/* Tested in test-auditor.sh #18 */
"emergencies_loss",
- TALER_JSON_from_amount (&reported_emergency_loss),
+ TALER_JSON_from_amount (
+ &reported_emergency_loss),
/* Tested in test-auditor.sh #18 */
"emergencies_loss_by_count",
TALER_JSON_from_amount (
@@ -2268,7 +2293,8 @@ run (void *cls,
(json_int_t) ppc_start.last_recoup_serial_id,
/* Block #6 */
"start_ppc_recoup_refresh_serial_id",
- (json_int_t) ppc_start.last_recoup_refresh_serial_id,
+ (json_int_t) ppc_start.
+ last_recoup_refresh_serial_id,
"end_ppc_withdraw_serial_id",
(json_int_t) ppc.last_withdraw_serial_id,
"end_ppc_deposit_serial_id",
@@ -2283,15 +2309,17 @@ run (void *cls,
"end_ppc_recoup_refresh_serial_id",
(json_int_t) ppc.last_recoup_refresh_serial_id,
"auditor_start_time", json_string (
- GNUNET_STRINGS_absolute_time_to_string (start_time)),
+ GNUNET_STRINGS_absolute_time_to_string (
+ start_time)),
"auditor_end_time", json_string (
GNUNET_STRINGS_absolute_time_to_string (
GNUNET_TIME_absolute_get ())),
"total_irregular_recoups",
- TALER_JSON_from_amount (&total_irregular_recoups)
+ TALER_JSON_from_amount (
+ &total_irregular_recoups)
);
GNUNET_break (NULL != report);
- finish_report (report);
+ TALER_ARL_done (report);
}
@@ -2312,11 +2340,11 @@ main (int argc,
"exchange-key",
"KEY",
"public key of the exchange (Crockford base32 encoded)",
- &master_pub),
+ &TALER_ARL_master_pub),
GNUNET_GETOPT_option_flag ('r',
- "restart",
- "restart audit from the beginning (required on first run)",
- &restart),
+ "TALER_ARL_restart",
+ "TALER_ARL_restart audit from the beginning (required on first run)",
+ &TALER_ARL_restart),
GNUNET_GETOPT_option_timetravel ('T',
"timetravel"),
GNUNET_GETOPT_OPTION_END
diff --git a/src/auditor/taler-auditor-deposits.c b/src/auditor/taler-helper-auditor-deposits.c
index ac8a0b624..eb3e0e7a3 100644
--- a/src/auditor/taler-auditor-deposits.c
+++ b/src/auditor/taler-helper-auditor-deposits.c
@@ -34,7 +34,7 @@
static int global_ret;
/**
- * Array of reports about missing deposit confirmations.
+ * Array of TALER_ARL_reports about missing deposit confirmations.
*/
static json_t *report_deposit_confirmation_inconsistencies;
@@ -58,7 +58,7 @@ struct DepositConfirmationContext
{
/**
- * How many deposit confirmations did we NOT find in the #edb?
+ * How many deposit confirmations did we NOT find in the #TALER_ARL_edb?
*/
unsigned long long missed_count;
@@ -89,8 +89,8 @@ struct DepositConfirmationContext
/**
- * Given a deposit confirmation from #adb, check that it is also
- * in #edb. Update the deposit confirmation context accordingly.
+ * Given a deposit confirmation from #TALER_ARL_adb, check that it is also
+ * in #TALER_ARL_edb. Update the deposit confirmation context accordingly.
*
* @param cls our `struct DepositConfirmationContext`
* @param serial_id row of the @a dc in the database
@@ -115,10 +115,10 @@ test_dc (void *cls,
dep.h_wire = dc->h_wire;
dep.refund_deadline = dc->refund_deadline;
- qs = edb->have_deposit (edb->cls,
- esession,
- &dep,
- GNUNET_NO /* do not check refund deadline */);
+ qs = TALER_ARL_edb->have_deposit (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ &dep,
+ GNUNET_NO /* do not check refund deadline */);
if (qs > 0)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -132,17 +132,17 @@ test_dc (void *cls,
dcc->qs = qs;
return;
}
- /* deposit confirmation missing! report! */
- report (report_deposit_confirmation_inconsistencies,
- json_pack ("{s:o, s:o, s:I, s:o}",
- "timestamp",
- json_from_time_abs (dc->timestamp),
- "amount",
- TALER_JSON_from_amount (&dc->amount_without_fee),
- "rowid",
- (json_int_t) serial_id,
- "account",
- GNUNET_JSON_from_data_auto (&dc->h_wire)));
+ /* deposit confirmation missing! TALER_ARL_report! */
+ TALER_ARL_report (report_deposit_confirmation_inconsistencies,
+ json_pack ("{s:o, s:o, s:I, s:o}",
+ "timestamp",
+ TALER_ARL_json_from_time_abs (dc->timestamp),
+ "amount",
+ TALER_JSON_from_amount (&dc->amount_without_fee),
+ "rowid",
+ (json_int_t) serial_id,
+ "account",
+ GNUNET_JSON_from_data_auto (&dc->h_wire)));
dcc->first_missed_coin_serial = GNUNET_MIN (dcc->first_missed_coin_serial,
serial_id);
dcc->missed_count++;
@@ -154,7 +154,7 @@ test_dc (void *cls,
/**
- * Check that the deposit-confirmations that were reported to
+ * Check that the deposit-confirmations that were TALER_ARL_reported to
* us by merchants are also in the exchange's database.
*
* @param cls closure
@@ -173,10 +173,12 @@ analyze_deposit_confirmations (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Analyzing deposit confirmations\n");
ppdc.last_deposit_confirmation_serial_id = 0;
- qsp = adb->get_auditor_progress_deposit_confirmation (adb->cls,
- asession,
- &master_pub,
- &ppdc);
+ qsp = TALER_ARL_adb->get_auditor_progress_deposit_confirmation (
+ TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &
+ TALER_ARL_master_pub,
+ &ppdc);
if (0 > qsp)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsp);
@@ -197,17 +199,18 @@ analyze_deposit_confirmations (void *cls)
/* setup 'cc' */
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&dcc.missed_amount));
dcc.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
dcc.missed_count = 0LLU;
dcc.first_missed_coin_serial = UINT64_MAX;
- qsx = adb->get_deposit_confirmations (adb->cls,
- asession,
- &master_pub,
- ppdc.last_deposit_confirmation_serial_id,
- &test_dc,
- &dcc);
+ qsx = TALER_ARL_adb->get_deposit_confirmations (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ ppdc.
+ last_deposit_confirmation_serial_id,
+ &test_dc,
+ &dcc);
if (0 > qsx)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsx);
@@ -229,15 +232,19 @@ analyze_deposit_confirmations (void *cls)
/* sync 'cc' back to disk */
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsp)
- qs = adb->update_auditor_progress_deposit_confirmation (adb->cls,
- asession,
- &master_pub,
- &ppdc);
+ qs = TALER_ARL_adb->update_auditor_progress_deposit_confirmation (
+ TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &
+ TALER_ARL_master_pub,
+ &ppdc);
else
- qs = adb->insert_auditor_progress_deposit_confirmation (adb->cls,
- asession,
- &master_pub,
- &ppdc);
+ qs = TALER_ARL_adb->insert_auditor_progress_deposit_confirmation (
+ TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &
+ TALER_ARL_master_pub,
+ &ppdc);
if (0 >= qs)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -260,24 +267,22 @@ analyze_deposit_confirmations (void *cls)
*
* @param cls closure
* @param args remaining command-line arguments
- * @param cfgfile name of the configuration file used (for saving, can be NULL!)
+ * @param TALER_ARL_cfgfile name of the configuration file used (for saving, can be NULL!)
* @param c configuration
*/
static void
run (void *cls,
char *const *args,
- const char *cfgfile,
+ const char *TALER_ARL_cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
{
- json_t *report;
-
(void) cls;
(void) args;
- (void) cfgfile;
+ (void) TALER_ARL_cfgfile;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Launching auditor\n");
if (GNUNET_OK !=
- setup_globals (c))
+ TALER_ARL_init (c))
{
global_ret = 1;
return;
@@ -287,25 +292,29 @@ run (void *cls,
GNUNET_assert (NULL !=
(report_deposit_confirmation_inconsistencies = json_array ()));
if (GNUNET_OK !=
- setup_sessions_and_run (&analyze_deposit_confirmations,
- NULL))
+ TALER_ARL_setup_sessions_and_run (&analyze_deposit_confirmations,
+ NULL))
{
global_ret = 1;
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Audit complete\n");
- report = json_pack ("{s:o, s:o, s:I}",
- "deposit_confirmation_inconsistencies",
- report_deposit_confirmation_inconsistencies,
- "missing_deposit_confirmation_count",
- (json_int_t) number_missed_deposit_confirmations,
- "missing_deposit_confirmation_total",
- TALER_JSON_from_amount (
- &total_missed_deposit_confirmations)
- );
- GNUNET_break (NULL != report);
- finish_report (report);
+ {
+ json_t *report;
+
+ report = json_pack ("{s:o, s:o, s:I}",
+ "deposit_confirmation_inconsistencies",
+ report_deposit_confirmation_inconsistencies,
+ "missing_deposit_confirmation_count",
+ (json_int_t) number_missed_deposit_confirmations,
+ "missing_deposit_confirmation_total",
+ TALER_JSON_from_amount (
+ &total_missed_deposit_confirmations)
+ );
+ GNUNET_break (NULL != report);
+ TALER_ARL_done (report);
+ }
}
@@ -326,11 +335,11 @@ main (int argc,
"exchange-key",
"KEY",
"public key of the exchange (Crockford base32 encoded)",
- &master_pub),
+ &TALER_ARL_master_pub),
GNUNET_GETOPT_option_flag ('r',
- "restart",
- "restart audit from the beginning (required on first run)",
- &restart),
+ "TALER_ARL_restart",
+ "TALER_ARL_restart audit from the beginning (required on first run)",
+ &TALER_ARL_restart),
GNUNET_GETOPT_option_timetravel ('T',
"timetravel"),
GNUNET_GETOPT_OPTION_END
diff --git a/src/auditor/taler-auditor-reserves.c b/src/auditor/taler-helper-auditor-reserves.c
index 2fe103c81..cd0f1b98b 100644
--- a/src/auditor/taler-auditor-reserves.c
+++ b/src/auditor/taler-helper-auditor-reserves.c
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file auditor/taler-auditor-reserves.c
+ * @file auditor/taler-helper-auditor-reserves.c
* @brief audits the reserves of an exchange database
* @author Christian Grothoff
*/
@@ -162,8 +162,10 @@ static struct TALER_Amount total_bad_sig_loss;
static void
report_amount_arithmetic_inconsistency (const char *operation,
uint64_t rowid,
- const struct TALER_Amount *exchange,
- const struct TALER_Amount *auditor,
+ const struct
+ TALER_Amount *exchange,
+ const struct
+ TALER_Amount *auditor,
int profitable)
{
struct TALER_Amount delta;
@@ -187,13 +189,13 @@ report_amount_arithmetic_inconsistency (const char *operation,
auditor,
exchange));
}
- report (report_amount_arithmetic_inconsistencies,
- json_pack ("{s:s, s:I, s:o, s:o, s:I}",
- "operation", operation,
- "rowid", (json_int_t) rowid,
- "exchange", TALER_JSON_from_amount (exchange),
- "auditor", TALER_JSON_from_amount (auditor),
- "profitable", (json_int_t) profitable));
+ TALER_ARL_report (report_amount_arithmetic_inconsistencies,
+ json_pack ("{s:s, s:I, s:o, s:o, s:I}",
+ "operation", operation,
+ "rowid", (json_int_t) rowid,
+ "exchange", TALER_JSON_from_amount (exchange),
+ "auditor", TALER_JSON_from_amount (auditor),
+ "profitable", (json_int_t) profitable));
if (0 != profitable)
{
target = (1 == profitable)
@@ -219,11 +221,11 @@ report_row_inconsistency (const char *table,
uint64_t rowid,
const char *diagnostic)
{
- report (report_row_inconsistencies,
- json_pack ("{s:s, s:I, s:s}",
- "table", table,
- "row", (json_int_t) rowid,
- "diagnostic", diagnostic));
+ TALER_ARL_report (report_row_inconsistencies,
+ json_pack ("{s:s, s:I, s:s}",
+ "table", table,
+ "row", (json_int_t) rowid,
+ "diagnostic", diagnostic));
}
@@ -306,15 +308,15 @@ load_auditor_reserve_summary (struct ReserveSummary *rs)
enum GNUNET_DB_QueryStatus qs;
uint64_t rowid;
- qs = adb->get_reserve_info (adb->cls,
- asession,
- &rs->reserve_pub,
- &master_pub,
- &rowid,
- &rs->a_balance,
- &rs->a_withdraw_fee_balance,
- &rs->a_expiration_date,
- &rs->sender_account);
+ qs = TALER_ARL_adb->get_reserve_info (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &rs->reserve_pub,
+ &TALER_ARL_master_pub,
+ &rowid,
+ &rs->a_balance,
+ &rs->a_withdraw_fee_balance,
+ &rs->a_expiration_date,
+ &rs->sender_account);
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -502,9 +504,9 @@ handle_reserve_out (void *cls,
ppr.last_reserve_out_serial_id = rowid + 1;
/* lookup denomination pub data (make sure denom_pub is valid, establish fees) */
- qs = get_denomination_info (denom_pub,
- &issue,
- &wsrd.h_denomination_pub);
+ qs = TALER_ARL_get_denomination_info (denom_pub,
+ &issue,
+ &wsrd.h_denomination_pub);
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -535,14 +537,15 @@ handle_reserve_out (void *cls,
if ( (valid_start.abs_value_us > execution_date.abs_value_us) ||
(expire_withdraw.abs_value_us < execution_date.abs_value_us) )
{
- report (denomination_key_validity_withdraw_inconsistencies,
- json_pack ("{s:I, s:o, s:o, s:o}",
- "row", (json_int_t) rowid,
- "execution_date",
- json_from_time_abs (execution_date),
- "reserve_pub", GNUNET_JSON_from_data_auto (reserve_pub),
- "denompub_h", GNUNET_JSON_from_data_auto (
- &wsrd.h_denomination_pub)));
+ TALER_ARL_report (denomination_key_validity_withdraw_inconsistencies,
+ json_pack ("{s:I, s:o, s:o, s:o}",
+ "row", (json_int_t) rowid,
+ "execution_date",
+ TALER_ARL_json_from_time_abs (execution_date),
+ "reserve_pub", GNUNET_JSON_from_data_auto (
+ reserve_pub),
+ "denompub_h", GNUNET_JSON_from_data_auto (
+ &wsrd.h_denomination_pub)));
}
/* check reserve_sig */
@@ -559,12 +562,14 @@ handle_reserve_out (void *cls,
&reserve_sig->eddsa_signature,
&reserve_pub->eddsa_pub))
{
- report (report_bad_sig_losses,
- json_pack ("{s:s, s:I, s:o, s:o}",
- "operation", "withdraw",
- "row", (json_int_t) rowid,
- "loss", TALER_JSON_from_amount (amount_with_fee),
- "key_pub", GNUNET_JSON_from_data_auto (reserve_pub)));
+ TALER_ARL_report (report_bad_sig_losses,
+ json_pack ("{s:s, s:I, s:o, s:o}",
+ "operation", "withdraw",
+ "row", (json_int_t) rowid,
+ "loss", TALER_JSON_from_amount (
+ amount_with_fee),
+ "key_pub", GNUNET_JSON_from_data_auto (
+ reserve_pub)));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
@@ -682,13 +687,13 @@ handle_recoup_by_reserve (void *cls,
&coin_sig->eddsa_signature,
&coin->coin_pub.eddsa_pub))
{
- report (report_bad_sig_losses,
- json_pack ("{s:s, s:I, s:o, s:o}",
- "operation", "recoup",
- "row", (json_int_t) rowid,
- "loss", TALER_JSON_from_amount (amount),
- "key_pub", GNUNET_JSON_from_data_auto (
- &coin->coin_pub)));
+ TALER_ARL_report (report_bad_sig_losses,
+ json_pack ("{s:s, s:I, s:o, s:o}",
+ "operation", "recoup",
+ "row", (json_int_t) rowid,
+ "loss", TALER_JSON_from_amount (amount),
+ "key_pub", GNUNET_JSON_from_data_auto (
+ &coin->coin_pub)));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
@@ -700,11 +705,11 @@ handle_recoup_by_reserve (void *cls,
&pr.h_denom_pub);
if (NULL == rev)
{
- qs = edb->get_denomination_revocation (edb->cls,
- esession,
- &pr.h_denom_pub,
- &msig,
- &rev_rowid);
+ qs = TALER_ARL_edb->get_denomination_revocation (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ &pr.h_denom_pub,
+ &msig,
+ &rev_rowid);
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -735,7 +740,7 @@ handle_recoup_by_reserve (void *cls,
TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED,
&kr.purpose,
&msig.eddsa_signature,
- &master_pub.eddsa_pub))
+ &TALER_ARL_master_pub.eddsa_pub))
{
rev = "master signature invalid";
}
@@ -757,12 +762,13 @@ handle_recoup_by_reserve (void *cls,
if ( (NULL != rev) &&
(0 == strcmp (rev, "master signature invalid")) )
{
- report (report_bad_sig_losses,
- json_pack ("{s:s, s:I, s:o, s:o}",
- "operation", "recoup-master",
- "row", (json_int_t) rev_rowid,
- "loss", TALER_JSON_from_amount (amount),
- "key_pub", GNUNET_JSON_from_data_auto (&master_pub)));
+ TALER_ARL_report (report_bad_sig_losses,
+ json_pack ("{s:s, s:I, s:o, s:o}",
+ "operation", "recoup-master",
+ "row", (json_int_t) rev_rowid,
+ "loss", TALER_JSON_from_amount (amount),
+ "key_pub", GNUNET_JSON_from_data_auto (
+ &TALER_ARL_master_pub)));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
@@ -843,15 +849,15 @@ get_closing_fee (const char *receiver_account,
"Method is `%s'\n",
method);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
- edb->get_wire_fee (edb->cls,
- esession,
- method,
- atime,
- &start_date,
- &end_date,
- &wire_fee,
- fee,
- &master_sig))
+ TALER_ARL_edb->get_wire_fee (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ method,
+ atime,
+ &start_date,
+ &end_date,
+ &wire_fee,
+ fee,
+ &master_sig))
{
report_row_inconsistency ("closing-fee",
atime.abs_value_us,
@@ -950,11 +956,12 @@ handle_reserve_closed (void *cls,
else if (0 != TALER_amount_cmp (&expected_fee,
closing_fee))
{
- report_amount_arithmetic_inconsistency ("closing aggregation fee",
- rowid,
- closing_fee,
- &expected_fee,
- 1);
+ report_amount_arithmetic_inconsistency (
+ "closing aggregation fee",
+ rowid,
+ closing_fee,
+ &expected_fee,
+ 1);
}
}
if (NULL == rs->sender_account)
@@ -1006,9 +1013,9 @@ verify_reserve_balance (void *cls,
ret = GNUNET_OK;
reserve.pub = rs->reserve_pub;
- qs = edb->reserves_get (edb->cls,
- esession,
- &reserve);
+ qs = TALER_ARL_edb->reserves_get (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ &reserve);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
char *diag;
@@ -1053,12 +1060,13 @@ verify_reserve_balance (void *cls,
TALER_amount_add (&total_balance_insufficient_loss,
&total_balance_insufficient_loss,
&loss));
- report (report_reserve_balance_insufficient_inconsistencies,
- json_pack ("{s:o, s:o}",
- "reserve_pub",
- GNUNET_JSON_from_data_auto (&rs->reserve_pub),
- "loss",
- TALER_JSON_from_amount (&loss)));
+ TALER_ARL_report (
+ report_reserve_balance_insufficient_inconsistencies,
+ json_pack ("{s:o, s:o}",
+ "reserve_pub",
+ GNUNET_JSON_from_data_auto (&rs->reserve_pub),
+ "loss",
+ TALER_JSON_from_amount (&loss)));
goto cleanup;
}
if (0 != TALER_amount_cmp (&nbalance,
@@ -1091,14 +1099,15 @@ verify_reserve_balance (void *cls,
&total_balance_summary_delta_minus,
&delta));
}
- report (report_reserve_balance_summary_wrong_inconsistencies,
- json_pack ("{s:o, s:o, s:o}",
- "reserve_pub",
- GNUNET_JSON_from_data_auto (&rs->reserve_pub),
- "exchange",
- TALER_JSON_from_amount (&reserve.balance),
- "auditor",
- TALER_JSON_from_amount (&nbalance)));
+ TALER_ARL_report (
+ report_reserve_balance_summary_wrong_inconsistencies,
+ json_pack ("{s:o, s:o, s:o}",
+ "reserve_pub",
+ GNUNET_JSON_from_data_auto (&rs->reserve_pub),
+ "exchange",
+ TALER_JSON_from_amount (&reserve.balance),
+ "auditor",
+ TALER_JSON_from_amount (&nbalance)));
goto cleanup;
}
@@ -1120,14 +1129,16 @@ verify_reserve_balance (void *cls,
TALER_amount_add (&total_balance_reserve_not_closed,
&total_balance_reserve_not_closed,
&nbalance));
- report (report_reserve_not_closed_inconsistencies,
- json_pack ("{s:o, s:o, s:o}",
- "reserve_pub",
- GNUNET_JSON_from_data_auto (&rs->reserve_pub),
- "balance",
- TALER_JSON_from_amount (&nbalance),
- "expiration_time",
- json_from_time_abs (rs->a_expiration_date)));
+ TALER_ARL_report (report_reserve_not_closed_inconsistencies,
+ json_pack ("{s:o, s:o, s:o}",
+ "reserve_pub",
+ GNUNET_JSON_from_data_auto (
+ &rs->reserve_pub),
+ "balance",
+ TALER_JSON_from_amount (&nbalance),
+ "expiration_time",
+ TALER_ARL_json_from_time_abs (
+ rs->a_expiration_date)));
}
}
else
@@ -1136,16 +1147,18 @@ verify_reserve_balance (void *cls,
TALER_amount_add (&total_balance_reserve_not_closed,
&total_balance_reserve_not_closed,
&nbalance));
- report (report_reserve_not_closed_inconsistencies,
- json_pack ("{s:o, s:o, s:o, s:s}",
- "reserve_pub",
- GNUNET_JSON_from_data_auto (&rs->reserve_pub),
- "balance",
- TALER_JSON_from_amount (&nbalance),
- "expiration_time",
- json_from_time_abs (rs->a_expiration_date),
- "diagnostic",
- "could not determine closing fee"));
+ TALER_ARL_report (report_reserve_not_closed_inconsistencies,
+ json_pack ("{s:o, s:o, s:o, s:s}",
+ "reserve_pub",
+ GNUNET_JSON_from_data_auto (
+ &rs->reserve_pub),
+ "balance",
+ TALER_JSON_from_amount (&nbalance),
+ "expiration_time",
+ TALER_ARL_json_from_time_abs (
+ rs->a_expiration_date),
+ "diagnostic",
+ "could not determine closing fee"));
}
}
@@ -1191,10 +1204,10 @@ verify_reserve_balance (void *cls,
"Final balance of reserve `%s' is %s, dropping it\n",
TALER_B2S (&rs->reserve_pub),
TALER_amount2s (&nbalance));
- qs = adb->del_reserve_info (adb->cls,
- asession,
- &rs->reserve_pub,
- &master_pub);
+ qs = TALER_ARL_adb->del_reserve_info (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &rs->reserve_pub,
+ &TALER_ARL_master_pub);
if (0 >= qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -1220,22 +1233,22 @@ verify_reserve_balance (void *cls,
TALER_amount2s (&nbalance));
if (rs->had_ri)
- qs = adb->update_reserve_info (adb->cls,
- asession,
- &rs->reserve_pub,
- &master_pub,
- &nbalance,
- &rs->a_withdraw_fee_balance,
- rs->a_expiration_date);
+ qs = TALER_ARL_adb->update_reserve_info (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &rs->reserve_pub,
+ &TALER_ARL_master_pub,
+ &nbalance,
+ &rs->a_withdraw_fee_balance,
+ rs->a_expiration_date);
else
- qs = adb->insert_reserve_info (adb->cls,
- asession,
- &rs->reserve_pub,
- &master_pub,
- &nbalance,
- &rs->a_withdraw_fee_balance,
- rs->a_expiration_date,
- rs->sender_account);
+ qs = TALER_ARL_adb->insert_reserve_info (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &rs->reserve_pub,
+ &TALER_ARL_master_pub,
+ &nbalance,
+ &rs->a_withdraw_fee_balance,
+ rs->a_expiration_date,
+ rs->sender_account);
if (0 >= qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -1270,10 +1283,10 @@ analyze_reserves (void *cls)
(void) cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Analyzing reserves\n");
- qsp = adb->get_auditor_progress_reserve (adb->cls,
- asession,
- &master_pub,
- &ppr);
+ qsp = TALER_ARL_adb->get_auditor_progress_reserve (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &ppr);
if (0 > qsp)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsp);
@@ -1296,11 +1309,11 @@ analyze_reserves (void *cls)
(unsigned long long) ppr.last_reserve_close_serial_id);
}
rc.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
- qsx = adb->get_reserve_summary (adb->cls,
- asession,
- &master_pub,
- &total_escrow_balance,
- &total_withdraw_fee_income);
+ qsx = TALER_ARL_adb->get_reserve_summary (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &total_escrow_balance,
+ &total_withdraw_fee_income);
if (qsx < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsx);
@@ -1311,42 +1324,46 @@ analyze_reserves (void *cls)
rc.revoked = GNUNET_CONTAINER_multihashmap_create (4,
GNUNET_NO);
- qs = edb->select_reserves_in_above_serial_id (edb->cls,
- esession,
- ppr.last_reserve_in_serial_id,
- &handle_reserve_in,
- &rc);
+ qs = TALER_ARL_edb->select_reserves_in_above_serial_id (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ ppr.
+ last_reserve_in_serial_id,
+ &handle_reserve_in,
+ &rc);
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs;
}
- qs = edb->select_withdrawals_above_serial_id (edb->cls,
- esession,
- ppr.last_reserve_out_serial_id,
- &handle_reserve_out,
- &rc);
+ qs = TALER_ARL_edb->select_withdrawals_above_serial_id (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ ppr.
+ last_reserve_out_serial_id,
+ &handle_reserve_out,
+ &rc);
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs;
}
- qs = edb->select_recoup_above_serial_id (edb->cls,
- esession,
- ppr.last_reserve_recoup_serial_id,
- &handle_recoup_by_reserve,
- &rc);
+ qs = TALER_ARL_edb->select_recoup_above_serial_id (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ ppr.
+ last_reserve_recoup_serial_id,
+ &handle_recoup_by_reserve,
+ &rc);
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs;
}
- qs = edb->select_reserve_closed_above_serial_id (edb->cls,
- esession,
- ppr.
- last_reserve_close_serial_id,
- &handle_reserve_closed,
- &rc);
+ qs = TALER_ARL_edb->select_reserve_closed_above_serial_id (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ ppr.
+ last_reserve_close_serial_id,
+ &
+ handle_reserve_closed,
+ &rc);
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -1366,19 +1383,19 @@ analyze_reserves (void *cls)
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qsx)
{
- qs = adb->insert_reserve_summary (adb->cls,
- asession,
- &master_pub,
- &total_escrow_balance,
- &total_withdraw_fee_income);
+ qs = TALER_ARL_adb->insert_reserve_summary (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &total_escrow_balance,
+ &total_withdraw_fee_income);
}
else
{
- qs = adb->update_reserve_summary (adb->cls,
- asession,
- &master_pub,
- &total_escrow_balance,
- &total_withdraw_fee_income);
+ qs = TALER_ARL_adb->update_reserve_summary (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &total_escrow_balance,
+ &total_withdraw_fee_income);
}
if (0 >= qs)
{
@@ -1386,15 +1403,15 @@ analyze_reserves (void *cls)
return qs;
}
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsp)
- qs = adb->update_auditor_progress_reserve (adb->cls,
- asession,
- &master_pub,
- &ppr);
+ qs = TALER_ARL_adb->update_auditor_progress_reserve (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &ppr);
else
- qs = adb->insert_auditor_progress_reserve (adb->cls,
- asession,
- &master_pub,
- &ppr);
+ qs = TALER_ARL_adb->insert_auditor_progress_reserve (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &ppr);
if (0 >= qs)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -1417,36 +1434,34 @@ analyze_reserves (void *cls)
*
* @param cls closure
* @param args remaining command-line arguments
- * @param cfgfile name of the configuration file used (for saving, can be NULL!)
+ * @param TALER_ARL_cfgfile name of the configuration file used (for saving, can be NULL!)
* @param c configuration
*/
static void
run (void *cls,
char *const *args,
- const char *cfgfile,
+ const char *TALER_ARL_cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
{
- json_t *report;
-
(void) cls;
(void) args;
- (void) cfgfile;
+ (void) TALER_ARL_cfgfile;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Launching auditor\n");
if (GNUNET_OK !=
- setup_globals (cfg))
+ TALER_ARL_init (TALER_ARL_cfg))
{
global_ret = 1;
return;
}
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_time (cfg,
- "exchangedb",
+ GNUNET_CONFIGURATION_get_value_time (TALER_ARL_cfg,
+ "exchangTALER_ARL_edb",
"IDLE_RESERVE_EXPIRATION_TIME",
&idle_reserve_expiration_time))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "exchangedb",
+ "exchangTALER_ARL_edb",
"IDLE_RESERVE_EXPIRATION_TIME");
global_ret = 1;
return;
@@ -1454,34 +1469,34 @@ run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting audit\n");
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_escrow_balance));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_irregular_recoups));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_withdraw_fee_income));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_balance_insufficient_loss));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_balance_summary_delta_plus));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_balance_summary_delta_minus));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_arithmetic_delta_plus));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_arithmetic_delta_minus));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_balance_reserve_not_closed));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_bad_sig_loss));
GNUNET_assert (NULL !=
(report_row_inconsistencies = json_array ()));
@@ -1489,104 +1504,122 @@ run (void *cls,
(denomination_key_validity_withdraw_inconsistencies =
json_array ()));
GNUNET_assert (NULL !=
- (report_reserve_balance_summary_wrong_inconsistencies =
- json_array ()));
+ (report_reserve_balance_summary_wrong_inconsistencies
+ =
+ json_array ()));
GNUNET_assert (NULL !=
- (report_reserve_balance_insufficient_inconsistencies =
- json_array ()));
+ (report_reserve_balance_insufficient_inconsistencies
+ =
+ json_array ()));
GNUNET_assert (NULL !=
- (report_reserve_not_closed_inconsistencies = json_array ()));
+ (report_reserve_not_closed_inconsistencies =
+ json_array ()));
GNUNET_assert (NULL !=
- (report_amount_arithmetic_inconsistencies = json_array ()));
+ (report_amount_arithmetic_inconsistencies =
+ json_array ()));
GNUNET_assert (NULL !=
(report_bad_sig_losses = json_array ()));
if (GNUNET_OK !=
- setup_sessions_and_run (&analyze_reserves,
- NULL))
+ TALER_ARL_setup_sessions_and_run (&analyze_reserves,
+ NULL))
{
global_ret = 1;
return;
}
- report = json_pack ("{s:o, s:o, s:o, s:o, s:o,"
- " s:o, s:o, s:o, s:o, s:o,"
- " s:o, s:o, s:o, s:o, s:o,"
- " s:o, s:o, s:o, s:o, s:I,"
- " s:I, s:I, s:I, s:I, s:I,"
- " s:I, s:I }",
- /* blocks #1 */
- "reserve_balance_insufficient_inconsistencies",
- report_reserve_balance_insufficient_inconsistencies,
- /* Tested in test-auditor.sh #3 */
- "total_loss_balance_insufficient",
- TALER_JSON_from_amount (&total_balance_insufficient_loss),
- /* Tested in test-auditor.sh #3 */
- "reserve_balance_summary_wrong_inconsistencies",
- report_reserve_balance_summary_wrong_inconsistencies,
- "total_balance_summary_delta_plus",
- TALER_JSON_from_amount (
- &total_balance_summary_delta_plus),
- "total_balance_summary_delta_minus",
- TALER_JSON_from_amount (
- &total_balance_summary_delta_minus),
- /* blocks #2 */
- "total_escrow_balance",
- TALER_JSON_from_amount (&total_escrow_balance),
- "total_withdraw_fee_income",
- TALER_JSON_from_amount (&total_withdraw_fee_income),
- /* Tested in test-auditor.sh #21 */
- "reserve_not_closed_inconsistencies",
- report_reserve_not_closed_inconsistencies,
- /* Tested in test-auditor.sh #21 */
- "total_balance_reserve_not_closed",
- TALER_JSON_from_amount (
- &total_balance_reserve_not_closed),
- /* Tested in test-auditor.sh #4/#5/#6/#7/#13 */
- "bad_sig_losses",
- report_bad_sig_losses,
- /* blocks #3 */
- /* Tested in test-auditor.sh #4/#5/#6/#7/#13 */
- "total_bad_sig_loss",
- TALER_JSON_from_amount (&total_bad_sig_loss),
- /* Tested in test-auditor.sh #14/#15 */
- "row_inconsistencies",
- report_row_inconsistencies,
- /* Tested in test-auditor.sh #23 */
- "denomination_key_validity_withdraw_inconsistencies",
- denomination_key_validity_withdraw_inconsistencies,
- "amount_arithmetic_inconsistencies",
- report_amount_arithmetic_inconsistencies,
- "total_arithmetic_delta_plus",
- TALER_JSON_from_amount (&total_arithmetic_delta_plus),
- /* blocks #4 */
- "total_arithmetic_delta_minus",
- TALER_JSON_from_amount (&total_arithmetic_delta_minus),
- "auditor_start_time",
- json_from_time_abs (start_time),
- "auditor_end_time",
- json_from_time_abs (GNUNET_TIME_absolute_get ()),
- "total_irregular_recoups",
- TALER_JSON_from_amount (&total_irregular_recoups),
- "start_ppr_reserve_in_serial_id",
- (json_int_t) ppr_start.last_reserve_in_serial_id,
- /* blocks #5 */
- "start_ppr_reserve_out_serial_id",
- (json_int_t) ppr_start.last_reserve_out_serial_id,
- "start_ppr_reserve_recoup_serial_id",
- (json_int_t) ppr_start.last_reserve_recoup_serial_id,
- "start_ppr_reserve_close_serial_id",
- (json_int_t) ppr_start.last_reserve_close_serial_id,
- "end_ppr_reserve_in_serial_id",
- (json_int_t) ppr.last_reserve_in_serial_id,
- "end_ppr_reserve_out_serial_id",
- (json_int_t) ppr.last_reserve_out_serial_id,
- /* blocks #6 */
- "end_ppr_reserve_recoup_serial_id",
- (json_int_t) ppr.last_reserve_recoup_serial_id,
- "end_ppr_reserve_close_serial_id",
- (json_int_t) ppr.last_reserve_close_serial_id
- );
- GNUNET_break (NULL != report);
- finish_report (report);
+ {
+ json_t *report;
+
+ report = json_pack ("{s:o, s:o, s:o, s:o, s:o,"
+ " s:o, s:o, s:o, s:o, s:o,"
+ " s:o, s:o, s:o, s:o, s:o,"
+ " s:o, s:o, s:o, s:o, s:I,"
+ " s:I, s:I, s:I, s:I, s:I,"
+ " s:I, s:I }",
+ /* blocks #1 */
+ "reserve_balance_insufficient_inconsistencies",
+ report_reserve_balance_insufficient_inconsistencies,
+ /* Tested in test-auditor.sh #3 */
+ "total_loss_balance_insufficient",
+ TALER_JSON_from_amount (
+ &total_balance_insufficient_loss),
+ /* Tested in test-auditor.sh #3 */
+ "reserve_balance_summary_wrong_inconsistencies",
+ report_reserve_balance_summary_wrong_inconsistencies,
+ "total_balance_summary_delta_plus",
+ TALER_JSON_from_amount (
+ &total_balance_summary_delta_plus),
+ "total_balance_summary_delta_minus",
+ TALER_JSON_from_amount (
+ &total_balance_summary_delta_minus),
+ /* blocks #2 */
+ "total_escrow_balance",
+ TALER_JSON_from_amount (&total_escrow_balance),
+ "total_withdraw_fee_income",
+ TALER_JSON_from_amount (
+ &total_withdraw_fee_income),
+ /* Tested in test-auditor.sh #21 */
+ "reserve_not_closed_inconsistencies",
+ report_reserve_not_closed_inconsistencies,
+ /* Tested in test-auditor.sh #21 */
+ "total_balance_reserve_not_closed",
+ TALER_JSON_from_amount (
+ &total_balance_reserve_not_closed),
+ /* Tested in test-auditor.sh #4/#5/#6/#7/#13 */
+ "bad_sig_losses",
+ report_bad_sig_losses,
+ /* blocks #3 */
+ /* Tested in test-auditor.sh #4/#5/#6/#7/#13 */
+ "total_bad_sig_loss",
+ TALER_JSON_from_amount (&total_bad_sig_loss),
+ /* Tested in test-auditor.sh #14/#15 */
+ "row_inconsistencies",
+ report_row_inconsistencies,
+ /* Tested in test-auditor.sh #23 */
+ "denomination_key_validity_withdraw_inconsistencies",
+ denomination_key_validity_withdraw_inconsistencies,
+ "amount_arithmetic_inconsistencies",
+ report_amount_arithmetic_inconsistencies,
+ "total_arithmetic_delta_plus",
+ TALER_JSON_from_amount (
+ &total_arithmetic_delta_plus),
+ /* blocks #4 */
+ "total_arithmetic_delta_minus",
+ TALER_JSON_from_amount (
+ &total_arithmetic_delta_minus),
+ "auditor_start_time",
+ TALER_ARL_json_from_time_abs (
+ start_time),
+ "auditor_end_time",
+ TALER_ARL_json_from_time_abs (
+ GNUNET_TIME_absolute_get ()),
+ "total_irregular_recoups",
+ TALER_JSON_from_amount (
+ &total_irregular_recoups),
+ "start_ppr_reserve_in_serial_id",
+ (json_int_t) ppr_start.last_reserve_in_serial_id,
+ /* blocks #5 */
+ "start_ppr_reserve_out_serial_id",
+ (json_int_t) ppr_start.
+ last_reserve_out_serial_id,
+ "start_ppr_reserve_recoup_serial_id",
+ (json_int_t) ppr_start.
+ last_reserve_recoup_serial_id,
+ "start_ppr_reserve_close_serial_id",
+ (json_int_t) ppr_start.
+ last_reserve_close_serial_id,
+ "end_ppr_reserve_in_serial_id",
+ (json_int_t) ppr.last_reserve_in_serial_id,
+ "end_ppr_reserve_out_serial_id",
+ (json_int_t) ppr.last_reserve_out_serial_id,
+ /* blocks #6 */
+ "end_ppr_reserve_recoup_serial_id",
+ (json_int_t) ppr.last_reserve_recoup_serial_id,
+ "end_ppr_reserve_close_serial_id",
+ (json_int_t) ppr.last_reserve_close_serial_id
+ );
+ GNUNET_break (NULL != report);
+ TALER_ARL_done (report);
+ }
}
@@ -1607,11 +1640,11 @@ main (int argc,
"exchange-key",
"KEY",
"public key of the exchange (Crockford base32 encoded)",
- &master_pub),
+ &TALER_ARL_master_pub),
GNUNET_GETOPT_option_flag ('r',
- "restart",
- "restart audit from the beginning (required on first run)",
- &restart),
+ "TALER_ARL_restart",
+ "TALER_ARL_restart audit from the beginning (required on first run)",
+ &TALER_ARL_restart),
GNUNET_GETOPT_option_timetravel ('T',
"timetravel"),
GNUNET_GETOPT_OPTION_END
diff --git a/src/auditor/taler-wire-auditor.c b/src/auditor/taler-helper-auditor-wire.c
index fb8e52f7b..bc982655e 100644
--- a/src/auditor/taler-wire-auditor.c
+++ b/src/auditor/taler-helper-auditor-wire.c
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file auditor/taler-wire-auditor.c
+ * @file auditor/taler-helper-auditor-wire.c
* @brief audits that wire transfers match those from an exchange database.
* @author Christian Grothoff
*
@@ -33,6 +33,8 @@
#include "taler_json_lib.h"
#include "taler_bank_service.h"
#include "taler_signatures.h"
+#include "report-lib.h"
+
/**
* How much time do we allow the aggregator to lag behind? If
@@ -165,31 +167,6 @@ static struct GNUNET_CONTAINER_MultiHashMap *reserve_closures;
static int global_ret;
/**
- * Command-line option "-r": restart audit from scratch
- */
-static int restart;
-
-/**
- * Time when we started the wire audit.
- */
-static struct GNUNET_TIME_Absolute start_time;
-
-/**
- * Handle to access the exchange's database.
- */
-static struct TALER_EXCHANGEDB_Plugin *edb;
-
-/**
- * Which currency are we doing the audit for?
- */
-static char *currency;
-
-/**
- * Our configuration.
- */
-static const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-/**
* Map with information about incoming wire transfers.
* Maps hashes of the wire offsets to `struct ReserveInInfo`s.
*/
@@ -203,26 +180,6 @@ static struct GNUNET_CONTAINER_MultiHashMap *in_map;
static struct GNUNET_CONTAINER_MultiHashMap *out_map;
/**
- * Our session with the #edb.
- */
-static struct TALER_EXCHANGEDB_Session *esession;
-
-/**
- * Handle to access the auditor's database.
- */
-static struct TALER_AUDITORDB_Plugin *adb;
-
-/**
- * Our session with the #adb.
- */
-static struct TALER_AUDITORDB_Session *asession;
-
-/**
- * Master public key of the exchange to audit.
- */
-static struct TALER_MasterPublicKeyP master_pub;
-
-/**
* Head of list of wire accounts we still need to look at.
*/
static struct WireAccount *wa_head;
@@ -343,7 +300,7 @@ static struct TALER_Amount total_closure_amount_lag;
static struct TALER_Amount total_wire_format_amount;
/**
- * Amount of zero in our currency.
+ * Amount of zero in our TALER_ARL_currency.
*/
static struct TALER_Amount zero;
@@ -389,7 +346,7 @@ struct ReserveInInfo
/**
* Entry in map with wire information we expect to obtain from the
- * #edb later.
+ * #TALER_ARL_edb later.
*/
struct ReserveOutInfo
{
@@ -408,20 +365,6 @@ struct ReserveOutInfo
/**
- * Convert absolute time to human-readable JSON string.
- *
- * @param at time to convert
- * @return human-readable string representing the time
- */
-static json_t *
-json_from_time_abs (struct GNUNET_TIME_Absolute at)
-{
- return json_string
- (GNUNET_STRINGS_absolute_time_to_string (at));
-}
-
-
-/**
* Free entry in #in_map.
*
* @param cls NULL
@@ -534,26 +477,31 @@ do_shutdown (void *cls)
"wire_out_amount_inconsistencies",
report_wire_out_inconsistencies,
"total_wire_out_delta_plus",
- TALER_JSON_from_amount (&total_bad_amount_out_plus),
+ TALER_JSON_from_amount (
+ &total_bad_amount_out_plus),
/* Tested in test-auditor.sh #11, #15, #19 */
"total_wire_out_delta_minus",
- TALER_JSON_from_amount (&total_bad_amount_out_minus),
+ TALER_JSON_from_amount (
+ &total_bad_amount_out_minus),
/* Tested in test-auditor.sh #2 */
"reserve_in_amount_inconsistencies",
report_reserve_in_inconsistencies,
/* Tested in test-auditor.sh #2 */
"total_wire_in_delta_plus",
- TALER_JSON_from_amount (&total_bad_amount_in_plus),
+ TALER_JSON_from_amount (
+ &total_bad_amount_in_plus),
/* block */
/* Tested in test-auditor.sh #3 */
"total_wire_in_delta_minus",
- TALER_JSON_from_amount (&total_bad_amount_in_minus),
+ TALER_JSON_from_amount (
+ &total_bad_amount_in_minus),
/* Tested in test-auditor.sh #9 */
"missattribution_in_inconsistencies",
report_missattribution_in_inconsistencies,
/* Tested in test-auditor.sh #9 */
"total_missattribution_in",
- TALER_JSON_from_amount (&total_missattribution_in),
+ TALER_JSON_from_amount (
+ &total_missattribution_in),
"row_inconsistencies",
report_row_inconsistencies,
/* Tested in test-auditor.sh #10/#17 */
@@ -562,7 +510,8 @@ do_shutdown (void *cls)
/* block */
/* Tested in test-auditor.sh #19 */
"total_wire_format_amount",
- TALER_JSON_from_amount (&total_wire_format_amount),
+ TALER_JSON_from_amount (
+ &total_wire_format_amount),
/* Tested in test-auditor.sh #19 */
"wire_format_inconsistencies",
report_wire_format_inconsistencies,
@@ -574,32 +523,34 @@ do_shutdown (void *cls)
report_lags,
/* Tested in test-auditor.sh #22 */
"total_closure_amount_lag",
- TALER_JSON_from_amount (&total_closure_amount_lag),
+ TALER_JSON_from_amount (
+ &total_closure_amount_lag),
/* blocks of 5 */
/* Tested in test-auditor.sh #22 */
"reserve_lag_details",
report_closure_lags,
"wire_auditor_start_time",
- json_from_time_abs (start_time),
+ TALER_ARL_json_from_time_abs (
+ start_time),
"wire_auditor_end_time",
- json_from_time_abs (GNUNET_TIME_absolute_get ()),
+ TALER_ARL_json_from_time_abs (
+ GNUNET_TIME_absolute_get ()),
"start_pp_reserve_close_uuid",
(json_int_t) start_pp.last_reserve_close_uuid,
"end_pp_reserve_close_uuid",
(json_int_t) pp.last_reserve_close_uuid,
/* blocks of 5 */
"start_pp_last_timestamp",
- json_from_time_abs (start_pp.last_timestamp),
+ TALER_ARL_json_from_time_abs (
+ start_pp.last_timestamp),
"end_pp_last_timestamp",
- json_from_time_abs (pp.last_timestamp),
+ TALER_ARL_json_from_time_abs (
+ pp.last_timestamp),
"account_progress",
report_account_progress
);
GNUNET_break (NULL != report);
- json_dumpf (report,
- stdout,
- JSON_INDENT (2));
- json_decref (report);
+ TALER_ARL_done (report);
report_wire_out_inconsistencies = NULL;
report_reserve_in_inconsistencies = NULL;
report_row_inconsistencies = NULL;
@@ -610,6 +561,10 @@ do_shutdown (void *cls)
report_account_progress = NULL;
report_wire_format_inconsistencies = NULL;
}
+ else
+ {
+ TALER_ARL_done (NULL);
+ }
if (NULL != reserve_closures)
{
GNUNET_CONTAINER_multihashmap_iterate (reserve_closures,
@@ -653,16 +608,6 @@ do_shutdown (void *cls)
GNUNET_free (wa->section_name);
GNUNET_free (wa);
}
- if (NULL != adb)
- {
- TALER_AUDITORDB_plugin_unload (adb);
- adb = NULL;
- }
- if (NULL != edb)
- {
- TALER_EXCHANGEDB_plugin_unload (edb);
- edb = NULL;
- }
}
@@ -670,23 +615,6 @@ do_shutdown (void *cls)
/**
- * Add @a object to the report @a array. Fail hard if this fails.
- *
- * @param array report array to append @a object to
- * @param object object to append, should be check that it is not NULL
- */
-static void
-report (json_t *array,
- json_t *object)
-{
- GNUNET_assert (NULL != object);
- GNUNET_assert (0 ==
- json_array_append_new (array,
- object));
-}
-
-
-/**
* Detect any entries in #reserve_closures that were not yet
* observed on the wire transfer side and update the progress
* point accordingly.
@@ -711,13 +639,14 @@ check_pending_rc (void *cls,
&rc->amount));
if ( (0 != rc->amount.value) ||
(0 != rc->amount.fraction) )
- report (report_closure_lags,
- json_pack ("{s:I, s:o, s:o, s:o, s:s}",
- "row", (json_int_t) rc->rowid,
- "amount", TALER_JSON_from_amount (&rc->amount),
- "deadline", json_from_time_abs (rc->execution_date),
- "wtid", GNUNET_JSON_from_data_auto (&rc->wtid),
- "account", rc->receiver_account));
+ TALER_ARL_report (report_closure_lags,
+ json_pack ("{s:I, s:o, s:o, s:o, s:s}",
+ "row", (json_int_t) rc->rowid,
+ "amount", TALER_JSON_from_amount (&rc->amount),
+ "deadline", TALER_ARL_json_from_time_abs (
+ rc->execution_date),
+ "wtid", GNUNET_JSON_from_data_auto (&rc->wtid),
+ "account", rc->receiver_account));
pp.last_reserve_close_uuid
= GNUNET_MIN (pp.last_reserve_close_uuid,
rc->rowid);
@@ -773,10 +702,10 @@ commit (enum GNUNET_DB_QueryStatus qs)
else
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Hard error, not recording progress\n");
- adb->rollback (adb->cls,
- asession);
- edb->rollback (edb->cls,
- esession);
+ TALER_ARL_adb->rollback (TALER_ARL_adb->cls,
+ TALER_ARL_asession);
+ TALER_ARL_edb->rollback (TALER_ARL_edb->cls,
+ TALER_ARL_esession);
return qs;
}
for (struct WireAccount *wa = wa_head;
@@ -804,21 +733,25 @@ commit (enum GNUNET_DB_QueryStatus qs)
))
);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == wa->qsx)
- qs = adb->update_wire_auditor_account_progress (adb->cls,
- asession,
- &master_pub,
- wa->section_name,
- &wa->pp,
- wa->in_wire_off,
- wa->out_wire_off);
+ qs = TALER_ARL_adb->update_wire_auditor_account_progress (
+ TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &
+ TALER_ARL_master_pub,
+ wa->section_name,
+ &wa->pp,
+ wa->in_wire_off,
+ wa->out_wire_off);
else
- qs = adb->insert_wire_auditor_account_progress (adb->cls,
- asession,
- &master_pub,
- wa->section_name,
- &wa->pp,
- wa->in_wire_off,
- wa->out_wire_off);
+ qs = TALER_ARL_adb->insert_wire_auditor_account_progress (
+ TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &
+ TALER_ARL_master_pub,
+ wa->section_name,
+ &wa->pp,
+ wa->in_wire_off,
+ wa->out_wire_off);
if (0 >= qs)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -831,15 +764,15 @@ commit (enum GNUNET_DB_QueryStatus qs)
&check_pending_rc,
NULL);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsx_gwap)
- qs = adb->update_wire_auditor_progress (adb->cls,
- asession,
- &master_pub,
- &pp);
+ qs = TALER_ARL_adb->update_wire_auditor_progress (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &pp);
else
- qs = adb->insert_wire_auditor_progress (adb->cls,
- asession,
- &master_pub,
- &pp);
+ qs = TALER_ARL_adb->insert_wire_auditor_progress (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &pp);
if (0 >= qs)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -853,20 +786,20 @@ commit (enum GNUNET_DB_QueryStatus qs)
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
{
- qs = edb->commit (edb->cls,
- esession);
+ qs = TALER_ARL_edb->commit (TALER_ARL_edb->cls,
+ TALER_ARL_esession);
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Exchange DB commit failed, rolling back transaction\n");
- adb->rollback (adb->cls,
- asession);
+ TALER_ARL_adb->rollback (TALER_ARL_adb->cls,
+ TALER_ARL_asession);
}
else
{
- qs = adb->commit (adb->cls,
- asession);
+ qs = TALER_ARL_adb->commit (TALER_ARL_adb->cls,
+ TALER_ARL_asession);
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -879,10 +812,10 @@ commit (enum GNUNET_DB_QueryStatus qs)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Processing failed, rolling back transaction\n");
- adb->rollback (adb->cls,
- asession);
- edb->rollback (edb->cls,
- esession);
+ TALER_ARL_adb->rollback (TALER_ARL_adb->cls,
+ TALER_ARL_asession);
+ TALER_ARL_edb->rollback (TALER_ARL_edb->cls,
+ TALER_ARL_esession);
}
return qs;
}
@@ -922,14 +855,16 @@ wire_missing_cb (void *cls,
(0 > TALER_amount_cmp (amount,
&tiny_amount)) )
return; /* acceptable, amount was tiny */
- 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", json_from_time_abs (deadline),
- "claimed_done", (done) ? "yes" : "no",
- "coin_pub", GNUNET_JSON_from_data_auto (coin_pub),
- "account", wire));
+ 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));
}
@@ -953,12 +888,12 @@ check_for_required_transfers ()
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Analyzing exchange's unfinished deposits (deadline: %s)\n",
GNUNET_STRINGS_absolute_time_to_string (next_timestamp));
- qs = edb->select_deposits_missing_wire (edb->cls,
- esession,
- pp.last_timestamp,
- next_timestamp,
- &wire_missing_cb,
- &next_timestamp);
+ qs = TALER_ARL_edb->select_deposits_missing_wire (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ pp.last_timestamp,
+ next_timestamp,
+ &wire_missing_cb,
+ &next_timestamp);
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -989,7 +924,7 @@ conclude_wire_out ()
/**
* Check that @a want is within #TIME_TOLERANCE of @a have.
- * Otherwise report an inconsistency in row @a rowid of @a table.
+ * Otherwise TALER_ARL_report an inconsistency in row @a rowid of @a table.
*
* @param table where is the inconsistency (if any)
* @param rowid what is the row
@@ -1018,11 +953,11 @@ check_time_difference (const char *table,
"execution date mismatch (%s)",
GNUNET_STRINGS_relative_time_to_string (delta,
GNUNET_YES));
- report (report_row_minor_inconsistencies,
- json_pack ("{s:s, s:I, s:s}",
- "table", table,
- "row", (json_int_t) rowid,
- "diagnostic", details));
+ TALER_ARL_report (report_row_minor_inconsistencies,
+ json_pack ("{s:s, s:I, s:s}",
+ "table", table,
+ "row", (json_int_t) rowid,
+ "diagnostic", details));
GNUNET_free (details);
}
@@ -1067,15 +1002,17 @@ 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. */
- report (report_wire_out_inconsistencies,
- json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}",
- "row", (json_int_t) rowid,
- "amount_wired", TALER_JSON_from_amount (&zero),
- "amount_justified", TALER_JSON_from_amount (amount),
- "wtid", GNUNET_JSON_from_data_auto (wtid),
- "timestamp", json_from_time_abs (date),
- "diagnostic", "wire transfer not made (yet?)",
- "account_section", wa->section_name));
+ TALER_ARL_report (report_wire_out_inconsistencies,
+ json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}",
+ "row", (json_int_t) rowid,
+ "amount_wired", TALER_JSON_from_amount (&zero),
+ "amount_justified", TALER_JSON_from_amount (
+ amount),
+ "wtid", GNUNET_JSON_from_data_auto (wtid),
+ "timestamp", TALER_ARL_json_from_time_abs (
+ date),
+ "diagnostic", "wire transfer not made (yet?)",
+ "account_section", wa->section_name));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_amount_out_minus,
&total_bad_amount_out_minus,
@@ -1092,29 +1029,34 @@ 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. */
- report (report_wire_out_inconsistencies,
- json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}",
- "row", (json_int_t) rowid,
- "amount_wired", TALER_JSON_from_amount (
- &roi->details.amount),
- "amount_justified", TALER_JSON_from_amount (&zero),
- "wtid", GNUNET_JSON_from_data_auto (wtid),
- "timestamp", json_from_time_abs (date),
- "diagnostic", "recevier account mismatch",
- "account_section", wa->section_name));
+ TALER_ARL_report (report_wire_out_inconsistencies,
+ json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}",
+ "row", (json_int_t) rowid,
+ "amount_wired", TALER_JSON_from_amount (
+ &roi->details.amount),
+ "amount_justified", TALER_JSON_from_amount (
+ &zero),
+ "wtid", GNUNET_JSON_from_data_auto (wtid),
+ "timestamp", TALER_ARL_json_from_time_abs (
+ date),
+ "diagnostic", "recevier account mismatch",
+ "account_section", wa->section_name));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_amount_out_plus,
&total_bad_amount_out_plus,
&roi->details.amount));
- report (report_wire_out_inconsistencies,
- json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}",
- "row", (json_int_t) rowid,
- "amount_wired", TALER_JSON_from_amount (&zero),
- "amount_justified", TALER_JSON_from_amount (amount),
- "wtid", GNUNET_JSON_from_data_auto (wtid),
- "timestamp", json_from_time_abs (date),
- "diagnostic", "receiver account mismatch",
- "account_section", wa->section_name));
+ TALER_ARL_report (report_wire_out_inconsistencies,
+ json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}",
+ "row", (json_int_t) rowid,
+ "amount_wired", TALER_JSON_from_amount (
+ &zero),
+ "amount_justified", TALER_JSON_from_amount (
+ amount),
+ "wtid", GNUNET_JSON_from_data_auto (wtid),
+ "timestamp", TALER_ARL_json_from_time_abs (
+ date),
+ "diagnostic", "receiver account mismatch",
+ "account_section", wa->section_name));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_amount_out_minus,
&total_bad_amount_out_minus,
@@ -1127,16 +1069,18 @@ wire_out_cb (void *cls,
if (0 != TALER_amount_cmp (&roi->details.amount,
amount))
{
- report (report_wire_out_inconsistencies,
- json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}",
- "row", (json_int_t) rowid,
- "amount_justified", TALER_JSON_from_amount (amount),
- "amount_wired", TALER_JSON_from_amount (
- &roi->details.amount),
- "wtid", GNUNET_JSON_from_data_auto (wtid),
- "timestamp", json_from_time_abs (date),
- "diagnostic", "wire amount does not match",
- "account_section", wa->section_name));
+ TALER_ARL_report (report_wire_out_inconsistencies,
+ json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}",
+ "row", (json_int_t) rowid,
+ "amount_justified", TALER_JSON_from_amount (
+ amount),
+ "amount_wired", TALER_JSON_from_amount (
+ &roi->details.amount),
+ "wtid", GNUNET_JSON_from_data_auto (wtid),
+ "timestamp", TALER_ARL_json_from_time_abs (
+ date),
+ "diagnostic", "wire amount does not match",
+ "account_section", wa->section_name));
if (0 < TALER_amount_cmp (amount,
&roi->details.amount))
{
@@ -1244,7 +1188,7 @@ check_rc_matches (void *cls,
*
* @param cls a `struct WireAccount`
* @param key unused key
- * @param value the `struct ReserveOutInfo` to report
+ * @param value the `struct ReserveOutInfo` to TALER_ARL_report
* @return #GNUNET_OK
*/
static int
@@ -1270,19 +1214,21 @@ complain_out_not_found (void *cls,
&ctx);
if (GNUNET_YES == ctx.found)
return GNUNET_OK;
- report (report_wire_out_inconsistencies,
- json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}",
- "row", (json_int_t) 0,
- "amount_wired", TALER_JSON_from_amount (
- &roi->details.amount),
- "amount_justified", TALER_JSON_from_amount (&zero),
- "wtid", GNUNET_JSON_from_data_auto (&roi->details.wtid),
- "timestamp", json_from_time_abs (
- roi->details.execution_date),
- "account_section",
- wa->section_name,
- "diagnostic",
- "justification for wire transfer not found"));
+ TALER_ARL_report (report_wire_out_inconsistencies,
+ json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}",
+ "row", (json_int_t) 0,
+ "amount_wired", TALER_JSON_from_amount (
+ &roi->details.amount),
+ "amount_justified", TALER_JSON_from_amount (
+ &zero),
+ "wtid", GNUNET_JSON_from_data_auto (
+ &roi->details.wtid),
+ "timestamp", TALER_ARL_json_from_time_abs (
+ roi->details.execution_date),
+ "account_section",
+ wa->section_name,
+ "diagnostic",
+ "justification for wire transfer not found"));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_amount_out_plus,
&total_bad_amount_out_plus,
@@ -1316,13 +1262,15 @@ check_exchange_wire_out (struct WireAccount *wa)
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Analyzing exchange's wire OUT table for account `%s'\n",
wa->section_name);
- qs = edb->select_wire_out_above_serial_id_by_account (edb->cls,
- esession,
- wa->section_name,
- wa->pp.
- last_wire_out_serial_id,
- &wire_out_cb,
- wa);
+ qs = TALER_ARL_edb->select_wire_out_above_serial_id_by_account (
+ TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ wa->
+ section_name,
+ wa->pp.
+ last_wire_out_serial_id,
+ &wire_out_cb,
+ wa);
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -1420,11 +1368,12 @@ history_debit_cb (void *cls,
TALER_amount_add (&total_wire_format_amount,
&total_wire_format_amount,
&details->amount));
- report (report_wire_format_inconsistencies,
- json_pack ("{s:o, s:I, s:s}",
- "amount", TALER_JSON_from_amount (&details->amount),
- "wire_offset", (json_int_t) row_off,
- "diagnostic", diagnostic));
+ TALER_ARL_report (report_wire_format_inconsistencies,
+ json_pack ("{s:o, s:I, s:s}",
+ "amount", TALER_JSON_from_amount (
+ &details->amount),
+ "wire_offset", (json_int_t) row_off,
+ "diagnostic", diagnostic));
GNUNET_free (diagnostic);
return GNUNET_OK;
}
@@ -1482,7 +1431,7 @@ process_debits (void *cls)
* Begin analyzing wire_out.
*/
static void
-begin_debit_audit ()
+begin_debit_audit (void)
{
out_map = GNUNET_CONTAINER_multihashmap_create (1024,
GNUNET_YES);
@@ -1561,13 +1510,14 @@ reserve_in_cb (void *cls,
rii,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
{
- report (report_row_inconsistencies,
- json_pack ("{s:s, s:I, s:o, s:s}",
- "table", "reserves_in",
- "row", (json_int_t) rowid,
- "wire_offset_hash", GNUNET_JSON_from_data_auto (
- &rii->row_off_hash),
- "diagnostic", "duplicate wire offset"));
+ TALER_ARL_report (report_row_inconsistencies,
+ json_pack ("{s:s, s:I, s:o, s:s}",
+ "table", "reserves_in",
+ "row", (json_int_t) rowid,
+ "wire_offset_hash",
+ GNUNET_JSON_from_data_auto (
+ &rii->row_off_hash),
+ "diagnostic", "duplicate wire offset"));
GNUNET_free (rii);
return GNUNET_OK;
}
@@ -1593,19 +1543,20 @@ complain_in_not_found (void *cls,
struct ReserveInInfo *rii = value;
(void) key;
- report (report_reserve_in_inconsistencies,
- json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}",
- "row", (json_int_t) rii->rowid,
- "amount_exchange_expected", TALER_JSON_from_amount (
- &rii->details.amount),
- "amount_wired", TALER_JSON_from_amount (&zero),
- "reserve_pub", GNUNET_JSON_from_data_auto (
- &rii->details.reserve_pub),
- "timestamp", json_from_time_abs (
- rii->details.execution_date),
- "account", wa->section_name,
- "diagnostic",
- "incoming wire transfer claimed by exchange not found"));
+ TALER_ARL_report (report_reserve_in_inconsistencies,
+ json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}",
+ "row", (json_int_t) rii->rowid,
+ "amount_exchange_expected",
+ TALER_JSON_from_amount (
+ &rii->details.amount),
+ "amount_wired", TALER_JSON_from_amount (&zero),
+ "reserve_pub", GNUNET_JSON_from_data_auto (
+ &rii->details.reserve_pub),
+ "timestamp", TALER_ARL_json_from_time_abs (
+ rii->details.execution_date),
+ "account", wa->section_name,
+ "diagnostic",
+ "incoming wire transfer claimed by exchange not found"));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_amount_in_minus,
&total_bad_amount_in_minus,
@@ -1706,35 +1657,37 @@ history_credit_cb (void *cls,
if (0 != GNUNET_memcmp (&details->reserve_pub,
&rii->details.reserve_pub))
{
- report (report_reserve_in_inconsistencies,
- json_pack ("{s:I, s:I, s:o, s:o, s:o, s:o, s:s}",
- "row", (json_int_t) rii->rowid,
- "bank_row", (json_int_t) row_off,
- "amount_exchange_expected", TALER_JSON_from_amount (
- &rii->details.amount),
- "amount_wired", TALER_JSON_from_amount (&zero),
- "reserve_pub", GNUNET_JSON_from_data_auto (
- &rii->details.reserve_pub),
- "timestamp", json_from_time_abs (
- rii->details.execution_date),
- "diagnostic", "wire subject does not match"));
+ TALER_ARL_report (report_reserve_in_inconsistencies,
+ json_pack ("{s:I, s:I, s:o, s:o, s:o, s:o, s:s}",
+ "row", (json_int_t) rii->rowid,
+ "bank_row", (json_int_t) row_off,
+ "amount_exchange_expected",
+ TALER_JSON_from_amount (
+ &rii->details.amount),
+ "amount_wired", TALER_JSON_from_amount (&zero),
+ "reserve_pub", GNUNET_JSON_from_data_auto (
+ &rii->details.reserve_pub),
+ "timestamp", TALER_ARL_json_from_time_abs (
+ rii->details.execution_date),
+ "diagnostic", "wire subject does not match"));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_amount_in_minus,
&total_bad_amount_in_minus,
&rii->details.amount));
- report (report_reserve_in_inconsistencies,
- json_pack ("{s:I, s:I, s:o, s:o, s:o, s:o, s:s}",
- "row", (json_int_t) rii->rowid,
- "bank_row", (json_int_t) row_off,
- "amount_exchange_expected", TALER_JSON_from_amount (
- &zero),
- "amount_wired", TALER_JSON_from_amount (
- &details->amount),
- "reserve_pub", GNUNET_JSON_from_data_auto (
- &details->reserve_pub),
- "timestamp", json_from_time_abs (
- details->execution_date),
- "diagnostic", "wire subject does not match"));
+ TALER_ARL_report (report_reserve_in_inconsistencies,
+ json_pack ("{s:I, s:I, s:o, s:o, s:o, s:o, s:s}",
+ "row", (json_int_t) rii->rowid,
+ "bank_row", (json_int_t) row_off,
+ "amount_exchange_expected",
+ TALER_JSON_from_amount (
+ &zero),
+ "amount_wired", TALER_JSON_from_amount (
+ &details->amount),
+ "reserve_pub", GNUNET_JSON_from_data_auto (
+ &details->reserve_pub),
+ "timestamp", TALER_ARL_json_from_time_abs (
+ details->execution_date),
+ "diagnostic", "wire subject does not match"));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_bad_amount_in_plus,
@@ -1745,19 +1698,20 @@ history_credit_cb (void *cls,
if (0 != TALER_amount_cmp (&rii->details.amount,
&details->amount))
{
- report (report_reserve_in_inconsistencies,
- json_pack ("{s:I, s:I, s:o, s:o, s:o, s:o, s:s}",
- "row", (json_int_t) rii->rowid,
- "bank_row", (json_int_t) row_off,
- "amount_exchange_expected", TALER_JSON_from_amount (
- &rii->details.amount),
- "amount_wired", TALER_JSON_from_amount (
- &details->amount),
- "reserve_pub", GNUNET_JSON_from_data_auto (
- &details->reserve_pub),
- "timestamp", json_from_time_abs (
- details->execution_date),
- "diagnostic", "wire amount does not match"));
+ TALER_ARL_report (report_reserve_in_inconsistencies,
+ json_pack ("{s:I, s:I, s:o, s:o, s:o, s:o, s:s}",
+ "row", (json_int_t) rii->rowid,
+ "bank_row", (json_int_t) row_off,
+ "amount_exchange_expected",
+ TALER_JSON_from_amount (
+ &rii->details.amount),
+ "amount_wired", TALER_JSON_from_amount (
+ &details->amount),
+ "reserve_pub", GNUNET_JSON_from_data_auto (
+ &details->reserve_pub),
+ "timestamp", TALER_ARL_json_from_time_abs (
+ details->execution_date),
+ "diagnostic", "wire amount does not match"));
if (0 < TALER_amount_cmp (&details->amount,
&rii->details.amount))
{
@@ -1792,13 +1746,14 @@ history_credit_cb (void *cls,
if (0 != strcasecmp (details->debit_account_url,
rii->details.debit_account_url))
{
- report (report_missattribution_in_inconsistencies,
- json_pack ("{s:o, s:I, s:I, s:o}",
- "amount", TALER_JSON_from_amount (&rii->details.amount),
- "row", (json_int_t) rii->rowid,
- "bank_row", (json_int_t) row_off,
- "reserve_pub", GNUNET_JSON_from_data_auto (
- &rii->details.reserve_pub)));
+ TALER_ARL_report (report_missattribution_in_inconsistencies,
+ json_pack ("{s:o, s:I, s:I, s:o}",
+ "amount", TALER_JSON_from_amount (
+ &rii->details.amount),
+ "row", (json_int_t) rii->rowid,
+ "bank_row", (json_int_t) row_off,
+ "reserve_pub", GNUNET_JSON_from_data_auto (
+ &rii->details.reserve_pub)));
GNUNET_break (GNUNET_OK ==
TALER_amount_add (&total_missattribution_in,
&total_missattribution_in,
@@ -1807,12 +1762,12 @@ history_credit_cb (void *cls,
if (details->execution_date.abs_value_us !=
rii->details.execution_date.abs_value_us)
{
- report (report_row_minor_inconsistencies,
- json_pack ("{s:s, s:I, s:I, s:s}",
- "table", "reserves_in",
- "row", (json_int_t) rii->rowid,
- "bank_row", (json_int_t) row_off,
- "diagnostic", "execution date mismatch"));
+ TALER_ARL_report (report_row_minor_inconsistencies,
+ json_pack ("{s:s, s:I, s:I, s:s}",
+ "table", "reserves_in",
+ "row", (json_int_t) rii->rowid,
+ "bank_row", (json_int_t) row_off,
+ "diagnostic", "execution date mismatch"));
}
cleanup:
GNUNET_assert (GNUNET_OK ==
@@ -1851,13 +1806,16 @@ process_credits (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Analyzing exchange's wire IN table for account `%s'\n",
wa->section_name);
- qs = edb->select_reserves_in_above_serial_id_by_account (edb->cls,
- esession,
- wa->section_name,
- wa->pp.
- last_reserve_in_serial_id,
- &reserve_in_cb,
- wa);
+ qs = TALER_ARL_edb->select_reserves_in_above_serial_id_by_account (
+ TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ wa->
+ section_name,
+ wa->pp.
+ last_reserve_in_serial_id,
+ &
+ reserve_in_cb,
+ wa);
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -1891,7 +1849,7 @@ process_credits (void *cls)
* Begin audit of CREDITs to the exchange.
*/
static void
-begin_credit_audit ()
+begin_credit_audit (void)
{
in_map = GNUNET_CONTAINER_multihashmap_create (1024,
GNUNET_YES);
@@ -1934,15 +1892,18 @@ reserve_closed_cb (void *cls,
amount_with_fee,
closing_fee))
{
- report (report_row_inconsistencies,
- json_pack ("{s:s, s:I, s:o, s:o, s:o, s:s}",
- "table", "reserves_closures",
- "row", (json_int_t) rowid,
- "reserve_pub", GNUNET_JSON_from_data_auto (reserve_pub),
- "amount_with_fee", TALER_JSON_from_amount (
- amount_with_fee),
- "closing_fee", TALER_JSON_from_amount (closing_fee),
- "diagnostic", "closing fee above total amount"));
+ TALER_ARL_report (report_row_inconsistencies,
+ json_pack ("{s:s, s:I, s:o, s:o, s:o, s:s}",
+ "table", "reserves_closures",
+ "row", (json_int_t) rowid,
+ "reserve_pub", GNUNET_JSON_from_data_auto (
+ reserve_pub),
+ "amount_with_fee", TALER_JSON_from_amount (
+ amount_with_fee),
+ "closing_fee", TALER_JSON_from_amount (
+ closing_fee),
+ "diagnostic",
+ "closing fee above total amount"));
GNUNET_free (rc);
return GNUNET_OK;
}
@@ -1966,63 +1927,62 @@ reserve_closed_cb (void *cls,
/**
* Start the database transactions and begin the audit.
+ *
+ * @param cls NULL
+ * @return transaction status code
*/
-static void
-begin_transaction ()
+static enum GNUNET_DB_QueryStatus
+begin_transaction (void *cls)
{
int ret;
- ret = adb->start (adb->cls,
- asession);
+ (void) cls;
+ ret = TALER_ARL_adb->start (TALER_ARL_adb->cls,
+ TALER_ARL_asession);
if (GNUNET_OK != ret)
{
GNUNET_break (0);
- global_ret = 1;
- GNUNET_SCHEDULER_shutdown ();
- return;
+ return GNUNET_DB_STATUS_HARD_ERROR;
}
- edb->preflight (edb->cls,
- esession);
- ret = edb->start (edb->cls,
- esession,
- "wire auditor");
+ TALER_ARL_edb->preflight (TALER_ARL_edb->cls,
+ TALER_ARL_esession);
+ ret = TALER_ARL_edb->start (TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ "wire auditor");
if (GNUNET_OK != ret)
{
GNUNET_break (0);
- global_ret = 1;
- GNUNET_SCHEDULER_shutdown ();
- return;
+ return GNUNET_DB_STATUS_HARD_ERROR;
}
for (struct WireAccount *wa = wa_head;
NULL != wa;
wa = wa->next)
{
- wa->qsx = adb->get_wire_auditor_account_progress (adb->cls,
- asession,
- &master_pub,
- wa->section_name,
- &wa->pp,
- &wa->in_wire_off,
- &wa->out_wire_off);
+ wa->qsx = TALER_ARL_adb->get_wire_auditor_account_progress (
+ TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &
+ TALER_ARL_master_pub,
+ wa->section_name,
+ &wa->pp,
+ &wa->in_wire_off,
+ &wa->
+ out_wire_off);
if (0 > wa->qsx)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == wa->qsx);
- global_ret = 1;
- GNUNET_SCHEDULER_shutdown ();
- return;
+ return GNUNET_DB_STATUS_HARD_ERROR;
}
wa->start_pp = wa->pp;
}
- qsx_gwap = adb->get_wire_auditor_progress (adb->cls,
- asession,
- &master_pub,
- &pp);
+ qsx_gwap = TALER_ARL_adb->get_wire_auditor_progress (TALER_ARL_adb->cls,
+ TALER_ARL_asession,
+ &TALER_ARL_master_pub,
+ &pp);
if (0 > qsx_gwap)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsx_gwap);
- global_ret = 1;
- GNUNET_SCHEDULER_shutdown ();
- return;
+ return GNUNET_DB_STATUS_HARD_ERROR;
}
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qsx_gwap)
{
@@ -2042,21 +2002,22 @@ begin_transaction ()
{
enum GNUNET_DB_QueryStatus qs;
- qs = edb->select_reserve_closed_above_serial_id (edb->cls,
- esession,
- pp.
- last_reserve_close_uuid,
- &reserve_closed_cb,
- NULL);
+ qs = TALER_ARL_edb->select_reserve_closed_above_serial_id (
+ TALER_ARL_edb->cls,
+ TALER_ARL_esession,
+ pp.
+ last_reserve_close_uuid,
+ &
+ reserve_closed_cb,
+ NULL);
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- global_ret = 1;
- GNUNET_SCHEDULER_shutdown ();
- return;
+ return GNUNET_DB_STATUS_HARD_ERROR;
}
}
begin_credit_audit ();
+ return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
}
@@ -2086,13 +2047,14 @@ process_account_cb (void *cls,
wa->watch_debit = ai->debit_enabled;
wa->watch_credit = ai->credit_enabled;
if (GNUNET_OK !=
- TALER_BANK_auth_parse_cfg (cfg,
+ TALER_BANK_auth_parse_cfg (TALER_ARL_cfg,
ai->section_name,
&wa->auth))
{
GNUNET_break (0);
GNUNET_free (wa->section_name);
GNUNET_free (wa);
+
fprintf (stderr,
"Failed to access bank account `%s'\n",
wa->section_name);
@@ -2111,26 +2073,28 @@ process_account_cb (void *cls,
*
* @param cls closure
* @param args remaining command-line arguments
- * @param cfgfile name of the configuration file used (for saving, can be NULL!)
+ * @param TALER_ARL_cfgfile name of the configuration file used (for saving, can be NULL!)
* @param c configuration
*/
static void
run (void *cls,
char *const *args,
- const char *cfgfile,
+ const char *TALER_ARL_cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
{
- static const struct TALER_MasterPublicKeyP zeromp;
-
(void) cls;
(void) args;
- (void) cfgfile;
+ (void) TALER_ARL_cfgfile;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Launching auditor\n");
- start_time = GNUNET_TIME_absolute_get ();
- cfg = c;
if (GNUNET_OK !=
- TALER_config_get_amount (cfg,
+ TALER_ARL_init (c))
+ {
+ global_ret = 1;
+ return;
+ }
+ if (GNUNET_OK !=
+ TALER_config_get_amount (TALER_ARL_cfg,
"auditor",
"TINY_AMOUNT",
&tiny_amount))
@@ -2142,85 +2106,6 @@ run (void *cls,
global_ret = 1;
return;
}
- if (0 == GNUNET_memcmp (&zeromp,
- &master_pub))
- {
- /* -m option not given, try configuration */
- char *master_public_key_str;
-
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (cfg,
- "exchange",
- "MASTER_PUBLIC_KEY",
- &master_public_key_str))
- {
- fprintf (stderr,
- "Pass option -m or set it in the configuration!\n");
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "exchange",
- "MASTER_PUBLIC_KEY");
- global_ret = 1;
- return;
- }
- if (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_public_key_from_string (master_public_key_str,
- strlen (
- master_public_key_str),
- &master_pub.eddsa_pub))
- {
- fprintf (stderr,
- "Invalid master public key given in configuration file.");
- GNUNET_free (master_public_key_str);
- global_ret = 1;
- return;
- }
- GNUNET_free (master_public_key_str);
- } /* end of -m not given */
-
- if (GNUNET_OK !=
- TALER_config_get_currency (cfg,
- &currency))
- {
- global_ret = 1;
- return;
- }
- if (NULL ==
- (edb = TALER_EXCHANGEDB_plugin_load (cfg)))
- {
- fprintf (stderr,
- "Failed to initialize exchange database plugin.\n");
- global_ret = 1;
- return;
- }
- if (NULL ==
- (adb = TALER_AUDITORDB_plugin_load (cfg)))
- {
- fprintf (stderr,
- "Failed to initialize auditor database plugin.\n");
- global_ret = 1;
- TALER_EXCHANGEDB_plugin_unload (edb);
- return;
- }
- if (restart)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Full audit restart requested, dropping old audit data.\n");
- GNUNET_break (GNUNET_OK ==
- adb->drop_tables (adb->cls,
- GNUNET_NO));
- TALER_AUDITORDB_plugin_unload (adb);
- if (NULL ==
- (adb = TALER_AUDITORDB_plugin_load (cfg)))
- {
- fprintf (stderr,
- "Failed to initialize auditor database plugin after drop.\n");
- global_ret = 1;
- TALER_EXCHANGEDB_plugin_unload (edb);
- return;
- }
- GNUNET_break (GNUNET_OK ==
- adb->create_tables (adb->cls));
- }
GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
NULL);
ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule,
@@ -2231,24 +2116,6 @@ run (void *cls,
GNUNET_break (0);
return;
}
- esession = edb->get_session (edb->cls);
- if (NULL == esession)
- {
- fprintf (stderr,
- "Failed to initialize exchange session.\n");
- global_ret = 1;
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
- asession = adb->get_session (adb->cls);
- if (NULL == asession)
- {
- fprintf (stderr,
- "Failed to initialize auditor session.\n");
- global_ret = 1;
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
reserve_closures = GNUNET_CONTAINER_multihashmap_create (1024,
GNUNET_NO);
GNUNET_assert (NULL !=
@@ -2258,11 +2125,13 @@ run (void *cls,
GNUNET_assert (NULL !=
(report_row_minor_inconsistencies = json_array ()));
GNUNET_assert (NULL !=
- (report_wire_format_inconsistencies = json_array ()));
+ (report_wire_format_inconsistencies =
+ json_array ()));
GNUNET_assert (NULL !=
(report_row_inconsistencies = json_array ()));
GNUNET_assert (NULL !=
- (report_missattribution_in_inconsistencies = json_array ()));
+ (report_missattribution_in_inconsistencies =
+ json_array ()));
GNUNET_assert (NULL !=
(report_lags = json_array ()));
GNUNET_assert (NULL !=
@@ -2270,36 +2139,42 @@ run (void *cls,
GNUNET_assert (NULL !=
(report_account_progress = json_array ()));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_bad_amount_out_plus));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_bad_amount_out_minus));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_bad_amount_in_plus));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_bad_amount_in_minus));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_missattribution_in));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_amount_lag));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_closure_amount_lag));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&total_wire_format_amount));
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
+ TALER_amount_get_zero (TALER_ARL_currency,
&zero));
- TALER_EXCHANGEDB_find_accounts (cfg,
+ TALER_EXCHANGEDB_find_accounts (TALER_ARL_cfg,
&process_account_cb,
NULL);
- begin_transaction ();
+ if (GNUNET_OK !=
+ TALER_ARL_setup_sessions_and_run (&begin_transaction,
+ NULL))
+ {
+ global_ret = 1;
+ GNUNET_SCHEDULER_shutdown ();
+ }
}
@@ -2320,11 +2195,11 @@ main (int argc,
"exchange-key",
"KEY",
"public key of the exchange (Crockford base32 encoded)",
- &master_pub),
+ &TALER_ARL_master_pub),
GNUNET_GETOPT_option_flag ('r',
- "restart",
- "restart audit from the beginning (required on first run)",
- &restart),
+ "TALER_ARL_restart",
+ "TALER_ARL_restart audit from the beginning (required on first run)",
+ &TALER_ARL_restart),
GNUNET_GETOPT_option_timetravel ('T',
"timetravel"),
GNUNET_GETOPT_OPTION_END
diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh
index 76d74d82c..236a11519 100755
--- a/src/auditor/test-auditor.sh
+++ b/src/auditor/test-auditor.sh
@@ -84,10 +84,10 @@ function audit_only () {
# Also do incremental run
$VALGRIND taler-auditor -L DEBUG -c $CONF -m $MASTER_PUB > test-audit-inc.json 2> test-audit-inc.log || exit_fail "auditor failed"
echo -n "."
- $VALGRIND taler-wire-auditor -L DEBUG -r -c $CONF -m $MASTER_PUB > test-wire-audit.json 2> test-wire-audit.log || exit_fail "wire auditor failed"
+ $VALGRIND taler-helper-auditor-wire -L DEBUG -r -c $CONF -m $MASTER_PUB > test-wire-audit.json 2> test-wire-audit.log || exit_fail "wire auditor failed"
# Also do incremental run
echo -n "."
- $VALGRIND taler-wire-auditor -L DEBUG -c $CONF -m $MASTER_PUB > test-wire-audit-inc.json 2> test-wire-audit-inc.log || exit_fail "wire auditor failed"
+ $VALGRIND taler-helper-auditor-wire -L DEBUG -c $CONF -m $MASTER_PUB > test-wire-audit-inc.json 2> test-wire-audit-inc.log || exit_fail "wire auditor failed"
echo " DONE"
}
@@ -255,7 +255,7 @@ echo -n "Check for lag detection... "
# NOTE: This test is EXPECTED to fail for ~1h after
# re-generating the test database as we do not
# report lag of less than 1h (see GRACE_PERIOD in
-# taler-wire-auditor.c)
+# taler-helper-auditor-wire.c)
if [ $DATABASE_AGE -gt 3600 ]
then
jq -e .lag_details[0] < test-wire-audit.json > /dev/null || exit_fail "Lag not detected in run without aggregator at age $DELTA"
@@ -893,7 +893,7 @@ echo "===========15: deposit wire hash wrong================="
# NOTE: This test is EXPECTED to fail for ~1h after
# re-generating the test database as we do not
# report lag of less than 1h (see GRACE_PERIOD in
-# taler-wire-auditor.c)
+# taler-helper-auditor-wire.c)
if [ $DATABASE_AGE -gt 3600 ]
then
@@ -930,7 +930,7 @@ echo "===========16: incorrect wire_out amount================="
# NOTE: This test is EXPECTED to fail for ~1h after
# re-generating the test database as we do not
# report lag of less than 1h (see GRACE_PERIOD in
-# taler-wire-auditor.c)
+# taler-helper-auditor-wire.c)
if [ $DATABASE_AGE -gt 3600 ]
then
@@ -1023,7 +1023,7 @@ echo "===========17: incorrect wire_out timestamp================="
# NOTE: This test is EXPECTED to fail for ~1h after
# re-generating the test database as we do not
# report lag of less than 1h (see GRACE_PERIOD in
-# taler-wire-auditor.c)
+# taler-helper-auditor-wire.c)
if [ $DATABASE_AGE -gt 3600 ]
then
@@ -1115,7 +1115,7 @@ echo "===========19: reserve closure done properly ================="
# NOTE: This test is EXPECTED to fail for ~1h after
# re-generating the test database as we do not
# report lag of less than 1h (see GRACE_PERIOD in
-# taler-wire-auditor.c)
+# taler-helper-auditor-wire.c)
if [ $DATABASE_AGE -gt 3600 ]
then
@@ -1193,7 +1193,7 @@ echo "===========21: reserve closure missreported ================="
# NOTE: This test is EXPECTED to fail for ~1h after
# re-generating the test database as we do not
# report lag of less than 1h (see GRACE_PERIOD in
-# taler-wire-auditor.c)
+# taler-helper-auditor-wire.c)
if [ $DATABASE_AGE -gt 3600 ]
then
@@ -1279,7 +1279,7 @@ echo "===========23: wire out calculations ================="
# NOTE: This test is EXPECTED to fail for ~1h after
# re-generating the test database as we do not
# report lag of less than 1h (see GRACE_PERIOD in
-# taler-wire-auditor.c)
+# taler-helper-auditor-wire.c)
if [ $DATABASE_AGE -gt 3600 ]
then
@@ -1400,7 +1400,7 @@ echo "=========25: inconsistent coin history========="
# NOTE: This test is EXPECTED to fail for ~1h after
# re-generating the test database as we do not
# report lag of less than 1h (see GRACE_PERIOD in
-# taler-wire-auditor.c)
+# taler-helper-auditor-wire.c)
if [ $DATABASE_AGE -gt 3600 ]
then
@@ -1493,7 +1493,7 @@ echo "===========27: duplicate WTID detection ================="
# NOTE: This test is EXPECTED to fail for ~1h after
# re-generating the test database as we do not
# report lag of less than 1h (see GRACE_PERIOD in
-# taler-wire-auditor.c)
+# taler-helper-auditor-wire.c)
if [ $DATABASE_AGE -gt 3600 ]
then