[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: get finally rid of TALER_ARL_rep
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: get finally rid of TALER_ARL_report |
Date: |
Mon, 19 Aug 2024 19:19:48 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new f84481fdf get finally rid of TALER_ARL_report
f84481fdf is described below
commit f84481fdfef65fd31dd6ab7323ae6cbdee413517
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Aug 19 19:19:34 2024 +0200
get finally rid of TALER_ARL_report
---
src/auditor/report-lib.c | 11 -
src/auditor/report-lib.h | 11 -
src/auditor/taler-helper-auditor-aggregation.c | 233 ++++------
src/auditor/taler-helper-auditor-coins.c | 384 +++++-----------
src/auditor/taler-helper-auditor-deposits.c | 13 -
src/auditor/taler-helper-auditor-purses.c | 177 +++-----
src/auditor/taler-helper-auditor-reserves.c | 372 ++++++----------
src/auditor/taler-helper-auditor-wire-credit.c | 99 -----
src/auditor/taler-helper-auditor-wire-debit.c | 591 ++++++++-----------------
src/include/taler_auditordb_plugin.h | 1 +
10 files changed, 577 insertions(+), 1315 deletions(-)
diff --git a/src/auditor/report-lib.c b/src/auditor/report-lib.c
index f5aa05230..83846a73f 100644
--- a/src/auditor/report-lib.c
+++ b/src/auditor/report-lib.c
@@ -101,17 +101,6 @@ TALER_ARL_do_abort (void)
}
-void
-TALER_ARL_report (json_t *array,
- json_t *object)
-{
- GNUNET_assert (NULL != object);
- GNUNET_assert (0 ==
- json_array_append_new (array,
- object));
-}
-
-
/**
* Function called with the results of iterate_denomination_info(),
* or directly (!). Used to check and add the respective denomination
diff --git a/src/auditor/report-lib.h b/src/auditor/report-lib.h
index 44e6f15c2..dc31ec552 100644
--- a/src/auditor/report-lib.h
+++ b/src/auditor/report-lib.h
@@ -131,17 +131,6 @@ extern char *TALER_ARL_exchange_url;
extern struct GNUNET_TIME_Absolute start_time;
-/**
- * Add @a object to the report @a array. Fail hard if this fails.
- *
- * @param array report array to append @a object to
- * @param object object to append, should be check that it is not NULL
- */
-void
-TALER_ARL_report (json_t *array,
- json_t *object);
-
-
/**
* Obtain information about a @a denom_pub.
*
diff --git a/src/auditor/taler-helper-auditor-aggregation.c
b/src/auditor/taler-helper-auditor-aggregation.c
index 316dc36cd..8f62bbea4 100644
--- a/src/auditor/taler-helper-auditor-aggregation.c
+++ b/src/auditor/taler-helper-auditor-aggregation.c
@@ -159,8 +159,6 @@ report_amount_arithmetic_inconsistency (
{
struct TALER_Amount delta;
struct TALER_Amount *target;
- enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_AmountArithmeticInconsistency aai;
if (0 < TALER_amount_cmp (exchange,
auditor))
@@ -178,33 +176,26 @@ report_amount_arithmetic_inconsistency (
auditor,
exchange);
}
- aai.profitable = profitable;
- aai.operation = (char *) operation;
- aai.exchange_amount = *exchange;
- aai.auditor_amount = *auditor;
-
- qs = TALER_ARL_adb->insert_amount_arithmetic_inconsistency (
- TALER_ARL_adb->cls,
- &aai);
- if (qs < 0)
{
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- }
+ enum GNUNET_DB_QueryStatus qs;
+ struct TALER_AUDITORDB_AmountArithmeticInconsistency aai = {
+ .profitable = profitable,
+ .operation = (char *) operation,
+ .exchange_amount = *exchange,
+ .auditor_amount = *auditor
+ };
+ qs = TALER_ARL_adb->insert_amount_arithmetic_inconsistency (
+ TALER_ARL_adb->cls,
+ &aai);
- TALER_ARL_report (report_amount_arithmetic_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- operation),
- GNUNET_JSON_pack_uint64 ("rowid",
- rowid),
- TALER_JSON_pack_amount ("exchange",
- exchange),
- TALER_JSON_pack_amount ("auditor",
- auditor),
- GNUNET_JSON_pack_int64 ("profitable",
- profitable)));
+ if (qs < 0)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
+ }
+ }
if (0 != profitable)
{
target = (1 == profitable)
@@ -240,8 +231,6 @@ report_coin_arithmetic_inconsistency (
{
struct TALER_Amount delta;
struct TALER_Amount *target;
- enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_CoinInconsistency ci;
if (0 < TALER_amount_cmp (exchange,
auditor))
@@ -260,33 +249,26 @@ report_coin_arithmetic_inconsistency (
exchange);
}
- ci.operation = (char *) operation;
- ci.auditor_amount = *auditor;
- ci.exchange_amount = *exchange;
- ci.profitable = profitable;
- ci.coin_pub = coin_pub->eddsa_pub;
+ {
+ enum GNUNET_DB_QueryStatus qs;
+ struct TALER_AUDITORDB_CoinInconsistency ci = {
+ .operation = (char *) operation,
+ .auditor_amount = *auditor,
+ .exchange_amount = *exchange,
+ .profitable = profitable,
+ .coin_pub = coin_pub->eddsa_pub
+ };
- qs = TALER_ARL_adb->insert_coin_inconsistency (
- TALER_ARL_adb->cls,
- &ci);
+ qs = TALER_ARL_adb->insert_coin_inconsistency (
+ TALER_ARL_adb->cls,
+ &ci);
- if (qs < 0)
- {
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ if (qs < 0)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
+ }
}
-
- TALER_ARL_report (report_coin_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- operation),
- GNUNET_JSON_pack_data_auto ("coin_pub",
- coin_pub),
- TALER_JSON_pack_amount ("exchange",
- exchange),
- TALER_JSON_pack_amount ("auditor",
- auditor),
- GNUNET_JSON_pack_int64 ("profitable",
- profitable)));
if (0 != profitable)
{
target = (1 == profitable)
@@ -312,11 +294,11 @@ report_row_inconsistency (const char *table,
const char *diagnostic)
{
enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_RowInconsistency ri;
-
- ri.diagnostic = (char *) diagnostic;
- ri.row_table = (char *) table;
- ri.row_id = rowid;
+ struct TALER_AUDITORDB_RowInconsistency ri = {
+ .diagnostic = (char *) diagnostic,
+ .row_table = (char *) table,
+ .row_id = rowid
+ };
qs = TALER_ARL_adb->insert_row_inconsistency (
TALER_ARL_adb->cls,
@@ -325,16 +307,8 @@ report_row_inconsistency (const char *table,
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
}
-
- TALER_ARL_report (report_row_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("table",
- table),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- GNUNET_JSON_pack_string ("diagnostic",
- diagnostic)));
}
@@ -467,7 +441,6 @@ check_transaction_history_for_deposit (
struct TALER_Amount merchant_loss;
const struct TALER_Amount *deposit_fee;
enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_RowInconsistency ri;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Checking transaction history of coin %s\n",
@@ -502,11 +475,12 @@ check_transaction_history_for_deposit (
/* check wire and h_wire are consistent */
if (NULL != deposited)
{
- ri.row_id = tl->serial_id;
- char *diagnostic =
- "multiple deposits of the same coin into the same contract detected";
- ri.diagnostic = diagnostic;
- ri.row_table = "deposits";
+ struct TALER_AUDITORDB_RowInconsistency ri = {
+ .row_id = tl->serial_id,
+ .diagnostic =
+ "multiple deposits of the same coin into the same contract
detected",
+ .row_table = "deposits"
+ };
qs = TALER_ARL_adb->insert_row_inconsistency (
TALER_ARL_adb->cls,
@@ -515,16 +489,8 @@ check_transaction_history_for_deposit (
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
}
-
- TALER_ARL_report (report_row_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("table",
- "deposits"),
- GNUNET_JSON_pack_uint64 ("row",
- tl->serial_id),
- GNUNET_JSON_pack_string ("diagnostic",
- diagnostic)));
}
deposited = &tl->details.deposit->amount_with_fee; /* according to
exchange*/
fee_claimed = &tl->details.deposit->deposit_fee; /* Fee according
to exchange DB */
@@ -850,7 +816,6 @@ wire_transfer_information_cb (
enum GNUNET_DB_QueryStatus qs;
struct TALER_PaytoHashP hpt;
uint64_t etag_out;
- struct TALER_AUDITORDB_BadSigLosses bsl;
TALER_payto_hash (account_pay_uri,
&hpt);
@@ -925,30 +890,21 @@ wire_transfer_information_cb (
TALER_test_coin_valid (&coin,
denom_pub))
{
- bsl.row_id = rowid;
- bsl.operation = "wire";
- bsl.loss = *coin_value;
- bsl.operation_specific_pub = coin.coin_pub.eddsa_pub;
+ struct TALER_AUDITORDB_BadSigLosses bsl = {
+ .row_id = rowid,
+ .operation = "wire",
+ .loss = *coin_value,
+ .operation_specific_pub = coin.coin_pub.eddsa_pub
+ };
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
&bsl);
-
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- "wire"),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("loss",
- coin_value),
- GNUNET_JSON_pack_data_auto ("coin_pub",
- &coin.coin_pub)));
TALER_ARL_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
coin_value);
@@ -1136,12 +1092,11 @@ get_wire_fee (struct AggregationContext *ac,
>,
wfi->start_date))
{
- struct TALER_AUDITORDB_FeeTimeInconsistency ftib;
- char *diagnosticb = "start date before previous end date";
- ftib.diagnostic = diagnosticb;
- ftib.time = wfi->start_date.abs_time;
- ftib.type = (char *) method;
-
+ struct TALER_AUDITORDB_FeeTimeInconsistency ftib = {
+ .diagnostic = "start date before previous end date",
+ .time = wfi->start_date.abs_time,
+ .type = (char *) method
+ };
qs = TALER_ARL_adb->insert_fee_time_inconsistency (
TALER_ARL_adb->cls,
@@ -1150,28 +1105,19 @@ get_wire_fee (struct AggregationContext *ac,
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
}
-
- TALER_ARL_report (report_fee_time_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("type",
- method),
- GNUNET_JSON_pack_string ("diagnostic",
- diagnosticb),
- TALER_JSON_pack_time_abs_human ("time",
-
wfi->start_date.abs_time
- )));
}
if ((NULL != wfi->next) &&
GNUNET_TIME_timestamp_cmp (wfi->next->start_date,
>=,
wfi->end_date))
{
- struct TALER_AUDITORDB_FeeTimeInconsistency ftia;
- char *diagnostica = "end date date after next start date";
- ftia.diagnostic = diagnostica;
- ftia.time = wfi->end_date.abs_time;
- ftia.type = (char *) method;
+ struct TALER_AUDITORDB_FeeTimeInconsistency ftia = {
+ .diagnostic = "end date date after next start date",
+ .time = wfi->end_date.abs_time,
+ .type = (char *) method
+ };
qs = TALER_ARL_adb->insert_fee_time_inconsistency (
TALER_ARL_adb->cls,
@@ -1180,17 +1126,8 @@ get_wire_fee (struct AggregationContext *ac,
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
}
-
- TALER_ARL_report (report_fee_time_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("type",
- method),
- GNUNET_JSON_pack_string ("diagnostic",
- diagnostica),
- TALER_JSON_pack_time_abs_human ("time",
-
wfi->end_date.abs_time))
- );
}
return &wfi->fees.wire;
}
@@ -1222,7 +1159,6 @@ check_wire_out_cb (void *cls,
struct TALER_Amount exchange_gain;
enum GNUNET_DB_QueryStatus qs;
char *method;
- struct TALER_AUDITORDB_WireOutInconsistency woi;
/* should be monotonically increasing */
GNUNET_assert (rowid >=
@@ -1346,32 +1282,25 @@ check_wire_out_cb (void *cls,
&total_wire_out_delta_minus,
&delta);
}
- woi.row_id = rowid;
- woi.destination_account = (char *) payto_uri;
- woi.expected = final_amount;
- woi.claimed = *amount;
-
- qs = TALER_ARL_adb->insert_wire_out_inconsistency (
- TALER_ARL_adb->cls,
- &woi);
- if (qs < 0)
{
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ struct TALER_AUDITORDB_WireOutInconsistency woi = {
+ .row_id = rowid,
+ .destination_account = (char *) payto_uri,
+ .expected = final_amount,
+ .claimed = *amount
+ };
+
+ qs = TALER_ARL_adb->insert_wire_out_inconsistency (
+ TALER_ARL_adb->cls,
+ &woi);
+
+ if (qs < 0)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
+ }
}
-
- TALER_ARL_report (report_wire_out_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("destination_account",
- payto_uri),
- GNUNET_JSON_pack_uint64 ("rowid",
- rowid),
- TALER_JSON_pack_amount ("expected",
- &final_amount),
- TALER_JSON_pack_amount ("claimed",
- amount)));
- if (TALER_ARL_do_abort ())
- return GNUNET_SYSERR;
return GNUNET_OK;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
diff --git a/src/auditor/taler-helper-auditor-coins.c
b/src/auditor/taler-helper-auditor-coins.c
index a4c937410..c8130a0fb 100644
--- a/src/auditor/taler-helper-auditor-coins.c
+++ b/src/auditor/taler-helper-auditor-coins.c
@@ -280,13 +280,14 @@ report_emergency_by_amount (
TALER_amount2s (loss));
enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_Emergency emergency;
- emergency.denom_loss = *loss;
- emergency.denompub_h = *&issue->denom_hash;
- emergency.denom_risk = *risk;
- emergency.deposit_start = *&issue->start.abs_time;
- emergency.deposit_end = *&issue->expire_deposit.abs_time;
- emergency.value = *&issue->value;
+ struct TALER_AUDITORDB_Emergency emergency = {
+ .denom_loss = *loss,
+ .denompub_h = *&issue->denom_hash,
+ .denom_risk = *risk,
+ .deposit_start = *&issue->start.abs_time,
+ .deposit_end = *&issue->expire_deposit.abs_time,
+ .value = *&issue->value
+ };
qs = TALER_ARL_adb->insert_emergency (
TALER_ARL_adb->cls,
@@ -295,23 +296,8 @@ report_emergency_by_amount (
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
}
-
- TALER_ARL_report (
- report_emergencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_data_auto ("denompub_hash",
- &issue->denom_hash),
- TALER_JSON_pack_amount ("denom_risk",
- risk),
- TALER_JSON_pack_amount ("denom_loss",
- loss),
- TALER_JSON_pack_time_abs_human ("start",
- issue->start.abs_time),
- TALER_JSON_pack_time_abs_human ("deposit_end",
- issue->expire_deposit.abs_time),
- TALER_JSON_pack_amount ("value",
- &issue->value)));
TALER_ARL_amount_add (&reported_emergency_risk_by_amount,
&reported_emergency_risk_by_amount,
risk);
@@ -343,13 +329,14 @@ report_emergency_by_count (
const struct TALER_Amount *risk)
{
enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_EmergenciesByCount emergenciesByCount;
- emergenciesByCount.denompub_h = issue->denom_hash;
- emergenciesByCount.num_issued = num_issued;
- emergenciesByCount.num_known = num_known;
- emergenciesByCount.start = issue->start.abs_time;
- emergenciesByCount.deposit_end = issue->expire_deposit.abs_time;
- emergenciesByCount.value = issue->value;
+ struct TALER_AUDITORDB_EmergenciesByCount emergenciesByCount = {
+ .denompub_h = issue->denom_hash,
+ .num_issued = num_issued,
+ .num_known = num_known,
+ .start = issue->start.abs_time,
+ .deposit_end = issue->expire_deposit.abs_time,
+ .value = issue->value
+ };
qs = TALER_ARL_adb->insert_emergency_by_count (
TALER_ARL_adb->cls,
@@ -358,26 +345,8 @@ report_emergency_by_count (
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
}
-
-
- TALER_ARL_report (
- report_emergencies_by_count,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_data_auto ("denompub_h", &issue->denom_hash),
- GNUNET_JSON_pack_uint64 ("num_issued",
- num_issued),
- GNUNET_JSON_pack_uint64 ("num_known",
- num_known),
- TALER_JSON_pack_amount ("denom_risk",
- risk),
- TALER_JSON_pack_time_abs_human ("start", issue->start.abs_time),
- TALER_JSON_pack_time_abs_human ("deposit_end",
- issue->expire_deposit.abs_time),
- TALER_JSON_pack_amount ("value",
- &issue->value)));
-
-
TALER_ARL_amount_add (&reported_emergency_risk_by_count,
&reported_emergency_risk_by_count,
risk);
@@ -414,8 +383,6 @@ report_amount_arithmetic_inconsistency (
{
struct TALER_Amount delta;
struct TALER_Amount *target;
- enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_AmountArithmeticInconsistency aai;
if (0 < TALER_amount_cmp (exchange,
auditor))
@@ -434,33 +401,24 @@ report_amount_arithmetic_inconsistency (
exchange);
}
- aai.profitable = profitable;
- aai.operation = (char *) operation;
- aai.exchange_amount = *exchange;
- aai.auditor_amount = *auditor;
-
- qs = TALER_ARL_adb->insert_amount_arithmetic_inconsistency (
- TALER_ARL_adb->cls,
- &aai);
-
- if (qs < 0)
{
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- }
-
+ struct TALER_AUDITORDB_AmountArithmeticInconsistency aai = {
+ .profitable = profitable,
+ .operation = (char *) operation,
+ .exchange_amount = *exchange,
+ .auditor_amount = *auditor
+ };
+ enum GNUNET_DB_QueryStatus qs;
- TALER_ARL_report (report_amount_arithmetic_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- operation),
- GNUNET_JSON_pack_uint64 ("rowid",
- rowid),
- TALER_JSON_pack_amount ("exchange",
- exchange),
- TALER_JSON_pack_amount ("auditor",
- auditor),
- GNUNET_JSON_pack_int64 ("profitable",
- profitable)));
+ qs = TALER_ARL_adb->insert_amount_arithmetic_inconsistency (
+ TALER_ARL_adb->cls,
+ &aai);
+ if (qs < 0)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
+ }
+ }
if (0 != profitable)
{
target = (1 == profitable)
@@ -487,30 +445,20 @@ report_row_inconsistency (const char *table,
{
enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_RowInconsistency ri;
- ri.row_table = (char *) table;
- ri.row_id = rowid;
- ri.diagnostic = (char *) diagnostic;
-
+ struct TALER_AUDITORDB_RowInconsistency ri = {
+ .row_table = (char *) table,
+ .row_id = rowid,
+ .diagnostic = (char *) diagnostic
+ };
qs = TALER_ARL_adb->insert_row_inconsistency (
TALER_ARL_adb->cls,
&ri);
-
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
-
- TALER_ARL_report (report_row_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("table",
- table),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- GNUNET_JSON_pack_string ("diagnostic",
- diagnostic)));
}
@@ -1203,7 +1151,7 @@ check_known_coin (
{
struct TALER_CoinPublicInfo ci;
enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_BadSigLosses bsl;
+
if (NULL == get_cached_history (coin_pub))
{
qs = check_coin_history (coin_pub,
@@ -1233,10 +1181,11 @@ check_known_coin (
TALER_test_coin_valid (&ci,
denom_pub))
{
-
- bsl.operation = (char *) operation;
- bsl.loss = *loss_potential;
- bsl.operation_specific_pub = coin_pub->eddsa_pub;
+ struct TALER_AUDITORDB_BadSigLosses bsl = {
+ .operation = (char *) operation,
+ .loss = *loss_potential,
+ .operation_specific_pub = coin_pub->eddsa_pub
+ };
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
@@ -1244,18 +1193,8 @@ check_known_coin (
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- operation),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("loss",
- loss_potential),
- GNUNET_JSON_pack_data_auto ("coin_pub",
- coin_pub)));
TALER_ARL_amount_add (&TALER_ARL_USE_AB (coin_irregular_loss),
&TALER_ARL_USE_AB (coin_irregular_loss),
loss_potential);
@@ -1358,7 +1297,6 @@ refresh_session_cb (void *cls,
struct DenominationSummary *dso;
struct TALER_Amount amount_without_fee;
enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_BadSigLosses bsl;
(void) noreveal_index;
GNUNET_assert (rowid >=
@@ -1409,30 +1347,21 @@ refresh_session_cb (void *cls,
coin_pub,
coin_sig))
{
- GNUNET_break_op (0);
-
- bsl.operation = "melt";
- bsl.loss = *amount_with_fee;
- bsl.operation_specific_pub = coin_pub->eddsa_pub;
+ struct TALER_AUDITORDB_BadSigLosses bsl = {
+ .operation = "melt",
+ .loss = *amount_with_fee,
+ .operation_specific_pub = coin_pub->eddsa_pub
+ };
+ GNUNET_break_op (0);
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
&bsl);
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- "melt"),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("loss",
- amount_with_fee),
- GNUNET_JSON_pack_data_auto ("coin_pub",
- coin_pub)));
TALER_ARL_amount_add (&TALER_ARL_USE_AB (coin_irregular_loss),
&TALER_ARL_USE_AB (coin_irregular_loss),
amount_with_fee);
@@ -1450,7 +1379,6 @@ refresh_session_cb (void *cls,
.rowid = rowid,
.err = GNUNET_OK
};
- struct TALER_AUDITORDB_RefreshesHanging rh;
qs = TALER_ARL_edb->get_refresh_reveal (TALER_ARL_edb->cls,
rc,
@@ -1468,27 +1396,20 @@ refresh_session_cb (void *cls,
/* This can legitimately happen if reveal was not yet called or only
with invalid data, even if the exchange is correctly operating. We
still report it. */
- rh.row_id = rowid;
- rh.amount = *amount_with_fee;
- rh.coin_pub = coin_pub->eddsa_pub;
+ struct TALER_AUDITORDB_RefreshesHanging rh = {
+ .row_id = rowid,
+ .amount = *amount_with_fee,
+ .coin_pub = coin_pub->eddsa_pub
+ };
qs = TALER_ARL_adb->insert_refreshes_hanging (
TALER_ARL_adb->cls,
&rh);
-
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- TALER_ARL_report (report_refreshes_hanging,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("amount",
- amount_with_fee),
- GNUNET_JSON_pack_data_auto ("coin_pub",
- coin_pub)));
TALER_ARL_amount_add (&total_refresh_hanging,
&total_refresh_hanging,
amount_with_fee);
@@ -1656,7 +1577,6 @@ deposit_cb (void *cls,
const struct TALER_EXCHANGEDB_DenominationKeyInformation *issue;
struct DenominationSummary *ds;
enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_BadSigLosses bsl;
(void) done;
(void) exchange_timestamp;
@@ -1734,14 +1654,11 @@ deposit_cb (void *cls,
&deposit->coin.coin_pub,
&deposit->csig))
{
- bsl.operation = "deposit";
- bsl.loss = deposit->amount_with_fee;
- bsl.operation_specific_pub = deposit->coin.coin_pub.eddsa_pub;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "--operation %s\n", bsl.operation);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "--loss %s\n",
- TALER_amount_to_string (&bsl.loss));
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "--operation_specific_pub %s\n",
- TALER_B2S (&bsl.operation_specific_pub));
+ struct TALER_AUDITORDB_BadSigLosses bsl = {
+ .operation = "deposit",
+ .loss = deposit->amount_with_fee,
+ .operation_specific_pub = deposit->coin.coin_pub.eddsa_pub
+ };
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
@@ -1750,19 +1667,8 @@ deposit_cb (void *cls,
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- "deposit"),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("loss",
- &deposit->amount_with_fee),
- GNUNET_JSON_pack_data_auto ("coin_pub",
-
&deposit->coin.coin_pub)))
- ;
TALER_ARL_amount_add (&TALER_ARL_USE_AB (coin_irregular_loss),
&TALER_ARL_USE_AB (coin_irregular_loss),
&deposit->amount_with_fee);
@@ -1839,7 +1745,6 @@ refund_cb (void *cls,
struct DenominationSummary *ds;
struct TALER_Amount amount_without_fee;
enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_BadSigLosses bsl;
GNUNET_assert (rowid >= TALER_ARL_USE_PP (coins_refund_serial_id)); /*
should be monotonically increasing */
TALER_ARL_USE_PP (coins_refund_serial_id) = rowid + 1;
@@ -1871,29 +1776,20 @@ refund_cb (void *cls,
merchant_pub,
merchant_sig))
{
- bsl.operation = "refund";
- bsl.loss = *amount_with_fee;
- bsl.operation_specific_pub = coin_pub->eddsa_pub;
+ struct TALER_AUDITORDB_BadSigLosses bsl = {
+ .operation = "refund",
+ .loss = *amount_with_fee,
+ .operation_specific_pub = coin_pub->eddsa_pub
+ };
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
&bsl);
-
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- "refund"),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("loss",
- amount_with_fee),
- GNUNET_JSON_pack_data_auto ("coin_pub",
- coin_pub)));
TALER_ARL_amount_add (&TALER_ARL_USE_AB (coin_irregular_loss),
&TALER_ARL_USE_AB (coin_irregular_loss),
amount_with_fee);
@@ -2122,8 +2018,6 @@ check_recoup (struct CoinContext *cc,
struct DenominationSummary *ds;
enum GNUNET_DB_QueryStatus qs;
const struct TALER_EXCHANGEDB_DenominationKeyInformation *issue;
- struct TALER_AUDITORDB_BadSigLosses bsl;
- struct TALER_AUDITORDB_BadSigLosses bsldnr;
if (GNUNET_OK !=
TALER_wallet_recoup_verify (&coin->denom_pub_hash,
@@ -2139,10 +2033,12 @@ check_recoup (struct CoinContext *cc,
TALER_test_coin_valid (coin,
denom_pub))
{
- bsl.operation = (char *) operation;
- bsl.loss = *amount;
- // TODO: maybe adding the wrong pub hash
- bsl.operation_specific_pub = coin->coin_pub.eddsa_pub;
+ struct TALER_AUDITORDB_BadSigLosses bsl = {
+ .operation = (char *) operation,
+ .loss = *amount,
+ // TODO: maybe adding the wrong pub
+ bsl.operation_specific_pub = coin->coin_pub.eddsa_pub
+ };
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
@@ -2151,18 +2047,8 @@ check_recoup (struct CoinContext *cc,
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- operation),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("loss",
- amount),
- GNUNET_JSON_pack_data_auto ("coin_pub",
- &coin->denom_pub_hash)));
TALER_ARL_amount_add (&TALER_ARL_USE_AB (coin_irregular_loss),
&TALER_ARL_USE_AB (coin_irregular_loss),
amount);
@@ -2211,10 +2097,12 @@ check_recoup (struct CoinContext *cc,
{
if (! ds->was_revoked)
{
- bsldnr.operation = (char *) operation;
- bsldnr.loss = *amount;
- // TODO: hint missing?
- bsldnr.operation_specific_pub = coin->coin_pub.eddsa_pub;
+ struct TALER_AUDITORDB_BadSigLosses bsldnr = {
+ .operation = (char *) operation,
+ .loss = *amount,
+ // TODO: hint missing?
+ .operation_specific_pub = coin->coin_pub.eddsa_pub
+ };
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
@@ -2223,21 +2111,8 @@ check_recoup (struct CoinContext *cc,
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- /* Woopsie, we allowed recoup on non-revoked denomination!? */
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- operation),
- GNUNET_JSON_pack_string ("hint",
- "denomination not revoked"),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("loss",
- amount),
- GNUNET_JSON_pack_data_auto ("coin_pub",
- &coin->coin_pub)));
TALER_ARL_amount_add (&TALER_ARL_USE_AB (coin_irregular_loss),
&TALER_ARL_USE_AB (coin_irregular_loss),
amount);
@@ -2281,7 +2156,6 @@ recoup_cb (void *cls,
const union GNUNET_CRYPTO_BlindingSecretP *coin_blind)
{
struct CoinContext *cc = cls;
- struct TALER_AUDITORDB_BadSigLosses bsl;
enum GNUNET_DB_QueryStatus qs;
GNUNET_assert (rowid >= TALER_ARL_USE_PP (coins_recoup_serial_id)); /*
should be monotonically increasing */
@@ -2294,9 +2168,11 @@ recoup_cb (void *cls,
&coin->coin_pub,
coin_sig))
{
- bsl.operation = "recoup";
- bsl.loss = *amount;
- bsl.operation_specific_pub = coin->coin_pub.eddsa_pub;
+ struct TALER_AUDITORDB_BadSigLosses bsl = {
+ .operation = "recoup",
+ .loss = *amount,
+ .operation_specific_pub = coin->coin_pub.eddsa_pub
+ };
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
@@ -2305,18 +2181,8 @@ recoup_cb (void *cls,
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- "recoup"),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("loss",
- amount),
- GNUNET_JSON_pack_data_auto ("coin_pub",
- &coin->coin_pub)));
TALER_ARL_amount_add (&TALER_ARL_USE_AB (coin_irregular_loss),
&TALER_ARL_USE_AB (coin_irregular_loss),
amount);
@@ -2366,7 +2232,6 @@ recoup_refresh_cb (void *cls,
struct CoinContext *cc = cls;
const struct TALER_EXCHANGEDB_DenominationKeyInformation *issue;
enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_BadSigLosses bsl;
(void) timestamp;
(void) old_coin_pub;
@@ -2422,9 +2287,11 @@ recoup_refresh_cb (void *cls,
&coin->coin_pub,
coin_sig))
{
- bsl.operation = "recoup-refresh";
- bsl.loss = *amount;
- bsl.operation_specific_pub = coin->coin_pub.eddsa_pub;
+ struct TALER_AUDITORDB_BadSigLosses bsl = {
+ .operation = "recoup-refresh",
+ .loss = *amount,
+ .operation_specific_pub = coin->coin_pub.eddsa_pub
+ };
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
@@ -2433,18 +2300,8 @@ recoup_refresh_cb (void *cls,
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- "recoup-refresh"),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("loss",
- amount),
- GNUNET_JSON_pack_data_auto ("coin_pub",
- &coin->coin_pub)));
TALER_ARL_amount_add (&TALER_ARL_USE_AB (coin_irregular_loss),
&TALER_ARL_USE_AB (coin_irregular_loss),
amount);
@@ -2481,7 +2338,6 @@ check_denomination (
{
enum GNUNET_DB_QueryStatus qs;
struct TALER_AuditorSignatureP auditor_sig;
- struct TALER_AUDITORDB_DenominationsWithoutSigs dws;
(void) cls;
(void) denom_pub;
@@ -2519,10 +2375,12 @@ check_denomination (
&TALER_ARL_auditor_pub,
&auditor_sig))
{
- dws.denompub_h = issue->denom_hash;
- dws.start_time = issue->start.abs_time;
- dws.end_time = issue->expire_legal.abs_time;
- dws.value = issue->value;
+ struct TALER_AUDITORDB_DenominationsWithoutSigs dws = {
+ .denompub_h = issue->denom_hash,
+ .start_time = issue->start.abs_time,
+ .end_time = issue->expire_legal.abs_time,
+ .value = issue->value
+ };
qs = TALER_ARL_adb->insert_denominations_without_sigs (
TALER_ARL_adb->cls,
@@ -2531,19 +2389,8 @@ check_denomination (
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- TALER_ARL_report (report_denominations_without_sigs,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_data_auto ("denomination",
- &issue->denom_hash),
- TALER_JSON_pack_amount ("value",
- &issue->value),
- TALER_JSON_pack_time_abs_human ("start_time",
- issue->start.abs_time),
- TALER_JSON_pack_time_abs_human ("end_time",
- issue->expire_legal.
- abs_time)));
}
}
@@ -2579,7 +2426,6 @@ purse_deposit_cb (
struct TALER_DenominationHashP dh;
const struct TALER_EXCHANGEDB_DenominationKeyInformation *issue;
struct DenominationSummary *ds;
- struct TALER_AUDITORDB_BadSigLosses bsl;
(void) flags;
(void) auditor_balance;
@@ -2625,9 +2471,11 @@ purse_deposit_cb (
&deposit->coin_pub,
&deposit->coin_sig))
{
- bsl.operation = "purse-deposit";
- bsl.loss = deposit->amount;
- bsl.operation_specific_pub = deposit->coin_pub.eddsa_pub;
+ struct TALER_AUDITORDB_BadSigLosses bsl = {
+ .operation = "purse-deposit",
+ .loss = deposit->amount,
+ .operation_specific_pub = deposit->coin_pub.eddsa_pub
+ };
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
@@ -2636,18 +2484,8 @@ purse_deposit_cb (
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- "purse-deposit"),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("loss",
- &deposit->amount),
- GNUNET_JSON_pack_data_auto ("coin_pub",
- &deposit->coin_pub)));
TALER_ARL_amount_add (&TALER_ARL_USE_AB (coin_irregular_loss),
&TALER_ARL_USE_AB (coin_irregular_loss),
&deposit->amount);
diff --git a/src/auditor/taler-helper-auditor-deposits.c
b/src/auditor/taler-helper-auditor-deposits.c
index 2f65de698..a9f0712cf 100644
--- a/src/auditor/taler-helper-auditor-deposits.c
+++ b/src/auditor/taler-helper-auditor-deposits.c
@@ -204,19 +204,6 @@ test_dc (void *cls,
return GNUNET_OK; /* all coins found, all good */
}
- /* deposit confirmation missing! report! */
- TALER_ARL_report (
- report_deposit_confirmation_inconsistencies,
- GNUNET_JSON_PACK (
-
- TALER_JSON_pack_time_abs_human ("timestamp",
- dc->exchange_timestamp.abs_time),
- TALER_JSON_pack_amount ("amount",
- &dc->total_without_fee),
- GNUNET_JSON_pack_uint64 ("rowid",
- serial_id),
- GNUNET_JSON_pack_data_auto ("account",
- &dc->h_wire)));
// dcc->first_missed_coin_serial = GNUNET_MIN
(dcc->first_missed_coin_serial, serial_id);
dcc->missed_count++;
TALER_ARL_amount_add (&dcc->missed_amount,
diff --git a/src/auditor/taler-helper-auditor-purses.c
b/src/auditor/taler-helper-auditor-purses.c
index e5d7f4dae..5152392ba 100644
--- a/src/auditor/taler-helper-auditor-purses.c
+++ b/src/auditor/taler-helper-auditor-purses.c
@@ -157,7 +157,6 @@ report_amount_arithmetic_inconsistency (
{
struct TALER_Amount delta;
struct TALER_Amount *target;
- struct TALER_AUDITORDB_AmountArithmeticInconsistency aai;
enum GNUNET_DB_QueryStatus qs;
if (0 < TALER_amount_cmp (exchange,
@@ -176,32 +175,26 @@ report_amount_arithmetic_inconsistency (
auditor,
exchange);
}
- aai.profitable = profitable;
- aai.operation = (char *) operation;
- aai.exchange_amount = *exchange;
- aai.auditor_amount = *auditor;
- qs = TALER_ARL_adb->insert_amount_arithmetic_inconsistency (
- TALER_ARL_adb->cls,
- &aai);
-
- if (qs < 0)
{
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ struct TALER_AUDITORDB_AmountArithmeticInconsistency aai = {
+ .profitable = profitable,
+ .operation = (char *) operation,
+ .exchange_amount = *exchange,
+ .auditor_amount = *auditor
+ };
+
+ qs = TALER_ARL_adb->insert_amount_arithmetic_inconsistency (
+ TALER_ARL_adb->cls,
+ &aai);
+
+ if (qs < 0)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
+ }
}
- TALER_ARL_report (report_amount_arithmetic_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- operation),
- GNUNET_JSON_pack_uint64 ("rowid",
- rowid),
- TALER_JSON_pack_amount ("exchange",
- exchange),
- TALER_JSON_pack_amount ("auditor",
- auditor),
- GNUNET_JSON_pack_int64 ("profitable",
- profitable)));
if (0 != profitable)
{
target = (1 == profitable)
@@ -227,11 +220,11 @@ report_row_inconsistency (const char *table,
const char *diagnostic)
{
enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_RowInconsistency ri;
-
- ri.diagnostic = (char *) diagnostic;
- ri.row_table = (char *) table;
- ri.row_id = rowid;
+ struct TALER_AUDITORDB_RowInconsistency ri = {
+ .diagnostic = (char *) diagnostic,
+ .row_table = (char *) table,
+ .row_id = rowid
+ };
qs = TALER_ARL_adb->insert_row_inconsistency (
TALER_ARL_adb->cls,
@@ -240,16 +233,8 @@ report_row_inconsistency (const char *table,
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- TALER_ARL_report (report_row_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("table",
- table),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- GNUNET_JSON_pack_string ("diagnostic",
- diagnostic)));
}
@@ -523,7 +508,6 @@ handle_purse_requested (
struct PurseContext *pc = cls;
struct PurseSummary *ps;
struct GNUNET_HashCode key;
- struct TALER_AUDITORDB_BadSigLosses bsl;
enum GNUNET_DB_QueryStatus qs;
TALER_ARL_USE_PP (purse_request_serial_id) = rowid;
@@ -536,10 +520,12 @@ handle_purse_requested (
purse_pub,
purse_sig))
{
- bsl.row_id = rowid;
- bsl.operation = "purse-request";
- bsl.loss = *target_amount;
- bsl.operation_specific_pub = purse_pub->eddsa_pub;
+ struct TALER_AUDITORDB_BadSigLosses bsl = {
+ .row_id = rowid,
+ .operation = "purse-request",
+ .loss = *target_amount,
+ .operation_specific_pub = purse_pub->eddsa_pub
+ };
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
@@ -548,18 +534,8 @@ handle_purse_requested (
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- "purse-reqeust"),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("loss",
- target_amount),
- GNUNET_JSON_pack_data_auto ("key_pub",
- purse_pub)));
TALER_ARL_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
target_amount);
@@ -620,7 +596,6 @@ handle_purse_deposits (
: deposit->exchange_base_url;
struct TALER_DenominationHashP h_denom_pub;
enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_BadSigLosses bsl;
/* should be monotonically increasing */
GNUNET_assert (rowid >= TALER_ARL_USE_PP (purse_deposits_serial_id));
@@ -666,10 +641,12 @@ handle_purse_deposits (
&deposit->coin_pub,
&deposit->coin_sig))
{
- bsl.row_id = rowid;
- bsl.operation = "purse-deposit";
- bsl.loss = deposit->amount;
- bsl.operation_specific_pub = deposit->coin_pub.eddsa_pub;
+ struct TALER_AUDITORDB_BadSigLosses bsl = {
+ .row_id = rowid,
+ .operation = "purse-deposit",
+ .loss = deposit->amount,
+ .operation_specific_pub = deposit->coin_pub.eddsa_pub
+ };
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
@@ -678,18 +655,8 @@ handle_purse_deposits (
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- "purse-deposit"),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("loss",
- &deposit->amount),
- GNUNET_JSON_pack_data_auto ("key_pub",
- &deposit->coin_pub)));
TALER_ARL_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
&deposit->amount);
@@ -756,7 +723,6 @@ handle_purse_merged (
{
struct PurseContext *pc = cls;
struct PurseSummary *ps;
- struct TALER_AUDITORDB_BadSigLosses bsl;
enum GNUNET_DB_QueryStatus qs;
/* should be monotonically increasing */
@@ -778,12 +744,14 @@ handle_purse_merged (
merge_pub,
merge_sig))
{
- GNUNET_free (reserve_url);
- bsl.row_id = rowid;
- bsl.operation = "merge-purse";
- bsl.loss = *amount;
- bsl.operation_specific_pub = merge_pub->eddsa_pub;
+ struct TALER_AUDITORDB_BadSigLosses bsl = {
+ .row_id = rowid,
+ .operation = "merge-purse",
+ .loss = *amount,
+ .operation_specific_pub = merge_pub->eddsa_pub
+ };
+ GNUNET_free (reserve_url);
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
&bsl);
@@ -791,18 +759,8 @@ handle_purse_merged (
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- "merge-purse"),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("loss",
- amount),
- GNUNET_JSON_pack_data_auto ("key_pub",
- merge_pub)));
TALER_ARL_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
amount);
@@ -874,8 +832,6 @@ handle_account_merged (
{
struct PurseContext *pc = cls;
struct PurseSummary *ps;
- struct TALER_AUDITORDB_BadSigLosses bsl;
- enum GNUNET_DB_QueryStatus qs;
/* should be monotonically increasing */
GNUNET_assert (rowid >= TALER_ARL_USE_PP (purse_account_merge_serial_id));
@@ -892,10 +848,13 @@ handle_account_merged (
reserve_pub,
reserve_sig))
{
- bsl.row_id = rowid;
- bsl.operation = "account-merge";
- bsl.loss = *purse_fee;
- bsl.operation_specific_pub = reserve_pub->eddsa_pub;
+ enum GNUNET_DB_QueryStatus qs;
+ struct TALER_AUDITORDB_BadSigLosses bsl = {
+ .row_id = rowid,
+ .operation = "account-merge",
+ .loss = *purse_fee,
+ .operation_specific_pub = reserve_pub->eddsa_pub
+ };
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
@@ -904,18 +863,8 @@ handle_account_merged (
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- "account-merge"),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("loss",
- purse_fee),
- GNUNET_JSON_pack_data_auto ("key_pub",
- reserve_pub)));
TALER_ARL_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
purse_fee);
@@ -1077,32 +1026,22 @@ handle_purse_expired (
struct GNUNET_TIME_Timestamp expiration_date)
{
struct PurseContext *pc = cls;
- struct TALER_AUDITORDB_PurseNotClosedInconsistencies pnci;
enum GNUNET_DB_QueryStatus qs;
+ struct TALER_AUDITORDB_PurseNotClosedInconsistencies pnci = {
+ .amount = *balance,
+ .expiration_date = expiration_date.abs_time,
+ .purse_pub = purse_pub->eddsa_pub
+ };
(void) pc;
- pnci.amount = *balance;
- pnci.expiration_date = expiration_date.abs_time;
- pnci.purse_pub = purse_pub->eddsa_pub;
-
qs = TALER_ARL_adb->insert_purse_not_closed_inconsistencies (
TALER_ARL_adb->cls,
&pnci);
-
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- TALER_ARL_report (report_purse_not_closed_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_data_auto ("purse_pub",
- purse_pub),
- TALER_JSON_pack_amount ("balance",
- balance),
- TALER_JSON_pack_time_abs_human ("expired",
-
expiration_date.abs_time))
- );
TALER_ARL_amount_add (&total_delayed_decisions,
&total_delayed_decisions,
balance);
diff --git a/src/auditor/taler-helper-auditor-reserves.c
b/src/auditor/taler-helper-auditor-reserves.c
index 27d1c8d8f..97fddc5b3 100644
--- a/src/auditor/taler-helper-auditor-reserves.c
+++ b/src/auditor/taler-helper-auditor-reserves.c
@@ -196,7 +196,6 @@ report_amount_arithmetic_inconsistency (
struct TALER_Amount delta;
struct TALER_Amount *target;
enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_AmountArithmeticInconsistency aai;
if (0 < TALER_amount_cmp (exchange,
auditor))
@@ -214,33 +213,27 @@ report_amount_arithmetic_inconsistency (
auditor,
exchange);
}
- aai.profitable = profitable;
- aai.operation = (char *) operation;
- aai.exchange_amount = *exchange;
- aai.auditor_amount = *auditor;
- qs = TALER_ARL_adb->insert_amount_arithmetic_inconsistency (
- TALER_ARL_adb->cls,
- &aai);
-
- if (qs < 0)
{
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- }
+ struct TALER_AUDITORDB_AmountArithmeticInconsistency aai = {
+ .row_id = rowid,
+ .profitable = profitable,
+ .operation = (char *) operation,
+ .exchange_amount = *exchange,
+ .auditor_amount = *auditor,
+ };
+ qs = TALER_ARL_adb->insert_amount_arithmetic_inconsistency (
+ TALER_ARL_adb->cls,
+ &aai);
+
+ if (qs < 0)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!!?
+ }
+ }
- TALER_ARL_report (report_amount_arithmetic_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- operation),
- GNUNET_JSON_pack_uint64 ("rowid",
- rowid),
- TALER_JSON_pack_amount ("exchange",
- exchange),
- TALER_JSON_pack_amount ("auditor",
- auditor),
- GNUNET_JSON_pack_int64 ("profitable",
- profitable)));
if (0 != profitable)
{
target = (1 == profitable)
@@ -266,11 +259,11 @@ report_row_inconsistency (const char *table,
const char *diagnostic)
{
enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_RowInconsistency ri;
-
- ri.diagnostic = (char *) diagnostic;
- ri.row_table = (char *) table;
- ri.row_id = rowid;
+ struct TALER_AUDITORDB_RowInconsistency ri = {
+ .diagnostic = (char *) diagnostic,
+ .row_table = (char *) table,
+ .row_id = rowid
+ };
qs = TALER_ARL_adb->insert_row_inconsistency (
TALER_ARL_adb->cls,
@@ -279,16 +272,8 @@ report_row_inconsistency (const char *table,
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!!?
}
-
- TALER_ARL_report (report_row_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("table",
- table),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- GNUNET_JSON_pack_string ("diagnostic",
- diagnostic)));
}
@@ -595,8 +580,6 @@ handle_reserve_out (void *cls,
struct TALER_Amount auditor_amount_with_fee;
enum GNUNET_DB_QueryStatus qs;
struct TALER_DenominationHashP h_denom_pub;
- struct TALER_AUDITORDB_DenominationKeyValidityWithdrawInconsistency dkvwi;
- struct TALER_AUDITORDB_BadSigLosses bsl;
/* should be monotonically increasing */
GNUNET_assert (rowid >= TALER_ARL_USE_PP (reserves_reserve_out_serial_id));
@@ -641,11 +624,12 @@ handle_reserve_out (void *cls,
<,
execution_date))
{
-
- dkvwi.row_id = rowid;
- dkvwi.execution_date = execution_date.abs_time;
- dkvwi.denompub_h = *&h_denom_pub;
- dkvwi.reserve_pub = *reserve_pub;
+ struct TALER_AUDITORDB_DenominationKeyValidityWithdrawInconsistency dkvwi
={
+ .row_id = rowid,
+ .execution_date = execution_date.abs_time,
+ .denompub_h = *&h_denom_pub,
+ .reserve_pub = *reserve_pub
+ };
qs =
TALER_ARL_adb->insert_denomination_key_validity_withdraw_inconsistency (
@@ -655,19 +639,8 @@ handle_reserve_out (void *cls,
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ /* FIXME: error handling! */
}
-
- TALER_ARL_report (denomination_key_validity_withdraw_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_time_abs_human ("execution_date",
-
execution_date.abs_time)
- ,
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- reserve_pub),
- GNUNET_JSON_pack_data_auto ("denompub_h",
- &h_denom_pub)));
}
/* check reserve_sig (first: setup remaining members of wsrd) */
@@ -678,10 +651,12 @@ handle_reserve_out (void *cls,
reserve_pub,
reserve_sig))
{
- bsl.row_id = rowid;
- bsl.operation = "withdraw";
- bsl.loss = *amount_with_fee;
- bsl.operation_specific_pub = reserve_pub->eddsa_pub;
+ struct TALER_AUDITORDB_BadSigLosses bsl = {
+ .row_id = rowid,
+ .operation = "withdraw",
+ .loss = *amount_with_fee,
+ .operation_specific_pub = reserve_pub->eddsa_pub
+ };
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
@@ -690,18 +665,8 @@ handle_reserve_out (void *cls,
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- "withdraw"),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("loss",
- amount_with_fee),
- GNUNET_JSON_pack_data_auto ("key_pub",
- reserve_pub)));
TALER_ARL_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
amount_with_fee);
@@ -785,8 +750,6 @@ handle_recoup_by_reserve (
uint64_t rev_rowid;
enum GNUNET_DB_QueryStatus qs;
const char *rev;
- struct TALER_AUDITORDB_BadSigLosses bslr;
- struct TALER_AUDITORDB_BadSigLosses bslrm;
(void) denom_pub;
/* should be monotonically increasing */
@@ -800,10 +763,12 @@ handle_recoup_by_reserve (
&coin->coin_pub,
coin_sig))
{
- bslr.row_id = rowid;
- bslr.operation = "recoup";
- bslr.loss = *amount;
- bslr.operation_specific_pub = coin->coin_pub.eddsa_pub;
+ struct TALER_AUDITORDB_BadSigLosses bslr = {
+ .row_id = rowid,
+ .operation = "recoup",
+ .loss = *amount,
+ .operation_specific_pub = coin->coin_pub.eddsa_pub
+ };
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
@@ -812,18 +777,8 @@ handle_recoup_by_reserve (
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- "recoup"),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("loss",
- amount),
- GNUNET_JSON_pack_data_auto ("key_pub",
- &coin->coin_pub)));
TALER_ARL_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
amount);
@@ -884,10 +839,12 @@ handle_recoup_by_reserve (
(0 == strcmp (rev,
"master signature invalid")))
{
- bslrm.row_id = rev_rowid;
- bslrm.operation = "recoup-master";
- bslrm.loss = *amount;
- bslrm.operation_specific_pub = TALER_ARL_master_pub.eddsa_pub;
+ struct TALER_AUDITORDB_BadSigLosses bslrm = {
+ .row_id = rev_rowid,
+ .operation = "recoup-master",
+ .loss = *amount,
+ .operation_specific_pub = TALER_ARL_master_pub.eddsa_pub
+ };
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
@@ -897,17 +854,6 @@ handle_recoup_by_reserve (
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- "recoup-master"),
- GNUNET_JSON_pack_uint64 ("row",
- rev_rowid),
- TALER_JSON_pack_amount ("loss",
- amount),
- GNUNET_JSON_pack_data_auto ("key_pub",
- &TALER_ARL_master_pub)));
TALER_ARL_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
amount);
@@ -1019,7 +965,6 @@ handle_reserve_open (
struct ReserveContext *rc = cls;
struct ReserveSummary *rs;
enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_BadSigLosses bsl;
/* should be monotonically increasing */
GNUNET_assert (rowid >= TALER_ARL_USE_PP (reserves_reserve_open_serial_id));
@@ -1040,11 +985,12 @@ handle_reserve_open (
reserve_pub,
reserve_sig))
{
-
- bsl.row_id = rowid;
- bsl.operation = "reserve-open";
- bsl.loss = *reserve_payment;
- bsl.operation_specific_pub = reserve_pub->eddsa_pub;
+ struct TALER_AUDITORDB_BadSigLosses bsl = {
+ .row_id = rowid,
+ .operation = "reserve-open",
+ .loss = *reserve_payment,
+ .operation_specific_pub = reserve_pub->eddsa_pub
+ };
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
@@ -1053,18 +999,8 @@ handle_reserve_open (
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- "reserve-open"),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("loss",
- reserve_payment),
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- reserve_pub)));
TALER_ARL_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
reserve_payment);
@@ -1172,7 +1108,6 @@ handle_reserve_closed (
struct TALER_Amount close_fee;
char *payto_uri;
enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_BadSigLosses bsl;
qs = TALER_ARL_edb->select_reserve_close_request_info (
TALER_ARL_edb->cls,
@@ -1202,10 +1137,12 @@ handle_reserve_closed (
reserve_pub,
&reserve_sig))
{
- bsl.row_id = close_request_row;
- bsl.operation = "close-request";
- bsl.loss = *amount_with_fee;
- bsl.operation_specific_pub = reserve_pub->eddsa_pub;
+ struct TALER_AUDITORDB_BadSigLosses bsl = {
+ .row_id = close_request_row,
+ .operation = "close-request",
+ .loss = *amount_with_fee,
+ .operation_specific_pub = reserve_pub->eddsa_pub
+ };
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
@@ -1214,18 +1151,8 @@ handle_reserve_closed (
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- "close-request"),
- GNUNET_JSON_pack_uint64 ("row",
- close_request_row),
- TALER_JSON_pack_amount ("loss",
- amount_with_fee),
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- reserve_pub)));
TALER_ARL_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
amount_with_fee);
@@ -1327,7 +1254,6 @@ handle_account_merged (
struct ReserveContext *rc = cls;
struct ReserveSummary *rs;
enum GNUNET_DB_QueryStatus qs;
- struct TALER_AUDITORDB_BadSigLosses bsl;
/* should be monotonically increasing */
GNUNET_assert (rowid >= TALER_ARL_USE_PP
(reserves_account_merges_serial_id));
@@ -1344,10 +1270,12 @@ handle_account_merged (
reserve_pub,
reserve_sig))
{
- bsl.row_id = rowid;
- bsl.operation = "account-merge";
- bsl.loss = *purse_fee;
- bsl.operation_specific_pub = reserve_pub->eddsa_pub;
+ struct TALER_AUDITORDB_BadSigLosses bsl = {
+ .row_id = rowid,
+ .operation = "account-merge",
+ .loss = *purse_fee,
+ .operation_specific_pub = reserve_pub->eddsa_pub
+ };
qs = TALER_ARL_adb->insert_bad_sig_losses (
TALER_ARL_adb->cls,
@@ -1356,18 +1284,8 @@ handle_account_merged (
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- TALER_ARL_report (report_bad_sig_losses,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation",
- "account-merge"),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("loss",
- purse_fee),
- GNUNET_JSON_pack_data_auto ("key_pub",
- reserve_pub)));
TALER_ARL_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
purse_fee);
@@ -1459,11 +1377,6 @@ verify_reserve_balance (void *cls,
struct TALER_Amount nbalance;
enum GNUNET_DB_QueryStatus qs;
enum GNUNET_GenericReturnValue ret;
- struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency rbiil;
- struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency rbiig;
- struct TALER_AUDITORDB_ReserveBalanceSummaryWrongInconsistency rbswi;
- struct TALER_AUDITORDB_ReserveNotClosedInconsistency rnci;
- struct TALER_AUDITORDB_ReserveNotClosedInconsistency rncid;
ret = GNUNET_OK;
/* Check our reserve summary balance calculation shows that
@@ -1476,23 +1389,20 @@ verify_reserve_balance (void *cls,
&mbalance,
&rs->total_out))
{
+ struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency rbiil = {
+ .reserve_pub = rs->reserve_pub.eddsa_pub,
+ .inconsistency_gain = false
+ };
- struct TALER_Amount loss;
-
- TALER_ARL_amount_subtract (&loss,
+ TALER_ARL_amount_subtract (&rbiil.inconsistency_amount,
&rs->total_out,
&mbalance);
TALER_ARL_amount_add (&rs->curr_balance.reserve_loss,
&rs->prev_balance.reserve_loss,
- &loss);
+ &rbiil.inconsistency_amount);
TALER_ARL_amount_add (&TALER_ARL_USE_AB (reserves_reserve_loss),
&TALER_ARL_USE_AB (reserves_reserve_loss),
- &loss);
-
- rbiil.reserve_pub = rs->reserve_pub.eddsa_pub;
- rbiil.inconsistency_amount = loss;
- rbiil.inconsistency_gain = false;
-
+ &rbiil.inconsistency_amount);
qs = TALER_ARL_adb->insert_reserve_balance_insufficient_inconsistency (
TALER_ARL_adb->cls,
&rbiil);
@@ -1500,14 +1410,8 @@ verify_reserve_balance (void *cls,
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling!
}
-
- TALER_ARL_report (report_reserve_balance_insufficient_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- &rs->reserve_pub),
- TALER_JSON_pack_amount ("loss",
- &loss)));
/* Continue with a reserve balance of zero */
GNUNET_assert (GNUNET_OK ==
TALER_amount_set_zero (TALER_ARL_currency,
@@ -1538,9 +1442,12 @@ verify_reserve_balance (void *cls,
We don't add the amount to some total simply because it is
not an actualized gain and could be trivially corrected by
restoring the summary. */
- rbiig.reserve_pub = rs->reserve_pub.eddsa_pub;
- rbiig.inconsistency_amount = nbalance;
- rbiig.inconsistency_gain = true;
+ struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency rbiig = {
+ .reserve_pub = rs->reserve_pub.eddsa_pub,
+ .inconsistency_amount = nbalance,
+ .inconsistency_gain = true
+ };
+
qs = TALER_ARL_adb->insert_reserve_balance_insufficient_inconsistency (
TALER_ARL_adb->cls,
&rbiig);
@@ -1548,15 +1455,8 @@ verify_reserve_balance (void *cls,
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
}
-
-
- TALER_ARL_report (report_reserve_balance_insufficient_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- &rs->reserve_pub),
- TALER_JSON_pack_amount ("gain",
- &nbalance)));
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
GNUNET_break (0);
@@ -1594,40 +1494,44 @@ verify_reserve_balance (void *cls,
&total_balance_summary_delta_minus,
&delta);
}
- rbiig.reserve_pub = rs->reserve_pub.eddsa_pub;
- rbiig.inconsistency_amount = nbalance;
- rbiig.inconsistency_gain = true;
-
- qs = TALER_ARL_adb->insert_reserve_balance_insufficient_inconsistency (
- TALER_ARL_adb->cls,
- &rbiig);
+ {
+ struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency rbiig
=
+ {
+ .reserve_pub = rs->reserve_pub.eddsa_pub,
+ .inconsistency_amount = nbalance,
+ .inconsistency_gain = true
+ };
+
+ qs = TALER_ARL_adb->insert_reserve_balance_insufficient_inconsistency
+ (
+ TALER_ARL_adb->cls,
+ &rbiig);
+ }
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
}
- rbswi.exchange_amount = reserve.balance;
- rbswi.auditor_amount = rs->curr_balance.reserve_balance;
- rbswi.reserve_pub = rs->reserve_pub;
-
- qs = TALER_ARL_adb->insert_reserve_balance_summary_wrong_inconsistency
(
- TALER_ARL_adb->cls,
- &rbswi);
+ {
+ struct TALER_AUDITORDB_ReserveBalanceSummaryWrongInconsistency rbswi
=
+ {
+ .exchange_amount = reserve.balance,
+ .auditor_amount = rs->curr_balance.reserve_balance,
+ .reserve_pub = rs->reserve_pub
+ };
+
+ qs =
TALER_ARL_adb->insert_reserve_balance_summary_wrong_inconsistency
+ (
+ TALER_ARL_adb->cls,
+ &rbswi);
+ }
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
}
-
- TALER_ARL_report (report_reserve_balance_summary_wrong_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- &rs->reserve_pub),
- TALER_JSON_pack_amount ("exchange",
- &reserve.balance),
- TALER_JSON_pack_amount ("auditor",
- &rs->curr_balance.
- reserve_balance)));
}
}
} /* end of 'if (internal_checks)' */
@@ -1652,14 +1556,15 @@ verify_reserve_balance (void *cls,
if (1 == TALER_amount_cmp (&nbalance,
&cfee))
{
+ struct TALER_AUDITORDB_ReserveNotClosedInconsistency rnci = {
+ .reserve_pub = rs->reserve_pub,
+ .expiration_time = rs->a_expiration_date.abs_time
+ };
+
/* remaining balance (according to us) exceeds closing fee */
TALER_ARL_amount_add (&total_balance_reserve_not_closed,
&total_balance_reserve_not_closed,
- &nbalance);
- rnci.reserve_pub = rs->reserve_pub;
- rnci.balance = nbalance;
- rnci.expiration_time = rs->a_expiration_date.abs_time;
-
+ &rnci.balance);
qs = TALER_ARL_adb->insert_reserve_not_closed_inconsistency (
TALER_ARL_adb->cls,
&rnci);
@@ -1667,16 +1572,8 @@ verify_reserve_balance (void *cls,
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
}
- TALER_ARL_report (
- report_reserve_not_closed_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- &rs->reserve_pub),
- TALER_JSON_pack_amount ("balance",
- &nbalance),
- TALER_JSON_pack_time_abs_human ("expiration_time",
- rs->a_expiration_date.abs_time)));
}
}
else
@@ -1688,30 +1585,23 @@ verify_reserve_balance (void *cls,
/*TALER_ARL_amount_add (&total_balance_reserve_not_closed,
&total_balance_reserve_not_closed,
&nbalance);*/
- rncid.reserve_pub = rs->reserve_pub;
- rncid.balance = (nbalance.value) ? total_balance_reserve_not_closed :
- nbalance;
- rncid.expiration_time = rs->a_expiration_date.abs_time;
- rncid.diagnostic = "could not determine closing fee";
+ struct TALER_AUDITORDB_ReserveNotClosedInconsistency rncid = {
+ .reserve_pub = rs->reserve_pub,
+ .balance = (nbalance.value)
+ ? total_balance_reserve_not_closed
+ : nbalance,
+ .expiration_time = rs->a_expiration_date.abs_time,
+ .diagnostic = "could not determine closing fee"
+ };
+
qs = TALER_ARL_adb->insert_reserve_not_closed_inconsistency (
TALER_ARL_adb->cls,
&rncid);
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ // FIXME: error handling
}
-
- /*TALER_ARL_report (
- report_reserve_not_closed_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- &rs->reserve_pub),
- TALER_JSON_pack_amount ("balance",
- &nbalance),
- TALER_JSON_pack_time_abs_human ("expiration_time",
- rs->a_expiration_date.abs_time),
- GNUNET_JSON_pack_string ("diagnostic",
- "could not determine closing fee")));*/
}
}
/* We already computed the 'new' balance in 'curr_balance'
diff --git a/src/auditor/taler-helper-auditor-wire-credit.c
b/src/auditor/taler-helper-auditor-wire-credit.c
index 2e6dae4ee..0baaa23d2 100644
--- a/src/auditor/taler-helper-auditor-wire-credit.c
+++ b/src/auditor/taler-helper-auditor-wire-credit.c
@@ -526,18 +526,6 @@ reserve_in_cb (void *cls,
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return GNUNET_SYSERR;
}
-#if TO_BE_REMOVED_DEAD_CODE
- TALER_ARL_report (report_row_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("table",
- "reserves_in"),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- GNUNET_JSON_pack_data_auto ("id",
- &rii->row_off_hash),
- GNUNET_JSON_pack_string ("diagnostic",
- "duplicate wire offset")));
-#endif
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
@@ -587,26 +575,6 @@ complain_in_not_found (void *cls,
global_qs = qs;
return GNUNET_SYSERR;
}
-#if TO_BE_REMOVED_DEAD_CODE
- TALER_ARL_report (
- report_reserve_in_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rii->rowid),
- TALER_JSON_pack_amount ("amount_exchange_expected",
- &rii->credit_details.amount),
- TALER_JSON_pack_amount ("amount_wired",
- &zero),
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- &rii->credit_details.reserve.reserve_pub),
- TALER_JSON_pack_time_abs_human ("timestamp",
- rii->credit_details.execution_date.
- abs_time),
- GNUNET_JSON_pack_string ("account",
- wa->ai->section_name),
- GNUNET_JSON_pack_string ("diagnostic",
- "incoming wire transfer claimed by exchange not
found")));
-#endif
TALER_ARL_amount_add (&total_bad_amount_in_minus,
&total_bad_amount_in_minus,
&rii->credit_details.amount);
@@ -717,27 +685,6 @@ analyze_credit (
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return false;
}
-#if TO_BE_REMOVED_DEAD_CODE
- TALER_ARL_report (
- report_reserve_in_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rii->rowid),
- GNUNET_JSON_pack_uint64 ("bank_row",
- credit_details->serial_id),
- TALER_JSON_pack_amount ("amount_exchange_expected",
- &rii->credit_details.amount),
- TALER_JSON_pack_amount ("amount_wired",
- &zero),
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- &rii->credit_details.details.reserve.
- reserve_pub),
- TALER_JSON_pack_time_abs_human ("timestamp",
- rii->credit_details.execution_date.
- abs_time),
- GNUNET_JSON_pack_string ("diagnostic",
- "wire subject does not match")));
-#endif
TALER_ARL_amount_add (&total_bad_amount_in_minus,
&total_bad_amount_in_minus,
&rii->credit_details.amount);
@@ -773,27 +720,6 @@ analyze_credit (
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return false;
}
-#if TO_BE_REMOVED_DEAD_CODE
- TALER_ARL_report (
- report_reserve_in_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rii->rowid),
- GNUNET_JSON_pack_uint64 ("bank_row",
- credit_details->serial_id),
- TALER_JSON_pack_amount ("amount_exchange_expected",
- &rii->credit_details.amount),
- TALER_JSON_pack_amount ("amount_wired",
- &credit_details->amount),
- GNUNET_JSON_pack_data_auto ("reserve_pub",
-
&credit_details->details.reserve.reserve_pub
- ),
- TALER_JSON_pack_time_abs_human ("timestamp",
-
credit_details->execution_date.abs_time)
- ,
- GNUNET_JSON_pack_string ("diagnostic",
- "wire amount does not match")));
-#endif
if (0 < TALER_amount_cmp (&credit_details->amount,
&rii->credit_details.amount))
{
@@ -840,19 +766,6 @@ analyze_credit (
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return false;
}
-#if TO_BE_REMOVED_DEAD_CODE
- TALER_ARL_report (report_misattribution_in_inconsistencies,
- GNUNET_JSON_PACK (
- TALER_JSON_pack_amount ("amount",
- &rii->credit_details.amount),
- GNUNET_JSON_pack_uint64 ("row",
- rii->rowid),
- GNUNET_JSON_pack_uint64 ("bank_row",
- credit_details->serial_id),
- GNUNET_JSON_pack_data_auto (
- "reserve_pub",
- &rii->credit_details.details.reserve.reserve_pub)));
-#endif
TALER_ARL_amount_add (&total_misattribution_in,
&total_misattribution_in,
&rii->credit_details.amount);
@@ -878,18 +791,6 @@ analyze_credit (
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return false;
}
-#if TO_BE_REMOVED_DEAD_CODE
- TALER_ARL_report (report_row_minor_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("table",
- "reserves_in"),
- GNUNET_JSON_pack_uint64 ("row",
- rii->rowid),
- GNUNET_JSON_pack_uint64 ("bank_row",
- credit_details->serial_id),
- GNUNET_JSON_pack_string ("diagnostic",
- "execution date mismatch")));
-#endif
}
return true;
}
diff --git a/src/auditor/taler-helper-auditor-wire-debit.c
b/src/auditor/taler-helper-auditor-wire-debit.c
index 60bca32be..afa82044c 100644
--- a/src/auditor/taler-helper-auditor-wire-debit.c
+++ b/src/auditor/taler-helper-auditor-wire-debit.c
@@ -466,21 +466,6 @@ check_pending_rc (void *cls,
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return GNUNET_SYSERR;
}
-#if TO_BE_REMOVED_DEAD_CODE
- TALER_ARL_report (
- report_closure_lags,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rc->rowid),
- TALER_JSON_pack_amount ("amount",
- &rc->amount),
- TALER_JSON_pack_time_abs_human ("deadline",
- rc->execution_date.abs_time),
- GNUNET_JSON_pack_data_auto ("wtid",
- &rc->wtid),
- GNUNET_JSON_pack_string ("account",
- rc->receiver_account)));
-#endif
}
TALER_ARL_USE_PP (wire_reserve_close_id)
= GNUNET_MIN (TALER_ARL_USE_PP (wire_reserve_close_id),
@@ -858,23 +843,6 @@ generate_report (void *cls,
return GNUNET_SYSERR;
}
}
-#if TO_BE_REMOVED_DEAD_CODE
- TALER_ARL_report (report_kyc_lags,
- GNUNET_JSON_PACK (
- TALER_JSON_pack_amount ("total_amount",
- &rd->total_amount),
- TALER_JSON_pack_time_abs_human ("deadline",
- rd->deadline.abs_time),
- GNUNET_JSON_pack_object_incref ("kyc_rules",
- rd->rules),
- GNUNET_JSON_pack_allow_null (
- GNUNET_JSON_pack_object_incref ("properties",
- rd->properties)),
- GNUNET_JSON_pack_allow_null (
- GNUNET_JSON_pack_string ("account",
- rd->payto_uri)));
-#endif
-
return free_report_entry (cls,
key,
value);
@@ -1122,16 +1090,6 @@ check_time_difference (const char *table,
return false;
}
}
-#if TO_BE_REMOVED_DEAD_CODE
- TALER_ARL_report (report_row_minor_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("table",
- table),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- GNUNET_JSON_pack_string ("diagnostic",
- details)));
-#endif
GNUNET_free (details);
return true;
}
@@ -1199,25 +1157,6 @@ wire_out_cb (void *cls,
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return GNUNET_SYSERR;
}
-#if TO_BE_REMOVED_DEAD_CODE
- TALER_ARL_report (
- report_wire_out_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("amount_wired",
- &zero),
- TALER_JSON_pack_amount ("amount_justified",
- amount),
- GNUNET_JSON_pack_data_auto ("wtid",
- wtid),
- TALER_JSON_pack_time_abs_human ("timestamp",
- date.abs_time),
- GNUNET_JSON_pack_string ("diagnostic",
- "wire transfer not made (yet?)"),
- GNUNET_JSON_pack_string ("account_section",
- wa->ai->section_name)));
-#endif
TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_minus),
&TALER_ARL_USE_AB (total_bad_amount_out_minus),
amount);
@@ -1249,27 +1188,6 @@ wire_out_cb (void *cls,
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return GNUNET_SYSERR;
}
-#if TO_BE_REMOVED_DEAD_CODE
- TALER_ARL_report (
- report_wire_out_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("amount_wired",
- &roi->details.amount),
- TALER_JSON_pack_amount ("amount_justified",
- &zero),
- GNUNET_JSON_pack_data_auto ("wtid",
- wtid),
- TALER_JSON_pack_time_abs_human ("timestamp",
- date.abs_time),
- GNUNET_JSON_pack_string ("diagnostic",
- "receiver account mismatch"),
- GNUNET_JSON_pack_string ("target",
- payto_uri),
- GNUNET_JSON_pack_string ("account_section",
- wa->ai->section_name)));
-#endif
TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_plus),
&TALER_ARL_USE_AB (total_bad_amount_out_plus),
&roi->details.amount);
@@ -1299,25 +1217,6 @@ wire_out_cb (void *cls,
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return GNUNET_SYSERR;
}
-#if TO_BE_REMOVED_DEAD_CODE
- TALER_ARL_report (
- report_wire_out_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- TALER_JSON_pack_amount ("amount_justified",
- amount),
- TALER_JSON_pack_amount ("amount_wired",
- &roi->details.amount),
- GNUNET_JSON_pack_data_auto ("wtid",
- wtid),
- TALER_JSON_pack_time_abs_human ("timestamp",
- date.abs_time),
- GNUNET_JSON_pack_string ("diagnostic",
- "wire amount does not match"),
- GNUNET_JSON_pack_string ("account_section",
- wa->ai->section_name)));
-#endif
if (0 < TALER_amount_cmp (amount,
&roi->details.amount))
{
@@ -1447,16 +1346,16 @@ complain_out_not_found (void *cls,
};
(void) key;
- hash_rc (roi->details.credit_account_uri,
- &roi->details.wtid,
- &rkey);
- GNUNET_CONTAINER_multihashmap_get_multiple (reserve_closures,
- &rkey,
- &check_rc_matches,
- &ctx);
- if (ctx.found)
- return GNUNET_OK;
- /* check for profit drain */
+ hash_rc (roi->details.credit_account_uri,
+ &roi->details.wtid,
+ &rkey);
+ GNUNET_CONTAINER_multihashmap_get_multiple (reserve_closures,
+ &rkey,
+ &check_rc_matches,
+ &ctx);
+ if (ctx.found)
+ return GNUNET_OK;
+ /* check for profit drain */
{
enum GNUNET_DB_QueryStatus qs;
uint64_t serial;
@@ -1478,168 +1377,113 @@ complain_out_not_found (void *cls,
&master_sig);
switch (qs)
{
- case GNUNET_DB_STATUS_HARD_ERROR:
- GNUNET_break (0);
- global_ret = EXIT_FAILURE;
- GNUNET_SCHEDULER_shutdown ();
- return GNUNET_SYSERR;
- case GNUNET_DB_STATUS_SOFT_ERROR:
- /* should fail on commit later ... */
+ case GNUNET_DB_STATUS_HARD_ERROR:
+ GNUNET_break (0);
+ global_ret = EXIT_FAILURE;
+ GNUNET_SCHEDULER_shutdown ();
+ return GNUNET_SYSERR;
+ case GNUNET_DB_STATUS_SOFT_ERROR:
+ /* should fail on commit later ... */
+ GNUNET_break (0);
+ return GNUNET_NO;
+ case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ /* not a profit drain */
+ break;
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Profit drain of %s to %s found!\n",
+ TALER_amount2s (&amount),
+ payto_uri);
+ if (GNUNET_OK !=
+ TALER_exchange_offline_profit_drain_verify (
+ &roi->details.wtid,
+ request_timestamp,
+ &amount,
+ account_section,
+ payto_uri,
+ &TALER_ARL_master_pub,
+ &master_sig))
+ {
+ struct TALER_AUDITORDB_RowInconsistency ri = {
+ .row_id = roi->details.serial_id,
+ .row_table = "profit_drains",
+ .diagnostic = "invalid signature"
+ };
+
GNUNET_break (0);
- return GNUNET_NO;
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
- /* not a profit drain */
- break;
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Profit drain of %s to %s found!\n",
- TALER_amount2s (&amount),
- payto_uri);
- if (GNUNET_OK !=
- TALER_exchange_offline_profit_drain_verify (
- &roi->details.wtid,
- request_timestamp,
- &amount,
- account_section,
- payto_uri,
- &TALER_ARL_master_pub,
- &master_sig))
+ qs = TALER_ARL_adb->insert_row_inconsistency (
+ TALER_ARL_adb->cls,
+ &ri);
+ if (qs < 0)
{
- struct TALER_AUDITORDB_RowInconsistency ri = {
- .row_id = roi->details.serial_id,
- .row_table = "profit_drains",
- .diagnostic = "invalid signature"
- };
-
- GNUNET_break (0);
- qs = TALER_ARL_adb->insert_row_inconsistency (
- TALER_ARL_adb->cls,
- &ri);
- if (qs < 0)
- {
- global_qs = qs;
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- return GNUNET_SYSERR;
- }
-#if TO_BE_REMOVED_DEAD_CODE
- TALER_ARL_report (report_row_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("table",
- "profit_drains"),
- GNUNET_JSON_pack_uint64 ("row",
- serial),
- GNUNET_JSON_pack_data_auto ("id",
- &roi->details.wtid),
- GNUNET_JSON_pack_string ("diagnostic",
- "invalid signature")));
-#endif
- TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_plus),
- &TALER_ARL_USE_AB (total_bad_amount_out_plus),
- &amount);
+ global_qs = qs;
+ GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ return GNUNET_SYSERR;
}
- else if (0 !=
- strcasecmp (payto_uri,
- roi->details.credit_account_uri))
+ TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_plus),
+ &TALER_ARL_USE_AB (total_bad_amount_out_plus),
+ &amount);
+ }
+ else if (0 !=
+ strcasecmp (payto_uri,
+ roi->details.credit_account_uri))
+ {
+ struct TALER_AUDITORDB_WireOutInconsistency woi = {
+ .row_id = serial,
+ .destination_account = (char *) roi->details.credit_account_uri,
+ .diagnostic = "amount wired to invalid account",
+ .expected = roi->details.amount,
+ .claimed = zero,
+ };
+
+ qs = TALER_ARL_adb->insert_wire_out_inconsistency (
+ TALER_ARL_adb->cls,
+ &woi);
+ if (qs < 0)
{
- struct TALER_AUDITORDB_WireOutInconsistency woi = {
- .row_id = serial,
- .destination_account = (char *) roi->details.credit_account_uri,
- .diagnostic = "amount wired to invalid account",
- .expected = roi->details.amount,
- .claimed = zero,
- };
-
- qs = TALER_ARL_adb->insert_wire_out_inconsistency (
- TALER_ARL_adb->cls,
- &woi);
- if (qs < 0)
- {
- global_qs = qs;
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- return GNUNET_SYSERR;
- }
-#if TO_BE_REMOVED_DEAD_CODE
- TALER_ARL_report (
- report_wire_out_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- serial),
- TALER_JSON_pack_amount ("amount_expected",
- &roi->details.amount),
- TALER_JSON_pack_amount ("amount_wired",
- &amount),
- GNUNET_JSON_pack_data_auto ("wtid",
- &roi->details.wtid),
- TALER_JSON_pack_time_abs_human ("timestamp",
- roi->details.execution_date.
- abs_time
- ),
- GNUNET_JSON_pack_string ("account",
- wa->ai->section_name),
- GNUNET_JSON_pack_string ("diagnostic",
- "wrong target account")));
-#endif
- TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_plus),
- &TALER_ARL_USE_AB (total_bad_amount_out_plus),
- &amount);
+ global_qs = qs;
+ GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ return GNUNET_SYSERR;
}
- else if (0 !=
- TALER_amount_cmp (&amount,
- &roi->details.amount))
+ TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_plus),
+ &TALER_ARL_USE_AB (total_bad_amount_out_plus),
+ &amount);
+ }
+ else if (0 !=
+ TALER_amount_cmp (&amount,
+ &roi->details.amount))
+ {
+ struct TALER_AUDITORDB_WireOutInconsistency woi = {
+ .row_id = roi->details.serial_id,
+ .destination_account = (char *) roi->details.credit_account_uri,
+ .diagnostic = "incorrect amount to correct account",
+ .expected = roi->details.amount,
+ .claimed = amount,
+ };
+
+ qs = TALER_ARL_adb->insert_wire_out_inconsistency (
+ TALER_ARL_adb->cls,
+ &woi);
+ if (qs < 0)
{
- struct TALER_AUDITORDB_WireOutInconsistency woi = {
- .row_id = roi->details.serial_id,
- .destination_account = (char *) roi->details.credit_account_uri,
- .diagnostic = "incorrect amount to correct account",
- .expected = roi->details.amount,
- .claimed = amount,
- };
-
- qs = TALER_ARL_adb->insert_wire_out_inconsistency (
- TALER_ARL_adb->cls,
- &woi);
- if (qs < 0)
- {
- global_qs = qs;
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- return GNUNET_SYSERR;
- }
-
-#if TO_BE_REMOVED_DEAD_CODE
- TALER_ARL_report (
- report_wire_out_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- serial),
- TALER_JSON_pack_amount ("amount_justified",
- &roi->details.amount),
- TALER_JSON_pack_amount ("amount_wired",
- &amount),
- GNUNET_JSON_pack_data_auto ("wtid",
- &roi->details.wtid),
- TALER_JSON_pack_time_abs_human ("timestamp",
- roi->details.execution_date.
- abs_time
- ),
- GNUNET_JSON_pack_string ("account",
- wa->ai->section_name),
- GNUNET_JSON_pack_string ("diagnostic",
- "profit drain amount incorrect")));
-#endif
- TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_minus),
- &TALER_ARL_USE_AB (total_bad_amount_out_minus),
- &roi->details.amount);
- TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_plus),
- &TALER_ARL_USE_AB (total_bad_amount_out_plus),
- &amount);
+ global_qs = qs;
+ GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ return GNUNET_SYSERR;
}
- GNUNET_free (account_section);
- GNUNET_free (payto_uri);
- /* profit drain was correct */
- TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_drained),
- &TALER_ARL_USE_AB (total_drained),
+ TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_minus),
+ &TALER_ARL_USE_AB (total_bad_amount_out_minus),
+ &roi->details.amount);
+ TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_plus),
+ &TALER_ARL_USE_AB (total_bad_amount_out_plus),
&amount);
- return GNUNET_OK;
+ }
+ GNUNET_free (account_section);
+ GNUNET_free (payto_uri);
+ /* profit drain was correct */
+ TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_drained),
+ &TALER_ARL_USE_AB (total_drained),
+ &amount);
+ return GNUNET_OK;
}
}
@@ -1663,29 +1507,10 @@ complain_out_not_found (void *cls,
return GNUNET_SYSERR;
}
}
-#if TO_BE_REMOVED_DEAD_CODE
- TALER_ARL_report (
- report_wire_out_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row",
- 0),
- TALER_JSON_pack_amount ("amount_wired",
- &roi->details.amount),
- TALER_JSON_pack_amount ("amount_justified",
- &zero),
- GNUNET_JSON_pack_data_auto ("wtid",
- &roi->details.wtid),
- TALER_JSON_pack_time_abs_human ("timestamp",
- roi->details.execution_date.abs_time),
- GNUNET_JSON_pack_string ("account_section",
- wa->ai->section_name),
- GNUNET_JSON_pack_string ("diagnostic",
- "justification for wire transfer not found")));
-#endif
- TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_plus),
- &TALER_ARL_USE_AB (total_bad_amount_out_plus),
- &roi->details.amount);
- return GNUNET_OK;
+ TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_bad_amount_out_plus),
+ &TALER_ARL_USE_AB (total_bad_amount_out_plus),
+ &roi->details.amount);
+ return GNUNET_OK;
}
@@ -1758,85 +1583,75 @@ history_debit_cb (void *cls,
wa->dhh = NULL;
switch (dhr->http_status)
{
- case MHD_HTTP_OK:
- for (unsigned int i = 0; i < dhr->details.ok.details_length; i++)
+ case MHD_HTTP_OK:
+ for (unsigned int i = 0; i < dhr->details.ok.details_length; i++)
+ {
+ const struct TALER_BANK_DebitDetails *dd
+ = &dhr->details.ok.details[i];
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Analyzing bank DEBIT at %s of %s with WTID %s\n",
+ GNUNET_TIME_timestamp2s (dd->execution_date),
+ TALER_amount2s (&dd->amount),
+ TALER_B2S (&dd->wtid));
+ /* Update offset */
+ wa->wire_off_out = dd->serial_id;
+ slen = strlen (dd->credit_account_uri) + 1;
+ roi = GNUNET_malloc (sizeof (struct ReserveOutInfo)
+ + slen);
+ GNUNET_CRYPTO_hash (&dd->wtid,
+ sizeof (dd->wtid),
+ &roi->subject_hash);
+ roi->details.amount = dd->amount;
+ roi->details.execution_date = dd->execution_date;
+ roi->details.wtid = dd->wtid;
+ roi->details.credit_account_uri = (const char *) &roi[1];
+ GNUNET_memcpy (&roi[1],
+ dd->credit_account_uri,
+ slen);
+ if (GNUNET_OK !=
+ GNUNET_CONTAINER_multihashmap_put (out_map,
+ &roi->subject_hash,
+ roi,
+
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
{
- const struct TALER_BANK_DebitDetails *dd
- = &dhr->details.ok.details[i];
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Analyzing bank DEBIT at %s of %s with WTID %s\n",
- GNUNET_TIME_timestamp2s (dd->execution_date),
- TALER_amount2s (&dd->amount),
- TALER_B2S (&dd->wtid));
- /* Update offset */
- wa->wire_off_out = dd->serial_id;
- slen = strlen (dd->credit_account_uri) + 1;
- roi = GNUNET_malloc (sizeof (struct ReserveOutInfo)
- + slen);
- GNUNET_CRYPTO_hash (&dd->wtid,
- sizeof (dd->wtid),
- &roi->subject_hash);
- roi->details.amount = dd->amount;
- roi->details.execution_date = dd->execution_date;
- roi->details.wtid = dd->wtid;
- roi->details.credit_account_uri = (const char *) &roi[1];
- GNUNET_memcpy (&roi[1],
- dd->credit_account_uri,
- slen);
- if (GNUNET_OK !=
- GNUNET_CONTAINER_multihashmap_put (out_map,
- &roi->subject_hash,
- roi,
-
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
+ struct TALER_AUDITORDB_WireFormatInconsistency wfi = {
+ // fixme: rowid!
+ .diagnostic = "duplicate subject hash",
+ .amount = dd->amount,
+ .wire_offset = dd->serial_id
+ };
+ enum GNUNET_DB_QueryStatus qs;
+
+ qs = TALER_ARL_adb->insert_wire_format_inconsistency (
+ TALER_ARL_adb->cls,
+ &wfi);
+
+ if (qs < 0)
{
- struct TALER_AUDITORDB_WireFormatInconsistency wfi = {
- // fixme: rowid!
- .diagnostic = "duplicate subject hash",
- .amount = dd->amount,
- .wire_offset = dd->serial_id
- };
- enum GNUNET_DB_QueryStatus qs;
-
- qs = TALER_ARL_adb->insert_wire_format_inconsistency (
- TALER_ARL_adb->cls,
- &wfi);
-
- if (qs < 0)
- {
- global_qs = qs;
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- commit (qs);
- return;
- }
- TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_wire_format_amount),
- &TALER_ARL_USE_AB (total_wire_format_amount),
- &dd->amount);
-#if TO_BE_REMOVED_DEAD_CODE
- TALER_ARL_report (report_wire_format_inconsistencies,
- GNUNET_JSON_PACK (
- TALER_JSON_pack_amount ("amount",
- &dd->amount),
- GNUNET_JSON_pack_uint64 ("wire_offset",
- dd->serial_id),
- GNUNET_JSON_pack_string ("diagnostic",
- diagnostic)));
-#endif
+ global_qs = qs;
+ GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ commit (qs);
+ return;
}
+ TALER_ARL_amount_add (&TALER_ARL_USE_AB (total_wire_format_amount),
+ &TALER_ARL_USE_AB (total_wire_format_amount),
+ &dd->amount);
}
+ }
+ check_exchange_wire_out (wa);
+ return;
+ case MHD_HTTP_NO_CONTENT:
+ check_exchange_wire_out (wa);
+ return;
+ case MHD_HTTP_NOT_FOUND:
+ if (ignore_account_404)
+ {
check_exchange_wire_out (wa);
return;
- case MHD_HTTP_NO_CONTENT:
- check_exchange_wire_out (wa);
- return;
- case MHD_HTTP_NOT_FOUND:
- if (ignore_account_404)
- {
- check_exchange_wire_out (wa);
- return;
- }
- break;
- default:
- break;
+ }
+ break;
+ default:
+ break;
}
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Error fetching debit history of account %s: %u/%u!\n",
@@ -1965,22 +1780,6 @@ reserve_closed_cb (void *cls,
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return GNUNET_OK;
}
-#if TO_BE_REMOVED_DEAD_CODE
- TALER_ARL_report (report_row_inconsistencies,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("table",
- "reserves_closures"),
- GNUNET_JSON_pack_uint64 ("row",
- rowid),
- GNUNET_JSON_pack_data_auto ("id",
- reserve_pub),
- TALER_JSON_pack_amount ("amount_with_fee",
- amount_with_fee),
- TALER_JSON_pack_amount ("closing_fee",
- closing_fee),
- GNUNET_JSON_pack_string ("diagnostic",
- "closing fee above total
amount")));
-#endif
GNUNET_free (rc);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
@@ -2077,25 +1876,25 @@ begin_transaction (void)
NULL);
switch (qs)
{
- case GNUNET_DB_STATUS_HARD_ERROR:
- GNUNET_break (0);
- return qs;
- case GNUNET_DB_STATUS_SOFT_ERROR:
- GNUNET_break (0);
- return qs;
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (TALER_ARL_currency,
- &TALER_ARL_USE_AB
(total_drained)));
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (TALER_ARL_currency,
- &TALER_ARL_USE_AB
(total_wire_out)))
- ;
- had_start_balance = false;
- break;
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
- had_start_balance = true;
- break;
+ case GNUNET_DB_STATUS_HARD_ERROR:
+ GNUNET_break (0);
+ return qs;
+ case GNUNET_DB_STATUS_SOFT_ERROR:
+ GNUNET_break (0);
+ return qs;
+ case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (TALER_ARL_currency,
+ &TALER_ARL_USE_AB (total_drained)));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (TALER_ARL_currency,
+ &TALER_ARL_USE_AB (total_wire_out)))
+ ;
+ had_start_balance = false;
+ break;
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ had_start_balance = true;
+ break;
}
for (struct WireAccount *wa = wa_head;
NULL != wa;
diff --git a/src/include/taler_auditordb_plugin.h
b/src/include/taler_auditordb_plugin.h
index c4a39cd70..f33113122 100644
--- a/src/include/taler_auditordb_plugin.h
+++ b/src/include/taler_auditordb_plugin.h
@@ -212,6 +212,7 @@ struct TALER_AUDITORDB_Generic_Update
*/
struct TALER_AUDITORDB_AmountArithmeticInconsistency
{
+ // FIXME: which row?
uint64_t row_id;
char *operation;
struct TALER_Amount exchange_amount;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: get finally rid of TALER_ARL_report,
gnunet <=