aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-10-30 06:03:07 +0100
committerChristian Grothoff <christian@grothoff.org>2024-10-30 06:03:07 +0100
commit115863512e6ca7a32d1ee903afac7b7fa8d994c6 (patch)
tree08001b906ff92efe33b9c5975c1ca0f4815815f0
parentd737699d80fe3d76b0c43b55c9b0e719bc9b3043 (diff)
fix test #25
-rw-r--r--src/auditor/taler-helper-auditor-aggregation.c3
-rwxr-xr-xsrc/auditor/test-auditor.sh56
-rw-r--r--src/auditordb/pg_insert_coin_inconsistency.c3
-rw-r--r--src/exchangedb/pg_get_coin_transactions.c2
4 files changed, 27 insertions, 37 deletions
diff --git a/src/auditor/taler-helper-auditor-aggregation.c b/src/auditor/taler-helper-auditor-aggregation.c
index fcb9491c3..3066d85a7 100644
--- a/src/auditor/taler-helper-auditor-aggregation.c
+++ b/src/auditor/taler-helper-auditor-aggregation.c
@@ -1418,6 +1418,7 @@ analyze_aggregations (void *cls)
TALER_ARL_GET_AB (aggregation_total_wire_out_delta_plus),
TALER_ARL_GET_AB (aggregation_total_wire_out_delta_minus),
TALER_ARL_GET_AB (aggregation_total_coin_delta_plus),
+ TALER_ARL_GET_AB (aggregation_total_coin_delta_minus),
NULL);
if (0 > qs)
{
@@ -1468,6 +1469,7 @@ analyze_aggregations (void *cls)
TALER_ARL_SET_AB (aggregation_total_wire_out_delta_plus),
TALER_ARL_SET_AB (aggregation_total_wire_out_delta_minus),
TALER_ARL_SET_AB (aggregation_total_coin_delta_plus),
+ TALER_ARL_SET_AB (aggregation_total_coin_delta_minus),
NULL);
if (0 > qs)
{
@@ -1485,6 +1487,7 @@ analyze_aggregations (void *cls)
TALER_ARL_SET_AB (aggregation_total_wire_out_delta_plus),
TALER_ARL_SET_AB (aggregation_total_wire_out_delta_minus),
TALER_ARL_SET_AB (aggregation_total_coin_delta_plus),
+ TALER_ARL_SET_AB (aggregation_total_coin_delta_minus),
NULL);
if (0 > qs)
{
diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh
index 191d1d0e8..5382a9c7b 100755
--- a/src/auditor/test-auditor.sh
+++ b/src/auditor/test-auditor.sh
@@ -1704,12 +1704,12 @@ function test_24() {
# Test for inconsistent coin history.
-# FIXME: test-25 not implemented
function test_25() {
echo "=========25: inconsistent coin history========="
# Drop refund, so coin history is bogus.
+ echo -n "Dropping refund from DB... "
echo "DELETE FROM exchange.refunds WHERE refund_serial_id=1;" \
| psql -At "$DB"
@@ -1717,39 +1717,27 @@ function test_25() {
check_auditor_running
echo -n "Testing inconsistency detection... "
-
- call_endpoint "coin-inconsistency"
- call_endpoint "emergency"
- call_endpoint "balances" "coins_reported_emergency_risk_by_amount"
-
-#TODO: doesn't find any
- #jq -e .coin_inconsistency[0] \
- # < "${MY_TMP_DIR}/coin-inconsistency.json" \
- # > /dev/null \
- # || exit_fail "Coin inconsistency NOT detected"
-
- # Note: if the wallet withdrew much more than it spent, this might indeed
- # go legitimately unnoticed.
- #jq -e .emergency[0] \
- # < "${MY_TMP_DIR}/emergency.json" \
- # > /dev/null \
- # || exit_fail "Denomination value emergency NOT reported"
-#TODO: find's only wrong amount
- call_endpoint "balances" "aggregation_total_coin_delta_minus"
- #AMOUNT=$(jq -er .balances[0].balance_value < "${MY_TMP_DIR}/aggregation_total_coin_delta_minus.json")
- #if [ "$AMOUNT" = "TESTKUDOS:0" ]
- #then
- # exit_fail "Expected non-zero total inconsistency amount from coins"
- #fi
- # Note: if the wallet withdrew much more than it spent, this might indeed
- # go legitimately unnoticed.
- #COUNT=$(jq -er .balances[0].balance_value < "${MY_TMP_DIR}/coins_reported_emergency_risk_by_amount.json")
- #if [ "$COUNT" = "TESTKUDOS:0" ]
- #then
- # exit_fail "Expected non-zero emergency-by-amount"
- #fi
- #echo "PASS"
-
+ check_report \
+ "coin-inconsistency" \
+ "profitable" "true"
+ echo -n "Testing emergency risk reporting... "
+ check_report \
+ "emergency" \
+ "denom_risk" "TESTKUDOS:10"
+ echo -n "Testing emergency loss reporting... "
+ check_report \
+ "emergency" \
+ "denom_loss" "TESTKUDOS:5.98"
+ echo -n "Testing double-spending reporting... "
+ check_balance \
+ "coins_reported_emergency_risk_by_amount" \
+ "TESTKUDOS:10" \
+ "double-spending not detected"
+ echo -n "Testing balance loss update... "
+ check_balance \
+ "aggregation_total_coin_delta_minus" \
+ "TESTKUDOS:5.98" \
+ "aggregation total coin delta minus not reported"
# cannot easily undo DELETE, hence full reload
full_reload
}
diff --git a/src/auditordb/pg_insert_coin_inconsistency.c b/src/auditordb/pg_insert_coin_inconsistency.c
index 70d105175..2fcf7f498 100644
--- a/src/auditordb/pg_insert_coin_inconsistency.c
+++ b/src/auditordb/pg_insert_coin_inconsistency.c
@@ -40,12 +40,11 @@ TAH_PG_insert_coin_inconsistency (
"auditor_coin_inconsistency_insert",
"INSERT INTO auditor_coin_inconsistency "
"(operation"
- ",problem_row_id"
",exchange_amount"
",auditor_amount"
",coin_pub"
",profitable"
- ") VALUES ($1,$2,$3,$4,$5,$6)"
+ ") VALUES ($1,$2,$3,$4,$5)"
);
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"auditor_coin_inconsistency_insert",
diff --git a/src/exchangedb/pg_get_coin_transactions.c b/src/exchangedb/pg_get_coin_transactions.c
index 5a9157dcd..2abdb1e0d 100644
--- a/src/exchangedb/pg_get_coin_transactions.c
+++ b/src/exchangedb/pg_get_coin_transactions.c
@@ -786,7 +786,7 @@ handle_history_entry (void *cls,
(int) qs,
(unsigned long long) serial_id,
table_name);
- if (0 >= qs)
+ if (0 > qs)
chc->failed = true;
break;
}