diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-02-23 19:55:21 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-02-23 19:55:21 +0100 |
commit | 65434a0e006c45b609c4a724aa192a0d08546cd0 (patch) | |
tree | 198ad8346a2837218b1a9402fe0220057d3866f1 /src | |
parent | 919861aea831ebba8fc039a8a529a10d841aa148 (diff) | |
download | exchange-65434a0e006c45b609c4a724aa192a0d08546cd0.tar.xz |
fix return value in auditor logic, and check it as well; adding FIXME to mark improperly handled case
Diffstat (limited to 'src')
-rw-r--r-- | src/auditor/taler-auditor.c | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c index 0ec5e2d75..0786ec0e1 100644 --- a/src/auditor/taler-auditor.c +++ b/src/auditor/taler-auditor.c @@ -2572,14 +2572,14 @@ wire_transfer_information_cb (void *cls, &issue); if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs) { - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); GNUNET_CRYPTO_rsa_signature_free (coin.denom_sig.rsa_signature); edb->free_coin_transaction_list (edb->cls, tl); wcc->qs = qs; - report_row_inconsistency ("aggregation", - rowid, - "could not find denomination key for coin claimed in aggregation"); + if (0 == qs) + report_row_inconsistency ("aggregation", + rowid, + "could not find denomination key for coin claimed in aggregation"); return; } if (GNUNET_OK != @@ -2933,6 +2933,7 @@ check_wire_out_cb (void *cls, &final_amount)) { GNUNET_break (0); + // FIXME: we should report an arithmetic error here! ac->qs = GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_SYSERR; } @@ -3068,6 +3069,11 @@ analyze_aggregations (void *cls) wfi); GNUNET_free (wfi); } + if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) + { + /* there were no wire out entries to be looked at, we are done */ + return qs; + } if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != ac.qs) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == ac.qs); @@ -5132,14 +5138,25 @@ transact (Analysis analysis, else { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Processing failed, rolling back transaction\n"); + "Processing failed (or no changes), rolling back transaction\n"); adb->rollback (adb->cls, asession); edb->rollback (edb->cls, esession); } clear_transaction_state_cache (); - return qs; + switch (qs) + { + case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: + return GNUNET_OK; + case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: + return GNUNET_OK; + case GNUNET_DB_STATUS_SOFT_ERROR: + return GNUNET_NO; + case GNUNET_DB_STATUS_HARD_ERROR: + return GNUNET_SYSERR; + } + return GNUNET_OK; } @@ -5166,14 +5183,18 @@ setup_sessions_and_run () return; } - transact (&analyze_reserves, - NULL); - transact (&analyze_aggregations, - NULL); - transact (&analyze_coins, - NULL); - transact (&analyze_deposit_confirmations, - NULL); + GNUNET_break (GNUNET_SYSERR != + transact (&analyze_reserves, + NULL)); + GNUNET_break (GNUNET_SYSERR != + transact (&analyze_aggregations, + NULL)); + GNUNET_break (GNUNET_SYSERR != + transact (&analyze_coins, + NULL)); + GNUNET_break (GNUNET_SYSERR != + transact (&analyze_deposit_confirmations, + NULL)); } |