rename fest on refactored auditor logic
This commit is contained in:
parent
66616a97d7
commit
2ace9969b7
5
src/auditor/.gitignore
vendored
5
src/auditor/.gitignore
vendored
@ -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
|
||||
|
@ -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 = \
|
||||
|
@ -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,13 +108,13 @@ 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,
|
||||
TALER_ARL_report (json_t *array,
|
||||
json_t *object)
|
||||
{
|
||||
GNUNET_assert (NULL != object);
|
||||
@ -185,7 +185,7 @@ add_denomination (void *cls,
|
||||
* @return transaction status code
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
get_denomination_info_by_hash (const struct GNUNET_HashCode *dh,
|
||||
TALER_ARL_get_denomination_info_by_hash (const struct GNUNET_HashCode *dh,
|
||||
const struct
|
||||
TALER_DenominationKeyValidityPS **issue)
|
||||
{
|
||||
@ -196,9 +196,9 @@ 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,
|
||||
qs = TALER_ARL_adb->select_denomination_info (TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession,
|
||||
&TALER_ARL_master_pub,
|
||||
&add_denomination,
|
||||
NULL);
|
||||
if (0 > qs)
|
||||
@ -216,9 +216,9 @@ 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,
|
||||
qs = TALER_ARL_adb->select_denomination_info (TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession,
|
||||
&TALER_ARL_master_pub,
|
||||
&add_denomination,
|
||||
NULL);
|
||||
if (qs <= 0)
|
||||
@ -255,7 +255,8 @@ 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,
|
||||
TALER_ARL_get_denomination_info (const struct
|
||||
TALER_DenominationPublicKey *denom_pub,
|
||||
const struct
|
||||
TALER_DenominationKeyValidityPS **issue,
|
||||
struct GNUNET_HashCode *dh)
|
||||
@ -266,7 +267,7 @@ 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,
|
||||
return TALER_ARL_get_denomination_info_by_hash (dh,
|
||||
issue);
|
||||
}
|
||||
|
||||
@ -281,24 +282,24 @@ 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,
|
||||
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)
|
||||
{
|
||||
@ -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,
|
||||
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,
|
||||
GNUNET_CRYPTO_eddsa_public_key_from_string (
|
||||
TALER_ARL_master_public_key_str,
|
||||
strlen (
|
||||
master_public_key_str),
|
||||
&master_pub.eddsa_pub))
|
||||
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,
|
||||
¤cy))
|
||||
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",
|
||||
¤cy_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,31 +481,31 @@ 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,
|
||||
(void) TALER_ARL_adb->list_exchanges (TALER_ARL_adb->cls,
|
||||
as,
|
||||
&test_master_present,
|
||||
&found);
|
||||
@ -504,46 +513,54 @@ setup_globals (const struct GNUNET_CONFIGURATION_Handle *c)
|
||||
{
|
||||
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,
|
||||
TALER_ARL_adb->drop_tables (TALER_ARL_adb->cls,
|
||||
GNUNET_NO));
|
||||
TALER_AUDITORDB_plugin_unload (adb);
|
||||
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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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,17 +97,17 @@ 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,
|
||||
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,
|
||||
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
|
||||
|
@ -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,7 +160,7 @@ report_amount_arithmetic_inconsistency (const char *operation,
|
||||
auditor,
|
||||
exchange));
|
||||
}
|
||||
report (report_amount_arithmetic_inconsistencies,
|
||||
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,
|
||||
@ -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,10 +225,11 @@ report_coin_arithmetic_inconsistency (const char *operation,
|
||||
auditor,
|
||||
exchange));
|
||||
}
|
||||
report (report_coin_inconsistencies,
|
||||
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),
|
||||
"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));
|
||||
@ -252,7 +258,7 @@ report_row_inconsistency (const char *table,
|
||||
uint64_t rowid,
|
||||
const char *diagnostic)
|
||||
{
|
||||
report (report_row_inconsistencies,
|
||||
TALER_ARL_report (report_row_inconsistencies,
|
||||
json_pack ("{s:s, s:I, s:s}",
|
||||
"table", table,
|
||||
"row", (json_int_t) rowid,
|
||||
@ -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,8 +775,8 @@ wire_transfer_information_cb (
|
||||
}
|
||||
|
||||
/* Obtain coin's transaction history */
|
||||
qs = edb->get_coin_transactions (edb->cls,
|
||||
esession,
|
||||
qs = TALER_ARL_edb->get_coin_transactions (TALER_ARL_edb->cls,
|
||||
TALER_ARL_esession,
|
||||
coin_pub,
|
||||
GNUNET_YES,
|
||||
&tl);
|
||||
@ -776,8 +789,8 @@ wire_transfer_information_cb (
|
||||
"no transaction history for coin claimed in aggregation");
|
||||
return;
|
||||
}
|
||||
qs = edb->get_known_coin (edb->cls,
|
||||
esession,
|
||||
qs = TALER_ARL_edb->get_known_coin (TALER_ARL_edb->cls,
|
||||
TALER_ARL_esession,
|
||||
coin_pub,
|
||||
&coin);
|
||||
if (qs < 0)
|
||||
@ -790,12 +803,12 @@ wire_transfer_information_cb (
|
||||
return;
|
||||
}
|
||||
|
||||
qs = get_denomination_info_by_hash (&coin.denom_pub_hash,
|
||||
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,
|
||||
TALER_ARL_edb->free_coin_transaction_list (TALER_ARL_edb->cls,
|
||||
tl);
|
||||
if (0 == qs)
|
||||
report_row_inconsistency ("aggregation",
|
||||
@ -809,7 +822,7 @@ wire_transfer_information_cb (
|
||||
TALER_test_coin_valid (&coin,
|
||||
denom_pub))
|
||||
{
|
||||
report (report_bad_sig_losses,
|
||||
TALER_ARL_report (report_bad_sig_losses,
|
||||
json_pack ("{s:s, s:I, s:o, s:o}",
|
||||
"operation", "wire",
|
||||
"row", (json_int_t) rowid,
|
||||
@ -821,7 +834,7 @@ wire_transfer_information_cb (
|
||||
&total_bad_sig_loss,
|
||||
coin_value));
|
||||
GNUNET_CRYPTO_rsa_signature_free (coin.denom_sig.rsa_signature);
|
||||
edb->free_coin_transaction_list (edb->cls,
|
||||
TALER_ARL_edb->free_coin_transaction_list (TALER_ARL_edb->cls,
|
||||
tl);
|
||||
wcc->qs = GNUNET_DB_STATUS_HARD_ERROR;
|
||||
report_row_inconsistency ("deposit",
|
||||
@ -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,7 +872,8 @@ wire_transfer_information_cb (
|
||||
deposit_fee))
|
||||
{
|
||||
wcc->qs = GNUNET_DB_STATUS_HARD_ERROR;
|
||||
report_amount_arithmetic_inconsistency ("aggregation (fee structure)",
|
||||
report_amount_arithmetic_inconsistency (
|
||||
"aggregation (fee structure)",
|
||||
rowid,
|
||||
coin_value,
|
||||
deposit_fee,
|
||||
@ -873,13 +888,15 @@ 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)",
|
||||
report_amount_arithmetic_inconsistency (
|
||||
"aggregation (contribution)",
|
||||
rowid,
|
||||
&coin_value_without_fee,
|
||||
&total_deposit_without_refunds,
|
||||
&
|
||||
total_deposit_without_refunds,
|
||||
-1);
|
||||
}
|
||||
edb->free_coin_transaction_list (edb->cls,
|
||||
TALER_ARL_edb->free_coin_transaction_list (TALER_ARL_edb->cls,
|
||||
tl);
|
||||
|
||||
/* Check other details of wire transfer match */
|
||||
@ -949,8 +966,8 @@ 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,
|
||||
TALER_ARL_edb->get_wire_fee (TALER_ARL_edb->cls,
|
||||
TALER_ARL_esession,
|
||||
method,
|
||||
timestamp,
|
||||
&wfi->start_date,
|
||||
@ -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,
|
||||
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", json_from_time_abs (wfi->start_date)));
|
||||
"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,
|
||||
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", json_from_time_abs (wfi->end_date)));
|
||||
"diagnostic",
|
||||
"end date date after next start date",
|
||||
"time", TALER_ARL_json_from_time_abs (
|
||||
wfi->end_date)));
|
||||
}
|
||||
return &wfi->wire_fee;
|
||||
}
|
||||
@ -1089,8 +1110,8 @@ check_wire_out_cb (void *cls,
|
||||
GNUNET_free (method);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
qs = edb->lookup_wire_transfer (edb->cls,
|
||||
esession,
|
||||
qs = TALER_ARL_edb->lookup_wire_transfer (TALER_ARL_edb->cls,
|
||||
TALER_ARL_esession,
|
||||
wtid,
|
||||
&wire_transfer_information_cb,
|
||||
&wcc);
|
||||
@ -1133,7 +1154,8 @@ check_wire_out_cb (void *cls,
|
||||
&wcc.total_deposits,
|
||||
wire_fee))
|
||||
{
|
||||
report_amount_arithmetic_inconsistency ("wire out (fee structure)",
|
||||
report_amount_arithmetic_inconsistency (
|
||||
"wire out (fee structure)",
|
||||
rowid,
|
||||
&wcc.total_deposits,
|
||||
wire_fee,
|
||||
@ -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,
|
||||
¤cy_round_unit));
|
||||
&TALER_ARL_currency_round_unit));
|
||||
|
||||
/* Calculate the exchange's gain as the fees plus rounding differences! */
|
||||
if (GNUNET_SYSERR ==
|
||||
@ -1203,7 +1225,7 @@ check_wire_out_cb (void *cls,
|
||||
&delta));
|
||||
}
|
||||
|
||||
report (report_wire_out_inconsistencies,
|
||||
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,
|
||||
@ -1238,9 +1260,9 @@ 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,
|
||||
qsp = TALER_ARL_adb->get_auditor_progress_aggregation (TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession,
|
||||
&TALER_ARL_master_pub,
|
||||
&ppa);
|
||||
if (0 > qsp)
|
||||
{
|
||||
@ -1264,9 +1286,9 @@ analyze_aggregations (void *cls)
|
||||
memset (&ac,
|
||||
0,
|
||||
sizeof (ac));
|
||||
qsx = adb->get_wire_fee_summary (adb->cls,
|
||||
asession,
|
||||
&master_pub,
|
||||
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)
|
||||
{
|
||||
@ -1274,9 +1296,10 @@ analyze_aggregations (void *cls)
|
||||
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,
|
||||
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)
|
||||
@ -1302,29 +1325,33 @@ 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,
|
||||
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,
|
||||
qs = TALER_ARL_adb->insert_auditor_progress_aggregation (TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession,
|
||||
&
|
||||
TALER_ARL_master_pub,
|
||||
&ppa);
|
||||
if (0 >= qs)
|
||||
{
|
||||
@ -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,12 +1428,13 @@ 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,
|
||||
TALER_ARL_setup_sessions_and_run (&analyze_aggregations,
|
||||
NULL);
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||
"Audit complete\n");
|
||||
@ -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
|
@ -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,11 +185,12 @@ 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,
|
||||
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),
|
||||
@ -213,9 +199,11 @@ report_emergency_by_amount (const struct TALER_DenominationKeyValidityPS *issue,
|
||||
"denom_loss",
|
||||
TALER_JSON_from_amount (loss),
|
||||
"start",
|
||||
json_from_time_abs_nbo (issue->start),
|
||||
TALER_ARL_TALER_ARL_json_from_time_abs_nbo (
|
||||
issue->start),
|
||||
"deposit_end",
|
||||
json_from_time_abs_nbo (issue->expire_deposit),
|
||||
TALER_ARL_TALER_ARL_json_from_time_abs_nbo (
|
||||
issue->expire_deposit),
|
||||
"value",
|
||||
TALER_JSON_from_amount_nbo (&issue->value)));
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
@ -244,14 +232,15 @@ 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,
|
||||
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),
|
||||
@ -262,9 +251,11 @@ report_emergency_by_count (const struct TALER_DenominationKeyValidityPS *issue,
|
||||
"denom_risk",
|
||||
TALER_JSON_from_amount (risk),
|
||||
"start",
|
||||
json_from_time_abs_nbo (issue->start),
|
||||
TALER_ARL_TALER_ARL_json_from_time_abs_nbo (
|
||||
issue->start),
|
||||
"deposit_end",
|
||||
json_from_time_abs_nbo (issue->expire_deposit),
|
||||
TALER_ARL_TALER_ARL_json_from_time_abs_nbo (
|
||||
issue->expire_deposit),
|
||||
"value",
|
||||
TALER_JSON_from_amount_nbo (&issue->value)));
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
@ -275,7 +266,8 @@ 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,
|
||||
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,7 +317,7 @@ report_amount_arithmetic_inconsistency (const char *operation,
|
||||
auditor,
|
||||
exchange));
|
||||
}
|
||||
report (report_amount_arithmetic_inconsistencies,
|
||||
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,
|
||||
@ -355,7 +349,7 @@ report_row_inconsistency (const char *table,
|
||||
uint64_t rowid,
|
||||
const char *diagnostic)
|
||||
{
|
||||
report (report_row_inconsistencies,
|
||||
TALER_ARL_report (report_row_inconsistencies,
|
||||
json_pack ("{s:s, s:I, s:s}",
|
||||
"table", table,
|
||||
"row", (json_int_t) rowid,
|
||||
@ -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,8 +460,8 @@ init_denomination (const struct GNUNET_HashCode *denom_hash,
|
||||
struct TALER_MasterSignatureP msig;
|
||||
uint64_t rowid;
|
||||
|
||||
qs = adb->get_denomination_balance (adb->cls,
|
||||
asession,
|
||||
qs = TALER_ARL_adb->get_denomination_balance (TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession,
|
||||
denom_hash,
|
||||
&ds->denom_balance,
|
||||
&ds->denom_loss,
|
||||
@ -488,8 +482,8 @@ 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,
|
||||
qs = TALER_ARL_edb->get_denomination_revocation (TALER_ARL_edb->cls,
|
||||
TALER_ARL_esession,
|
||||
denom_hash,
|
||||
&msig,
|
||||
&rowid);
|
||||
@ -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,8 +607,8 @@ 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,
|
||||
qs = TALER_ARL_adb->del_denomination_balance (TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession,
|
||||
denom_hash);
|
||||
else
|
||||
qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
|
||||
@ -646,9 +640,11 @@ 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,
|
||||
(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,
|
||||
@ -669,8 +665,8 @@ 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,
|
||||
cnt = TALER_ARL_edb->count_known_coins (TALER_ARL_edb->cls,
|
||||
TALER_ARL_esession,
|
||||
denom_hash);
|
||||
if (0 > cnt)
|
||||
{
|
||||
@ -696,8 +692,8 @@ sync_denomination (void *cls,
|
||||
|
||||
}
|
||||
if (ds->in_db)
|
||||
qs = adb->update_denomination_balance (adb->cls,
|
||||
asession,
|
||||
qs = TALER_ARL_adb->update_denomination_balance (TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession,
|
||||
denom_hash,
|
||||
&ds->denom_balance,
|
||||
&ds->denom_loss,
|
||||
@ -705,8 +701,8 @@ sync_denomination (void *cls,
|
||||
&ds->denom_recoup,
|
||||
ds->num_issued);
|
||||
else
|
||||
qs = adb->insert_denomination_balance (adb->cls,
|
||||
asession,
|
||||
qs = TALER_ARL_adb->insert_denomination_balance (TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession,
|
||||
denom_hash,
|
||||
&ds->denom_balance,
|
||||
&ds->denom_loss,
|
||||
@ -774,7 +770,7 @@ 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,
|
||||
qs = TALER_ARL_get_denomination_info (denom_pub,
|
||||
&issue,
|
||||
&dh);
|
||||
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
|
||||
@ -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,8 +919,8 @@ 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,
|
||||
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)
|
||||
@ -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,
|
||||
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)));
|
||||
"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,7 +990,7 @@ 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,
|
||||
qs = TALER_ARL_get_denomination_info (denom_pub,
|
||||
&issue,
|
||||
NULL);
|
||||
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
|
||||
@ -1032,12 +1030,14 @@ refresh_session_cb (void *cls,
|
||||
&coin_sig->eddsa_signature,
|
||||
&coin_pub->eddsa_pub))
|
||||
{
|
||||
report (report_bad_sig_losses,
|
||||
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)));
|
||||
"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,8 +1061,8 @@ refresh_session_cb (void *cls,
|
||||
memset (&reveal_ctx,
|
||||
0,
|
||||
sizeof (reveal_ctx));
|
||||
qs = edb->get_refresh_reveal (edb->cls,
|
||||
esession,
|
||||
qs = TALER_ARL_edb->get_refresh_reveal (TALER_ARL_edb->cls,
|
||||
TALER_ARL_esession,
|
||||
rc,
|
||||
&reveal_data_cb,
|
||||
&reveal_ctx);
|
||||
@ -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,
|
||||
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)));
|
||||
"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,7 +1102,7 @@ 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],
|
||||
qs = TALER_ARL_get_denomination_info (&reveal_ctx.new_dps[i],
|
||||
&new_issues[i],
|
||||
NULL);
|
||||
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
|
||||
@ -1369,7 +1371,7 @@ 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,
|
||||
qs = TALER_ARL_get_denomination_info (denom_pub,
|
||||
&issue,
|
||||
NULL);
|
||||
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
|
||||
@ -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,
|
||||
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)));
|
||||
"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,
|
||||
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)));
|
||||
"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,7 +1566,7 @@ 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,
|
||||
qs = TALER_ARL_get_denomination_info (denom_pub,
|
||||
&issue,
|
||||
NULL);
|
||||
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
|
||||
@ -1592,12 +1598,14 @@ refund_cb (void *cls,
|
||||
&merchant_sig->eddsa_sig,
|
||||
&merchant_pub->eddsa_pub))
|
||||
{
|
||||
report (report_bad_sig_losses,
|
||||
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)));
|
||||
"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,7 +1731,7 @@ check_recoup (struct CoinContext *cc,
|
||||
TALER_test_coin_valid (coin,
|
||||
denom_pub))
|
||||
{
|
||||
report (report_bad_sig_losses,
|
||||
TALER_ARL_report (report_bad_sig_losses,
|
||||
json_pack ("{s:s, s:I, s:o, s:o}",
|
||||
"operation", "recoup",
|
||||
"row", (json_int_t) rowid,
|
||||
@ -1735,7 +1743,7 @@ check_recoup (struct CoinContext *cc,
|
||||
&total_bad_sig_loss,
|
||||
amount));
|
||||
}
|
||||
qs = get_denomination_info (denom_pub,
|
||||
qs = TALER_ARL_get_denomination_info (denom_pub,
|
||||
&issue,
|
||||
&pr.h_denom_pub);
|
||||
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
|
||||
@ -1763,7 +1771,7 @@ check_recoup (struct CoinContext *cc,
|
||||
&coin_sig->eddsa_signature,
|
||||
&coin->coin_pub.eddsa_pub))
|
||||
{
|
||||
report (report_bad_sig_losses,
|
||||
TALER_ARL_report (report_bad_sig_losses,
|
||||
json_pack ("{s:s, s:I, s:o, s:o}",
|
||||
"operation", "recoup",
|
||||
"row", (json_int_t) rowid,
|
||||
@ -1782,9 +1790,10 @@ check_recoup (struct CoinContext *cc,
|
||||
if (GNUNET_NO == ds->was_revoked)
|
||||
{
|
||||
/* Woopsie, we allowed recoup on non-revoked denomination!? */
|
||||
report (report_bad_sig_losses,
|
||||
TALER_ARL_report (report_bad_sig_losses,
|
||||
json_pack ("{s:s, s:I, s:o, s:o}",
|
||||
"operation", "recoup (denomination not revoked)",
|
||||
"operation",
|
||||
"recoup (denomination not revoked)",
|
||||
"row", (json_int_t) rowid,
|
||||
"loss", TALER_JSON_from_amount (amount),
|
||||
"coin_pub", GNUNET_JSON_from_data_auto (
|
||||
@ -1898,9 +1907,9 @@ 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,
|
||||
qsp = TALER_ARL_adb->get_auditor_progress_coin (TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession,
|
||||
&TALER_ARL_master_pub,
|
||||
&ppc);
|
||||
if (0 > qsp)
|
||||
{
|
||||
@ -1928,9 +1937,9 @@ 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,
|
||||
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,
|
||||
@ -1946,8 +1955,9 @@ analyze_coins (void *cls)
|
||||
|
||||
/* process withdrawals */
|
||||
if (0 >
|
||||
(qs = edb->select_withdrawals_above_serial_id (edb->cls,
|
||||
esession,
|
||||
(qs = TALER_ARL_edb->select_withdrawals_above_serial_id (
|
||||
TALER_ARL_edb->cls,
|
||||
TALER_ARL_esession,
|
||||
ppc.
|
||||
last_withdraw_serial_id,
|
||||
&withdraw_cb,
|
||||
@ -1961,9 +1971,10 @@ analyze_coins (void *cls)
|
||||
|
||||
/* process refunds */
|
||||
if (0 >
|
||||
(qs = edb->select_refunds_above_serial_id (edb->cls,
|
||||
esession,
|
||||
ppc.last_refund_serial_id,
|
||||
(qs = TALER_ARL_edb->select_refunds_above_serial_id (TALER_ARL_edb->cls,
|
||||
TALER_ARL_esession,
|
||||
ppc.
|
||||
last_refund_serial_id,
|
||||
&refund_cb,
|
||||
&cc)))
|
||||
{
|
||||
@ -1975,9 +1986,10 @@ analyze_coins (void *cls)
|
||||
|
||||
/* process refreshs */
|
||||
if (0 >
|
||||
(qs = edb->select_refreshes_above_serial_id (edb->cls,
|
||||
esession,
|
||||
ppc.last_melt_serial_id,
|
||||
(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)))
|
||||
{
|
||||
@ -1989,9 +2001,10 @@ analyze_coins (void *cls)
|
||||
|
||||
/* process deposits */
|
||||
if (0 >
|
||||
(qs = edb->select_deposits_above_serial_id (edb->cls,
|
||||
esession,
|
||||
ppc.last_deposit_serial_id,
|
||||
(qs = TALER_ARL_edb->select_deposits_above_serial_id (TALER_ARL_edb->cls,
|
||||
TALER_ARL_esession,
|
||||
ppc.
|
||||
last_deposit_serial_id,
|
||||
&deposit_cb,
|
||||
&cc)))
|
||||
{
|
||||
@ -2003,9 +2016,10 @@ analyze_coins (void *cls)
|
||||
|
||||
/* process recoups */
|
||||
if (0 >
|
||||
(qs = edb->select_recoup_above_serial_id (edb->cls,
|
||||
esession,
|
||||
ppc.last_recoup_serial_id,
|
||||
(qs = TALER_ARL_edb->select_recoup_above_serial_id (TALER_ARL_edb->cls,
|
||||
TALER_ARL_esession,
|
||||
ppc.
|
||||
last_recoup_serial_id,
|
||||
&recoup_cb,
|
||||
&cc)))
|
||||
{
|
||||
@ -2015,11 +2029,13 @@ analyze_coins (void *cls)
|
||||
if (0 > cc.qs)
|
||||
return cc.qs;
|
||||
if (0 >
|
||||
(qs = edb->select_recoup_refresh_above_serial_id (edb->cls,
|
||||
esession,
|
||||
(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,
|
||||
&
|
||||
recoup_refresh_cb,
|
||||
&cc)))
|
||||
{
|
||||
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||
@ -2040,9 +2056,9 @@ 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,
|
||||
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,
|
||||
@ -2051,9 +2067,9 @@ analyze_coins (void *cls)
|
||||
&total_recoup_loss,
|
||||
&total_irregular_recoups);
|
||||
else
|
||||
qs = adb->insert_balance_summary (adb->cls,
|
||||
asession,
|
||||
&master_pub,
|
||||
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,
|
||||
@ -2068,14 +2084,14 @@ analyze_coins (void *cls)
|
||||
}
|
||||
|
||||
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsp)
|
||||
qs = adb->update_auditor_progress_coin (adb->cls,
|
||||
asession,
|
||||
&master_pub,
|
||||
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,
|
||||
qs = TALER_ARL_adb->insert_auditor_progress_coin (TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession,
|
||||
&TALER_ARL_master_pub,
|
||||
&ppc);
|
||||
if (0 >= qs)
|
||||
{
|
||||
@ -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,13 +2195,14 @@ 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,
|
||||
TALER_ARL_setup_sessions_and_run (&analyze_coins,
|
||||
NULL))
|
||||
{
|
||||
global_ret = 1;
|
||||
@ -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
|
@ -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,8 +115,8 @@ test_dc (void *cls,
|
||||
dep.h_wire = dc->h_wire;
|
||||
dep.refund_deadline = dc->refund_deadline;
|
||||
|
||||
qs = edb->have_deposit (edb->cls,
|
||||
esession,
|
||||
qs = TALER_ARL_edb->have_deposit (TALER_ARL_edb->cls,
|
||||
TALER_ARL_esession,
|
||||
&dep,
|
||||
GNUNET_NO /* do not check refund deadline */);
|
||||
if (qs > 0)
|
||||
@ -132,11 +132,11 @@ test_dc (void *cls,
|
||||
dcc->qs = qs;
|
||||
return;
|
||||
}
|
||||
/* deposit confirmation missing! report! */
|
||||
report (report_deposit_confirmation_inconsistencies,
|
||||
/* deposit confirmation missing! TALER_ARL_report! */
|
||||
TALER_ARL_report (report_deposit_confirmation_inconsistencies,
|
||||
json_pack ("{s:o, s:o, s:I, s:o}",
|
||||
"timestamp",
|
||||
json_from_time_abs (dc->timestamp),
|
||||
TALER_ARL_json_from_time_abs (dc->timestamp),
|
||||
"amount",
|
||||
TALER_JSON_from_amount (&dc->amount_without_fee),
|
||||
"rowid",
|
||||
@ -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,9 +173,11 @@ 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,
|
||||
qsp = TALER_ARL_adb->get_auditor_progress_deposit_confirmation (
|
||||
TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession,
|
||||
&
|
||||
TALER_ARL_master_pub,
|
||||
&ppdc);
|
||||
if (0 > qsp)
|
||||
{
|
||||
@ -197,15 +199,16 @@ 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,
|
||||
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)
|
||||
@ -229,14 +232,18 @@ 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,
|
||||
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,
|
||||
qs = TALER_ARL_adb->insert_auditor_progress_deposit_confirmation (
|
||||
TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession,
|
||||
&
|
||||
TALER_ARL_master_pub,
|
||||
&ppdc);
|
||||
if (0 >= qs)
|
||||
{
|
||||
@ -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,7 +292,7 @@ run (void *cls,
|
||||
GNUNET_assert (NULL !=
|
||||
(report_deposit_confirmation_inconsistencies = json_array ()));
|
||||
if (GNUNET_OK !=
|
||||
setup_sessions_and_run (&analyze_deposit_confirmations,
|
||||
TALER_ARL_setup_sessions_and_run (&analyze_deposit_confirmations,
|
||||
NULL))
|
||||
{
|
||||
global_ret = 1;
|
||||
@ -295,6 +300,9 @@ run (void *cls,
|
||||
}
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||
"Audit complete\n");
|
||||
{
|
||||
json_t *report;
|
||||
|
||||
report = json_pack ("{s:o, s:o, s:I}",
|
||||
"deposit_confirmation_inconsistencies",
|
||||
report_deposit_confirmation_inconsistencies,
|
||||
@ -305,7 +313,8 @@ run (void *cls,
|
||||
&total_missed_deposit_confirmations)
|
||||
);
|
||||
GNUNET_break (NULL != report);
|
||||
finish_report (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
|
@ -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,7 +189,7 @@ report_amount_arithmetic_inconsistency (const char *operation,
|
||||
auditor,
|
||||
exchange));
|
||||
}
|
||||
report (report_amount_arithmetic_inconsistencies,
|
||||
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,
|
||||
@ -219,7 +221,7 @@ report_row_inconsistency (const char *table,
|
||||
uint64_t rowid,
|
||||
const char *diagnostic)
|
||||
{
|
||||
report (report_row_inconsistencies,
|
||||
TALER_ARL_report (report_row_inconsistencies,
|
||||
json_pack ("{s:s, s:I, s:s}",
|
||||
"table", table,
|
||||
"row", (json_int_t) rowid,
|
||||
@ -306,10 +308,10 @@ load_auditor_reserve_summary (struct ReserveSummary *rs)
|
||||
enum GNUNET_DB_QueryStatus qs;
|
||||
uint64_t rowid;
|
||||
|
||||
qs = adb->get_reserve_info (adb->cls,
|
||||
asession,
|
||||
qs = TALER_ARL_adb->get_reserve_info (TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession,
|
||||
&rs->reserve_pub,
|
||||
&master_pub,
|
||||
&TALER_ARL_master_pub,
|
||||
&rowid,
|
||||
&rs->a_balance,
|
||||
&rs->a_withdraw_fee_balance,
|
||||
@ -502,7 +504,7 @@ 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,
|
||||
qs = TALER_ARL_get_denomination_info (denom_pub,
|
||||
&issue,
|
||||
&wsrd.h_denomination_pub);
|
||||
if (0 > qs)
|
||||
@ -535,12 +537,13 @@ 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,
|
||||
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",
|
||||
json_from_time_abs (execution_date),
|
||||
"reserve_pub", GNUNET_JSON_from_data_auto (reserve_pub),
|
||||
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)));
|
||||
}
|
||||
@ -559,12 +562,14 @@ handle_reserve_out (void *cls,
|
||||
&reserve_sig->eddsa_signature,
|
||||
&reserve_pub->eddsa_pub))
|
||||
{
|
||||
report (report_bad_sig_losses,
|
||||
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)));
|
||||
"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,7 +687,7 @@ handle_recoup_by_reserve (void *cls,
|
||||
&coin_sig->eddsa_signature,
|
||||
&coin->coin_pub.eddsa_pub))
|
||||
{
|
||||
report (report_bad_sig_losses,
|
||||
TALER_ARL_report (report_bad_sig_losses,
|
||||
json_pack ("{s:s, s:I, s:o, s:o}",
|
||||
"operation", "recoup",
|
||||
"row", (json_int_t) rowid,
|
||||
@ -700,8 +705,8 @@ handle_recoup_by_reserve (void *cls,
|
||||
&pr.h_denom_pub);
|
||||
if (NULL == rev)
|
||||
{
|
||||
qs = edb->get_denomination_revocation (edb->cls,
|
||||
esession,
|
||||
qs = TALER_ARL_edb->get_denomination_revocation (TALER_ARL_edb->cls,
|
||||
TALER_ARL_esession,
|
||||
&pr.h_denom_pub,
|
||||
&msig,
|
||||
&rev_rowid);
|
||||
@ -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,
|
||||
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 (&master_pub)));
|
||||
"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,8 +849,8 @@ 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,
|
||||
TALER_ARL_edb->get_wire_fee (TALER_ARL_edb->cls,
|
||||
TALER_ARL_esession,
|
||||
method,
|
||||
atime,
|
||||
&start_date,
|
||||
@ -950,7 +956,8 @@ handle_reserve_closed (void *cls,
|
||||
else if (0 != TALER_amount_cmp (&expected_fee,
|
||||
closing_fee))
|
||||
{
|
||||
report_amount_arithmetic_inconsistency ("closing aggregation fee",
|
||||
report_amount_arithmetic_inconsistency (
|
||||
"closing aggregation fee",
|
||||
rowid,
|
||||
closing_fee,
|
||||
&expected_fee,
|
||||
@ -1006,8 +1013,8 @@ verify_reserve_balance (void *cls,
|
||||
|
||||
ret = GNUNET_OK;
|
||||
reserve.pub = rs->reserve_pub;
|
||||
qs = edb->reserves_get (edb->cls,
|
||||
esession,
|
||||
qs = TALER_ARL_edb->reserves_get (TALER_ARL_edb->cls,
|
||||
TALER_ARL_esession,
|
||||
&reserve);
|
||||
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
|
||||
{
|
||||
@ -1053,7 +1060,8 @@ verify_reserve_balance (void *cls,
|
||||
TALER_amount_add (&total_balance_insufficient_loss,
|
||||
&total_balance_insufficient_loss,
|
||||
&loss));
|
||||
report (report_reserve_balance_insufficient_inconsistencies,
|
||||
TALER_ARL_report (
|
||||
report_reserve_balance_insufficient_inconsistencies,
|
||||
json_pack ("{s:o, s:o}",
|
||||
"reserve_pub",
|
||||
GNUNET_JSON_from_data_auto (&rs->reserve_pub),
|
||||
@ -1091,7 +1099,8 @@ verify_reserve_balance (void *cls,
|
||||
&total_balance_summary_delta_minus,
|
||||
&delta));
|
||||
}
|
||||
report (report_reserve_balance_summary_wrong_inconsistencies,
|
||||
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),
|
||||
@ -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,
|
||||
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),
|
||||
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_json_from_time_abs (
|
||||
rs->a_expiration_date)));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1136,14 +1147,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,
|
||||
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),
|
||||
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_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,
|
||||
qs = TALER_ARL_adb->del_reserve_info (TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession,
|
||||
&rs->reserve_pub,
|
||||
&master_pub);
|
||||
&TALER_ARL_master_pub);
|
||||
if (0 >= qs)
|
||||
{
|
||||
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||
@ -1220,18 +1233,18 @@ verify_reserve_balance (void *cls,
|
||||
TALER_amount2s (&nbalance));
|
||||
|
||||
if (rs->had_ri)
|
||||
qs = adb->update_reserve_info (adb->cls,
|
||||
asession,
|
||||
qs = TALER_ARL_adb->update_reserve_info (TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession,
|
||||
&rs->reserve_pub,
|
||||
&master_pub,
|
||||
&TALER_ARL_master_pub,
|
||||
&nbalance,
|
||||
&rs->a_withdraw_fee_balance,
|
||||
rs->a_expiration_date);
|
||||
else
|
||||
qs = adb->insert_reserve_info (adb->cls,
|
||||
asession,
|
||||
qs = TALER_ARL_adb->insert_reserve_info (TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession,
|
||||
&rs->reserve_pub,
|
||||
&master_pub,
|
||||
&TALER_ARL_master_pub,
|
||||
&nbalance,
|
||||
&rs->a_withdraw_fee_balance,
|
||||
rs->a_expiration_date,
|
||||
@ -1270,9 +1283,9 @@ 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,
|
||||
qsp = TALER_ARL_adb->get_auditor_progress_reserve (TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession,
|
||||
&TALER_ARL_master_pub,
|
||||
&ppr);
|
||||
if (0 > qsp)
|
||||
{
|
||||
@ -1296,9 +1309,9 @@ 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,
|
||||
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)
|
||||
@ -1311,9 +1324,10 @@ 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,
|
||||
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)
|
||||
@ -1321,9 +1335,10 @@ analyze_reserves (void *cls)
|
||||
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,
|
||||
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)
|
||||
@ -1331,9 +1346,10 @@ analyze_reserves (void *cls)
|
||||
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,
|
||||
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)
|
||||
@ -1341,11 +1357,12 @@ analyze_reserves (void *cls)
|
||||
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||
return qs;
|
||||
}
|
||||
qs = edb->select_reserve_closed_above_serial_id (edb->cls,
|
||||
esession,
|
||||
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,
|
||||
&
|
||||
handle_reserve_closed,
|
||||
&rc);
|
||||
if (qs < 0)
|
||||
{
|
||||
@ -1366,17 +1383,17 @@ analyze_reserves (void *cls)
|
||||
|
||||
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qsx)
|
||||
{
|
||||
qs = adb->insert_reserve_summary (adb->cls,
|
||||
asession,
|
||||
&master_pub,
|
||||
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,
|
||||
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);
|
||||
}
|
||||
@ -1386,14 +1403,14 @@ 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,
|
||||
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,
|
||||
qs = TALER_ARL_adb->insert_auditor_progress_reserve (TALER_ARL_adb->cls,
|
||||
TALER_ARL_asession,
|
||||
&TALER_ARL_master_pub,
|
||||
&ppr);
|
||||
if (0 >= qs)
|
||||
{
|
||||
@ -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,24 +1504,31 @@ run (void *cls,
|
||||
(denomination_key_validity_withdraw_inconsistencies =
|
||||
json_array ()));
|
||||
GNUNET_assert (NULL !=
|
||||
(report_reserve_balance_summary_wrong_inconsistencies =
|
||||
(report_reserve_balance_summary_wrong_inconsistencies
|
||||
=
|
||||
json_array ()));
|
||||
GNUNET_assert (NULL !=
|
||||
(report_reserve_balance_insufficient_inconsistencies =
|
||||
(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,
|
||||
TALER_ARL_setup_sessions_and_run (&analyze_reserves,
|
||||
NULL))
|
||||
{
|
||||
global_ret = 1;
|
||||
return;
|
||||
}
|
||||
{
|
||||
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,"
|
||||
@ -1518,7 +1540,8 @@ run (void *cls,
|
||||
report_reserve_balance_insufficient_inconsistencies,
|
||||
/* Tested in test-auditor.sh #3 */
|
||||
"total_loss_balance_insufficient",
|
||||
TALER_JSON_from_amount (&total_balance_insufficient_loss),
|
||||
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,
|
||||
@ -1532,7 +1555,8 @@ run (void *cls,
|
||||
"total_escrow_balance",
|
||||
TALER_JSON_from_amount (&total_escrow_balance),
|
||||
"total_withdraw_fee_income",
|
||||
TALER_JSON_from_amount (&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,
|
||||
@ -1556,25 +1580,33 @@ 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),
|
||||
/* blocks #4 */
|
||||
"total_arithmetic_delta_minus",
|
||||
TALER_JSON_from_amount (&total_arithmetic_delta_minus),
|
||||
TALER_JSON_from_amount (
|
||||
&total_arithmetic_delta_minus),
|
||||
"auditor_start_time",
|
||||
json_from_time_abs (start_time),
|
||||
TALER_ARL_json_from_time_abs (
|
||||
start_time),
|
||||
"auditor_end_time",
|
||||
json_from_time_abs (GNUNET_TIME_absolute_get ()),
|
||||
TALER_ARL_json_from_time_abs (
|
||||
GNUNET_TIME_absolute_get ()),
|
||||
"total_irregular_recoups",
|
||||
TALER_JSON_from_amount (&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,
|
||||
(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,
|
||||
(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,
|
||||
(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",
|
||||
@ -1586,7 +1618,8 @@ run (void *cls,
|
||||
(json_int_t) ppr.last_reserve_close_serial_id
|
||||
);
|
||||
GNUNET_break (NULL != report);
|
||||
finish_report (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
|
File diff suppressed because it is too large
Load Diff
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user