fix comments and handling of revocations in coins auditor

This commit is contained in:
Christian Grothoff 2020-03-23 21:00:08 +01:00
parent bab34d15fc
commit 0ff8ec8da9
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
5 changed files with 46 additions and 49 deletions

View File

@ -27,12 +27,12 @@
struct TALER_EXCHANGEDB_Plugin *TALER_ARL_edb; 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; 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; 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 * @param object object to append, should be check that it is not NULL
*/ */
void void

View File

@ -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; extern int TALER_ARL_restart;
@ -40,12 +40,12 @@ extern int TALER_ARL_restart;
extern struct TALER_EXCHANGEDB_Plugin *TALER_ARL_edb; 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; 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; 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 * @param object object to append, should be check that it is not NULL
*/ */
void void
@ -117,7 +117,7 @@ TALER_ARL_report (json_t *array,
* @param dh hash of the denomination public key to look up * @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 * @param[out] issue set to detailed information about @a denom_pub, NULL if not found, must
* NOT be freed by caller * NOT be freed by caller
* @return TALER_ARL_transaction status code * @return transaction status code
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TALER_ARL_get_denomination_info_by_hash ( 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 * @param[out] issue set to detailed information about @a denom_pub, NULL if not found, must
* NOT be freed by caller * NOT be freed by caller
* @param[out] dh set to the hash of @a denom_pub, may be NULL * @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 enum GNUNET_DB_QueryStatus
TALER_ARL_get_denomination_info ( TALER_ARL_get_denomination_info (

View File

@ -61,19 +61,19 @@ static struct TALER_AUDITORDB_ProgressPointCoin ppc;
static struct TALER_AUDITORDB_ProgressPointCoin ppc_start; 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) * emergency (more value deposited than withdrawn)
*/ */
static json_t *report_emergencies; 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) * emergency (more coins deposited than withdrawn)
*/ */
static json_t *report_emergencies_by_count; 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; 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; 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; static json_t *report_bad_sig_losses;
@ -409,7 +409,8 @@ struct DenominationSummary
int in_db; 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; int report_emergency;
@ -431,11 +432,6 @@ struct CoinContext
*/ */
struct GNUNET_CONTAINER_MultiHashMap *denom_summaries; struct GNUNET_CONTAINER_MultiHashMap *denom_summaries;
/**
* Current write/replace offset in the circular @e summaries buffer.
*/
unsigned int summaries_off;
/** /**
* Transaction status code. * Transaction status code.
*/ */
@ -475,12 +471,27 @@ init_denomination (const struct GNUNET_HashCode *denom_hash,
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs) if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
{ {
ds->in_db = GNUNET_YES; 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, qs = TALER_ARL_edb->get_denomination_revocation (TALER_ARL_edb->cls,
TALER_ARL_esession, TALER_ARL_esession,
denom_hash, denom_hash,
@ -508,7 +519,7 @@ init_denomination (const struct GNUNET_HashCode *denom_hash,
&msig.eddsa_signature, &msig.eddsa_signature,
&TALER_ARL_master_pub.eddsa_pub)) &TALER_ARL_master_pub.eddsa_pub))
{ {
report_row_inconsistency ("denomination revocation table", report_row_inconsistency ("denomination revocations",
rowid, rowid,
"revocation signature invalid"); "revocation signature invalid");
} }
@ -517,23 +528,9 @@ init_denomination (const struct GNUNET_HashCode *denom_hash,
ds->was_revoked = GNUNET_YES; ds->was_revoked = GNUNET_YES;
} }
} }
GNUNET_assert (GNUNET_OK == return (GNUNET_YES == ds->in_db)
TALER_amount_get_zero (TALER_ARL_currency, ? GNUNET_DB_STATUS_SUCCESS_ONE_RESULT
&ds->denom_balance)); : GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
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;
} }
@ -576,7 +573,7 @@ get_denomination_summary (struct CoinContext *cc,
/** /**
* Write information about the current knowledge about a denomination key * 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. * denomination. Also remove and free the memory of @a value.
* *
* @param cls the `struct CoinContext` * @param cls the `struct CoinContext`

View File

@ -37,7 +37,7 @@
static int global_ret; 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; 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. * us by merchants are also in the exchange's database.
* *
* @param cls closure * @param cls closure

View File

@ -300,7 +300,7 @@ static struct TALER_Amount total_closure_amount_lag;
static struct TALER_Amount total_wire_format_amount; 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; static struct TALER_Amount zero;
@ -912,7 +912,7 @@ conclude_wire_out (void)
/** /**
* Check that @a want is within #TIME_TOLERANCE of @a have. * 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 table where is the inconsistency (if any)
* @param rowid what is the row * @param rowid what is the row