summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-12-24 16:04:30 +0100
committerChristian Grothoff <christian@grothoff.org>2019-12-24 16:04:30 +0100
commit1970b7687c5f64a7b6b2f1de69c6d62e78d7b4e1 (patch)
tree0fa0b80bf66ba16f165ffb72339b7bfdd036df6c
parent32ec655418efc922f525ac6bce473238425a123b (diff)
downloadexchange-1970b7687c5f64a7b6b2f1de69c6d62e78d7b4e1.tar.gz
exchange-1970b7687c5f64a7b6b2f1de69c6d62e78d7b4e1.tar.bz2
exchange-1970b7687c5f64a7b6b2f1de69c6d62e78d7b4e1.zip
report cases of missing denomination keys more nicely
-rw-r--r--src/auditor/taler-auditor.c54
1 files changed, 51 insertions, 3 deletions
diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c
index 5c28daa0..99c62113 100644
--- a/src/auditor/taler-auditor.c
+++ b/src/auditor/taler-auditor.c
@@ -3596,10 +3596,17 @@ withdraw_cb (void *cls,
qs = get_denomination_info (denom_pub,
&issue,
&dh);
+ if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
+ {
+ report_row_inconsistency ("withdraw",
+ rowid,
+ "denomination key not found (foreign key constraint violated)");
+ cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
+ return GNUNET_OK;
+ }
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
- /* The key not existing should be prevented by foreign key constraints,
- so must be a transient DB error. */
+ /* This really ought to be a transient DB error. */
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
cc->qs = qs;
return GNUNET_SYSERR;
@@ -3803,6 +3810,14 @@ refresh_session_cb (void *cls,
qs = get_denomination_info (denom_pub,
&issue,
NULL);
+ if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
+ {
+ report_row_inconsistency ("refresh_melt",
+ rowid,
+ "denomination key not found (foreign key constraint violated)");
+ cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
+ return GNUNET_OK;
+ }
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -3904,7 +3919,15 @@ refresh_session_cb (void *cls,
qs = get_denomination_info (&reveal_ctx.new_dps[i],
&new_issues[i],
NULL);
- if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
+ if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
+ {
+ report_row_inconsistency ("refresh_reveal",
+ rowid,
+ "denomination key not found (foreign key constraint violated)");
+ cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
+ err = GNUNET_YES;
+ }
+ else if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
cc->qs = qs;
@@ -4164,6 +4187,15 @@ deposit_cb (void *cls,
qs = get_denomination_info (denom_pub,
&issue,
NULL);
+ if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
+ {
+ report_row_inconsistency ("deposits",
+ rowid,
+ "denomination key not found (foreign key constraint violated)");
+ cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
+ return GNUNET_SYSERR;
+ }
+
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -4339,6 +4371,14 @@ refund_cb (void *cls,
qs = get_denomination_info (denom_pub,
&issue,
NULL);
+ if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
+ {
+ report_row_inconsistency ("refunds",
+ rowid,
+ "denomination key not found (foreign key constraint violated)");
+ cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
+ return GNUNET_SYSERR;
+ }
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -4507,6 +4547,14 @@ check_payback (struct CoinContext *cc,
qs = get_denomination_info (denom_pub,
&issue,
&pr.h_denom_pub);
+ if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
+ {
+ report_row_inconsistency ("payback",
+ rowid,
+ "denomination key not found (foreign key constraint violated)");
+ cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
+ return GNUNET_SYSERR;
+ }
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
/* The key not existing should be prevented by foreign key constraints,