diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-03-23 21:00:08 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-03-23 21:00:08 +0100 |
commit | 0ff8ec8da93cdef145aee4339b357048af95c9eb (patch) | |
tree | 7242ea43690f38667e2cf16354bd4daae5791d3b | |
parent | bab34d15fcca985ea5597d2baabac1d4179c5777 (diff) |
fix comments and handling of revocations in coins auditor
-rw-r--r-- | src/auditor/report-lib.c | 8 | ||||
-rw-r--r-- | src/auditor/report-lib.h | 14 | ||||
-rw-r--r-- | src/auditor/taler-helper-auditor-coins.c | 65 | ||||
-rw-r--r-- | src/auditor/taler-helper-auditor-deposits.c | 4 | ||||
-rw-r--r-- | src/auditor/taler-helper-auditor-wire.c | 4 |
5 files changed, 46 insertions, 49 deletions
diff --git a/src/auditor/report-lib.c b/src/auditor/report-lib.c index 25a79c1b6..6baf6e8b5 100644 --- a/src/auditor/report-lib.c +++ b/src/auditor/report-lib.c @@ -27,12 +27,12 @@ struct TALER_EXCHANGEDB_Plugin *TALER_ARL_edb; /** - * Which TALER_ARL_currency are we doing the audit for? + * Which currency are we doing the audit for? */ char *TALER_ARL_currency; /** - * How many fractional digits does the TALER_ARL_currency use? + * How many fractional digits does the currency use? */ struct TALER_Amount TALER_ARL_currency_round_unit; @@ -103,9 +103,9 @@ TALER_ARL_json_from_time_abs (struct GNUNET_TIME_Absolute at) /** - * Add @a object to the TALER_ARL_report @a array. Fail hard if this fails. + * Add @a object to the report @a array. Fail hard if this fails. * - * @param array TALER_ARL_report array to append @a object to + * @param array report array to append @a object to * @param object object to append, should be check that it is not NULL */ void diff --git a/src/auditor/report-lib.h b/src/auditor/report-lib.h index fa634cf83..8176e740b 100644 --- a/src/auditor/report-lib.h +++ b/src/auditor/report-lib.h @@ -30,7 +30,7 @@ /** - * Command-line option "-r": TALER_ARL_restart audit from scratch + * Command-line option "-r": restart audit from scratch */ extern int TALER_ARL_restart; @@ -40,12 +40,12 @@ extern int TALER_ARL_restart; extern struct TALER_EXCHANGEDB_Plugin *TALER_ARL_edb; /** - * Which TALER_ARL_currency are we doing the audit for? + * Which currency are we doing the audit for? */ extern char *TALER_ARL_currency; /** - * How many fractional digits does the TALER_ARL_currency use? + * How many fractional digits does the currency use? */ extern struct TALER_Amount TALER_ARL_currency_round_unit; @@ -101,9 +101,9 @@ TALER_ARL_json_from_time_abs (struct GNUNET_TIME_Absolute at); /** - * Add @a object to the TALER_ARL_report @a array. Fail hard if this fails. + * Add @a object to the report @a array. Fail hard if this fails. * - * @param array TALER_ARL_report array to append @a object to + * @param array report array to append @a object to * @param object object to append, should be check that it is not NULL */ void @@ -117,7 +117,7 @@ TALER_ARL_report (json_t *array, * @param dh hash of the denomination public key to look up * @param[out] issue set to detailed information about @a denom_pub, NULL if not found, must * NOT be freed by caller - * @return TALER_ARL_transaction status code + * @return transaction status code */ enum GNUNET_DB_QueryStatus TALER_ARL_get_denomination_info_by_hash ( @@ -132,7 +132,7 @@ TALER_ARL_get_denomination_info_by_hash ( * @param[out] issue set to detailed information about @a denom_pub, NULL if not found, must * NOT be freed by caller * @param[out] dh set to the hash of @a denom_pub, may be NULL - * @return TALER_ARL_transaction status code + * @return transaction status code */ enum GNUNET_DB_QueryStatus TALER_ARL_get_denomination_info ( diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c index c58dbc721..9a6b1d7cc 100644 --- a/src/auditor/taler-helper-auditor-coins.c +++ b/src/auditor/taler-helper-auditor-coins.c @@ -61,19 +61,19 @@ static struct TALER_AUDITORDB_ProgressPointCoin ppc; static struct TALER_AUDITORDB_ProgressPointCoin ppc_start; /** - * Array of TALER_ARL_reports about denomination keys with an + * Array of reports about denomination keys with an * emergency (more value deposited than withdrawn) */ static json_t *report_emergencies; /** - * Array of TALER_ARL_reports about denomination keys with an + * Array of reports about denomination keys with an * emergency (more coins deposited than withdrawn) */ static json_t *report_emergencies_by_count; /** - * Array of TALER_ARL_reports about row inconsitencies. + * Array of reports about row inconsitencies. */ static json_t *report_row_inconsistencies; @@ -149,7 +149,7 @@ static struct TALER_Amount total_melt_fee_income; static struct TALER_Amount total_refund_fee_income; /** - * Array of TALER_ARL_reports about coin operations with bad signatures. + * Array of reports about coin operations with bad signatures. */ static json_t *report_bad_sig_losses; @@ -409,7 +409,8 @@ struct DenominationSummary int in_db; /** - * Should we TALER_ARL_report an emergency for this denomination? + * Should we report an emergency for this denomination, causing it to be + * revoked (because more coins were deposited than issued)? */ int report_emergency; @@ -432,11 +433,6 @@ struct CoinContext struct GNUNET_CONTAINER_MultiHashMap *denom_summaries; /** - * Current write/replace offset in the circular @e summaries buffer. - */ - unsigned int summaries_off; - - /** * Transaction status code. */ enum GNUNET_DB_QueryStatus qs; @@ -475,12 +471,27 @@ init_denomination (const struct GNUNET_HashCode *denom_hash, if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs) { ds->in_db = GNUNET_YES; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Starting balance for denomination `%s' is %s\n", - GNUNET_h2s (denom_hash), - TALER_amount2s (&ds->denom_balance)); - return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT; } + else + { + GNUNET_assert (GNUNET_OK == + TALER_amount_get_zero (TALER_ARL_currency, + &ds->denom_balance)); + GNUNET_assert (GNUNET_OK == + TALER_amount_get_zero (TALER_ARL_currency, + &ds->denom_loss)); + GNUNET_assert (GNUNET_OK == + TALER_amount_get_zero (TALER_ARL_currency, + &ds->denom_risk)); + GNUNET_assert (GNUNET_OK == + TALER_amount_get_zero (TALER_ARL_currency, + &ds->denom_recoup)); + } + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Starting balance for denomination `%s' is %s (%llu)\n", + GNUNET_h2s (denom_hash), + TALER_amount2s (&ds->denom_balance), + (unsigned long long) ds->num_issued); qs = TALER_ARL_edb->get_denomination_revocation (TALER_ARL_edb->cls, TALER_ARL_esession, denom_hash, @@ -508,7 +519,7 @@ init_denomination (const struct GNUNET_HashCode *denom_hash, &msig.eddsa_signature, &TALER_ARL_master_pub.eddsa_pub)) { - report_row_inconsistency ("denomination revocation table", + report_row_inconsistency ("denomination revocations", rowid, "revocation signature invalid"); } @@ -517,23 +528,9 @@ init_denomination (const struct GNUNET_HashCode *denom_hash, ds->was_revoked = GNUNET_YES; } } - GNUNET_assert (GNUNET_OK == - TALER_amount_get_zero (TALER_ARL_currency, - &ds->denom_balance)); - GNUNET_assert (GNUNET_OK == - TALER_amount_get_zero (TALER_ARL_currency, - &ds->denom_loss)); - GNUNET_assert (GNUNET_OK == - TALER_amount_get_zero (TALER_ARL_currency, - &ds->denom_risk)); - GNUNET_assert (GNUNET_OK == - TALER_amount_get_zero (TALER_ARL_currency, - &ds->denom_recoup)); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Starting balance for denomination `%s' is %s\n", - GNUNET_h2s (denom_hash), - TALER_amount2s (&ds->denom_balance)); - return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT; + return (GNUNET_YES == ds->in_db) + ? GNUNET_DB_STATUS_SUCCESS_ONE_RESULT + : GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; } @@ -576,7 +573,7 @@ get_denomination_summary (struct CoinContext *cc, /** * Write information about the current knowledge about a denomination key - * back to the database and update our global TALER_ARL_reporting data about the + * back to the database and update our global reporting data about the * denomination. Also remove and free the memory of @a value. * * @param cls the `struct CoinContext` diff --git a/src/auditor/taler-helper-auditor-deposits.c b/src/auditor/taler-helper-auditor-deposits.c index 7d374ec77..1b6a46f1d 100644 --- a/src/auditor/taler-helper-auditor-deposits.c +++ b/src/auditor/taler-helper-auditor-deposits.c @@ -37,7 +37,7 @@ static int global_ret; /** - * Array of TALER_ARL_reports about missing deposit confirmations. + * Array of reports about missing deposit confirmations. */ static json_t *report_deposit_confirmation_inconsistencies; @@ -155,7 +155,7 @@ test_dc (void *cls, /** - * Check that the deposit-confirmations that were TALER_ARL_reported to + * Check that the deposit-confirmations that were reported to * us by merchants are also in the exchange's database. * * @param cls closure diff --git a/src/auditor/taler-helper-auditor-wire.c b/src/auditor/taler-helper-auditor-wire.c index 4808ed74e..f074e5a1a 100644 --- a/src/auditor/taler-helper-auditor-wire.c +++ b/src/auditor/taler-helper-auditor-wire.c @@ -300,7 +300,7 @@ static struct TALER_Amount total_closure_amount_lag; static struct TALER_Amount total_wire_format_amount; /** - * Amount of zero in our TALER_ARL_currency. + * Amount of zero in our currency. */ static struct TALER_Amount zero; @@ -912,7 +912,7 @@ conclude_wire_out (void) /** * Check that @a want is within #TIME_TOLERANCE of @a have. - * Otherwise TALER_ARL_report an inconsistency in row @a rowid of @a table. + * Otherwise report an inconsistency in row @a rowid of @a table. * * @param table where is the inconsistency (if any) * @param rowid what is the row |