summaryrefslogtreecommitdiff
path: root/src/auditor/taler-helper-auditor-wire.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-03-22 23:32:06 +0100
committerChristian Grothoff <christian@grothoff.org>2020-03-22 23:32:06 +0100
commit3480146a6658f16d8a12d9653cb2e8b358c595c8 (patch)
tree3c1816ac1ddc9a14a8c2a0c7bdfadce7c3d907ab /src/auditor/taler-helper-auditor-wire.c
parent488f759a2d7521a32b60ced7efb79681276d34f2 (diff)
downloadexchange-3480146a6658f16d8a12d9653cb2e8b358c595c8.tar.gz
exchange-3480146a6658f16d8a12d9653cb2e8b358c595c8.tar.bz2
exchange-3480146a6658f16d8a12d9653cb2e8b358c595c8.zip
first pass at auditor-coins, also reviewing checks around amount arithmetic, can and should be made harsher
Diffstat (limited to 'src/auditor/taler-helper-auditor-wire.c')
-rw-r--r--src/auditor/taler-helper-auditor-wire.c152
1 files changed, 76 insertions, 76 deletions
diff --git a/src/auditor/taler-helper-auditor-wire.c b/src/auditor/taler-helper-auditor-wire.c
index faf65a52f..4808ed74e 100644
--- a/src/auditor/taler-helper-auditor-wire.c
+++ b/src/auditor/taler-helper-auditor-wire.c
@@ -629,10 +629,10 @@ check_pending_rc (void *cls,
(void) cls;
(void) key;
- GNUNET_break (GNUNET_OK ==
- TALER_amount_add (&total_closure_amount_lag,
- &total_closure_amount_lag,
- &rc->amount));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_add (&total_closure_amount_lag,
+ &total_closure_amount_lag,
+ &rc->amount));
if ( (0 != rc->amount.value) ||
(0 != rc->amount.fraction) )
TALER_ARL_report (report_closure_lags,
@@ -835,10 +835,10 @@ wire_missing_cb (void *cls,
/* bool? */ int done)
{
(void) cls;
- GNUNET_break (GNUNET_OK ==
- TALER_amount_add (&total_amount_lag,
- &total_amount_lag,
- amount));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_add (&total_amount_lag,
+ &total_amount_lag,
+ amount));
if ( (GNUNET_YES == tiny) &&
(0 > TALER_amount_cmp (amount,
&tiny_amount)) )
@@ -1001,10 +1001,10 @@ wire_out_cb (void *cls,
date),
"diagnostic", "wire transfer not made (yet?)",
"account_section", wa->section_name));
- GNUNET_break (GNUNET_OK ==
- TALER_amount_add (&total_bad_amount_out_minus,
- &total_bad_amount_out_minus,
- amount));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_add (&total_bad_amount_out_minus,
+ &total_bad_amount_out_minus,
+ amount));
return GNUNET_OK;
}
{
@@ -1029,10 +1029,10 @@ wire_out_cb (void *cls,
date),
"diagnostic", "recevier account mismatch",
"account_section", wa->section_name));
- GNUNET_break (GNUNET_OK ==
- TALER_amount_add (&total_bad_amount_out_plus,
- &total_bad_amount_out_plus,
- &roi->details.amount));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_add (&total_bad_amount_out_plus,
+ &total_bad_amount_out_plus,
+ &roi->details.amount));
TALER_ARL_report (report_wire_out_inconsistencies,
json_pack ("{s:I, s:o, s:o, s:o, s:o, s:s, s:s}",
"row", (json_int_t) rowid,
@@ -1045,10 +1045,10 @@ wire_out_cb (void *cls,
date),
"diagnostic", "receiver account mismatch",
"account_section", wa->section_name));
- GNUNET_break (GNUNET_OK ==
- TALER_amount_add (&total_bad_amount_out_minus,
- &total_bad_amount_out_minus,
- amount));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_add (&total_bad_amount_out_minus,
+ &total_bad_amount_out_minus,
+ amount));
GNUNET_free (payto_uri);
goto cleanup;
}
@@ -1075,28 +1075,28 @@ wire_out_cb (void *cls,
/* amount > roi->details.amount: wire transfer was smaller than it should have been */
struct TALER_Amount delta;
- GNUNET_break (GNUNET_OK ==
- TALER_amount_subtract (&delta,
- amount,
- &roi->details.amount));
- GNUNET_break (GNUNET_OK ==
- TALER_amount_add (&total_bad_amount_out_minus,
- &total_bad_amount_out_minus,
- &delta));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_subtract (&delta,
+ amount,
+ &roi->details.amount));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_add (&total_bad_amount_out_minus,
+ &total_bad_amount_out_minus,
+ &delta));
}
else
{
/* roi->details.amount < amount: wire transfer was larger than it should have been */
struct TALER_Amount delta;
- GNUNET_break (GNUNET_OK ==
- TALER_amount_subtract (&delta,
- &roi->details.amount,
- amount));
- GNUNET_break (GNUNET_OK ==
- TALER_amount_add (&total_bad_amount_out_plus,
- &total_bad_amount_out_plus,
- &delta));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_subtract (&delta,
+ &roi->details.amount,
+ amount));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_add (&total_bad_amount_out_plus,
+ &total_bad_amount_out_plus,
+ &delta));
}
goto cleanup;
}
@@ -1217,10 +1217,10 @@ complain_out_not_found (void *cls,
wa->section_name,
"diagnostic",
"justification for wire transfer not found"));
- GNUNET_break (GNUNET_OK ==
- TALER_amount_add (&total_bad_amount_out_plus,
- &total_bad_amount_out_plus,
- &roi->details.amount));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_add (&total_bad_amount_out_plus,
+ &total_bad_amount_out_plus,
+ &roi->details.amount));
return GNUNET_OK;
}
@@ -1350,10 +1350,10 @@ history_debit_cb (void *cls,
GNUNET_asprintf (&diagnostic,
"duplicate subject hash `%s'",
TALER_B2S (&roi->subject_hash));
- GNUNET_break (GNUNET_OK ==
- TALER_amount_add (&total_wire_format_amount,
- &total_wire_format_amount,
- &details->amount));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_add (&total_wire_format_amount,
+ &total_wire_format_amount,
+ &details->amount));
TALER_ARL_report (report_wire_format_inconsistencies,
json_pack ("{s:o, s:I, s:s}",
"amount", TALER_JSON_from_amount (
@@ -1540,10 +1540,10 @@ complain_in_not_found (void *cls,
"account", wa->section_name,
"diagnostic",
"incoming wire transfer claimed by exchange not found"));
- GNUNET_break (GNUNET_OK ==
- TALER_amount_add (&total_bad_amount_in_minus,
- &total_bad_amount_in_minus,
- &rii->details.amount));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_add (&total_bad_amount_in_minus,
+ &total_bad_amount_in_minus,
+ &rii->details.amount));
return GNUNET_OK;
}
@@ -1653,10 +1653,10 @@ history_credit_cb (void *cls,
"timestamp", TALER_ARL_json_from_time_abs (
rii->details.execution_date),
"diagnostic", "wire subject does not match"));
- GNUNET_break (GNUNET_OK ==
- TALER_amount_add (&total_bad_amount_in_minus,
- &total_bad_amount_in_minus,
- &rii->details.amount));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_add (&total_bad_amount_in_minus,
+ &total_bad_amount_in_minus,
+ &rii->details.amount));
TALER_ARL_report (report_reserve_in_inconsistencies,
json_pack ("{s:I, s:I, s:o, s:o, s:o, s:o, s:s}",
"row", (json_int_t) rii->rowid,
@@ -1672,10 +1672,10 @@ history_credit_cb (void *cls,
details->execution_date),
"diagnostic", "wire subject does not match"));
- GNUNET_break (GNUNET_OK ==
- TALER_amount_add (&total_bad_amount_in_plus,
- &total_bad_amount_in_plus,
- &details->amount));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_add (&total_bad_amount_in_plus,
+ &total_bad_amount_in_plus,
+ &details->amount));
goto cleanup;
}
if (0 != TALER_amount_cmp (&rii->details.amount,
@@ -1701,28 +1701,28 @@ history_credit_cb (void *cls,
/* details->amount > rii->details.amount: wire transfer was larger than it should have been */
struct TALER_Amount delta;
- GNUNET_break (GNUNET_OK ==
- TALER_amount_subtract (&delta,
- &details->amount,
- &rii->details.amount));
- GNUNET_break (GNUNET_OK ==
- TALER_amount_add (&total_bad_amount_in_plus,
- &total_bad_amount_in_plus,
- &delta));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_subtract (&delta,
+ &details->amount,
+ &rii->details.amount));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_add (&total_bad_amount_in_plus,
+ &total_bad_amount_in_plus,
+ &delta));
}
else
{
/* rii->details.amount < details->amount: wire transfer was smaller than it should have been */
struct TALER_Amount delta;
- GNUNET_break (GNUNET_OK ==
- TALER_amount_subtract (&delta,
- &rii->details.amount,
- &details->amount));
- GNUNET_break (GNUNET_OK ==
- TALER_amount_add (&total_bad_amount_in_minus,
- &total_bad_amount_in_minus,
- &delta));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_subtract (&delta,
+ &rii->details.amount,
+ &details->amount));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_add (&total_bad_amount_in_minus,
+ &total_bad_amount_in_minus,
+ &delta));
}
goto cleanup;
}
@@ -1737,10 +1737,10 @@ history_credit_cb (void *cls,
"bank_row", (json_int_t) row_off,
"reserve_pub", GNUNET_JSON_from_data_auto (
&rii->details.reserve_pub)));
- GNUNET_break (GNUNET_OK ==
- TALER_amount_add (&total_missattribution_in,
- &total_missattribution_in,
- &rii->details.amount));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_add (&total_missattribution_in,
+ &total_missattribution_in,
+ &rii->details.amount));
}
if (details->execution_date.abs_value_us !=
rii->details.execution_date.abs_value_us)