add -i option to taler-auditor
This commit is contained in:
parent
73a9fe56eb
commit
40551fa08e
@ -116,6 +116,11 @@ static json_t *report_bad_sig_losses;
|
||||
*/
|
||||
static struct TALER_Amount total_bad_sig_loss;
|
||||
|
||||
/**
|
||||
* Should we run checks that only work for exchange-internal audits?
|
||||
*/
|
||||
static int internal_checks;
|
||||
|
||||
|
||||
/**
|
||||
* Report a (serious) inconsistency in the exchange's database with
|
||||
@ -1462,6 +1467,10 @@ main (int argc,
|
||||
char *const *argv)
|
||||
{
|
||||
const struct GNUNET_GETOPT_CommandLineOption options[] = {
|
||||
GNUNET_GETOPT_option_flag ('i',
|
||||
"internal",
|
||||
"perform checks only applicable for exchange-internal audits",
|
||||
&internal_checks),
|
||||
GNUNET_GETOPT_option_base32_auto ('m',
|
||||
"exchange-key",
|
||||
"KEY",
|
||||
|
@ -193,6 +193,11 @@ struct CoinHistory
|
||||
*/
|
||||
static struct CoinHistory coin_histories[MAX_COIN_HISTORIES];
|
||||
|
||||
/**
|
||||
* Should we run checks that only work for exchange-internal audits?
|
||||
*/
|
||||
static int internal_checks;
|
||||
|
||||
|
||||
/**
|
||||
* Return the index we should use for @a coin_pub in #coin_histories.
|
||||
@ -2742,6 +2747,10 @@ main (int argc,
|
||||
char *const *argv)
|
||||
{
|
||||
const struct GNUNET_GETOPT_CommandLineOption options[] = {
|
||||
GNUNET_GETOPT_option_flag ('i',
|
||||
"internal",
|
||||
"perform checks only applicable for exchange-internal audits",
|
||||
&internal_checks),
|
||||
GNUNET_GETOPT_option_base32_auto ('m',
|
||||
"exchange-key",
|
||||
"KEY",
|
||||
|
@ -51,6 +51,10 @@ static json_int_t number_missed_deposit_confirmations;
|
||||
*/
|
||||
static struct TALER_Amount total_missed_deposit_confirmations;
|
||||
|
||||
/**
|
||||
* Should we run checks that only work for exchange-internal audits?
|
||||
*/
|
||||
static int internal_checks;
|
||||
|
||||
/**
|
||||
* Closure for #test_dc.
|
||||
@ -343,6 +347,10 @@ main (int argc,
|
||||
char *const *argv)
|
||||
{
|
||||
const struct GNUNET_GETOPT_CommandLineOption options[] = {
|
||||
GNUNET_GETOPT_option_flag ('i',
|
||||
"internal",
|
||||
"perform checks only applicable for exchange-internal audits",
|
||||
&internal_checks),
|
||||
GNUNET_GETOPT_option_base32_auto ('m',
|
||||
"exchange-key",
|
||||
"KEY",
|
||||
|
@ -142,6 +142,10 @@ static json_t *report_bad_sig_losses;
|
||||
*/
|
||||
static struct TALER_Amount total_bad_sig_loss;
|
||||
|
||||
/**
|
||||
* Should we run checks that only work for exchange-internal audits?
|
||||
*/
|
||||
static int internal_checks;
|
||||
|
||||
/* ***************************** Report logic **************************** */
|
||||
|
||||
@ -1660,6 +1664,10 @@ main (int argc,
|
||||
char *const *argv)
|
||||
{
|
||||
const struct GNUNET_GETOPT_CommandLineOption options[] = {
|
||||
GNUNET_GETOPT_option_flag ('i',
|
||||
"internal",
|
||||
"perform checks only applicable for exchange-internal audits",
|
||||
&internal_checks),
|
||||
GNUNET_GETOPT_option_base32_auto ('m',
|
||||
"exchange-key",
|
||||
"KEY",
|
||||
|
@ -314,6 +314,10 @@ static struct GNUNET_CURL_Context *ctx;
|
||||
*/
|
||||
static struct GNUNET_CURL_RescheduleContext *rc;
|
||||
|
||||
/**
|
||||
* Should we run checks that only work for exchange-internal audits?
|
||||
*/
|
||||
static int internal_checks;
|
||||
|
||||
/* ***************************** Shutdown **************************** */
|
||||
|
||||
@ -2166,6 +2170,10 @@ main (int argc,
|
||||
char *const *argv)
|
||||
{
|
||||
const struct GNUNET_GETOPT_CommandLineOption options[] = {
|
||||
GNUNET_GETOPT_option_flag ('i',
|
||||
"internal",
|
||||
"perform checks only applicable for exchange-internal audits",
|
||||
&internal_checks),
|
||||
GNUNET_GETOPT_option_base32_auto ('m',
|
||||
"exchange-key",
|
||||
"KEY",
|
||||
|
@ -98,17 +98,6 @@ ALTER TABLE reserves_close
|
||||
DROP COLUMN reserve_pub;
|
||||
|
||||
|
||||
-- "reserves" has no BIGSERIAL because it is a 'mutable' table
|
||||
-- the auditor recomputes these balances itself
|
||||
-- => verify_reserve_balance check only done for 'internal' auditor
|
||||
-- "deposits" is updated with 'tiny' and 'done' bits
|
||||
-- => those SHALL NOT to be used by the (external) auditor!
|
||||
-- "prewire" is updated with 'finished' and 'failed' bits, but
|
||||
-- those are of no concern for the auditor (prewire is not auditable!)
|
||||
-- "auditors" is updated with 'is_active' and 'last_change', but
|
||||
-- those are of no concern for the auditor
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS auditors
|
||||
(auditor_uuid BIGSERIAL UNIQUE
|
||||
,auditor_pub BYTEA PRIMARY KEY CHECK (LENGTH(auditor_pub)=32)
|
||||
|
@ -76,6 +76,73 @@ struct TALER_EXCHANGEDB_DenominationKeyInformationP
|
||||
GNUNET_NETWORK_STRUCT_END
|
||||
|
||||
|
||||
/**
|
||||
* Enumeration of all of the tables replicated by exchange-auditor
|
||||
* database replication.
|
||||
*/
|
||||
enum TALER_EXCHANGEDB_ReplicatedTable
|
||||
{
|
||||
|
||||
/**
|
||||
* The "denominations" table.
|
||||
*/
|
||||
TALER_EXCHANGEDB_RT_DENOMINATIONS,
|
||||
|
||||
// FIXME...
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Record of a single entry in a replicated table.
|
||||
*/
|
||||
struct TALER_EXCHANGEDB_TableData
|
||||
{
|
||||
/**
|
||||
* Data of which table is returned here?
|
||||
*/
|
||||
enum TALER_EXCHANGEDB_ReplicatedTable table;
|
||||
|
||||
/**
|
||||
* Serial number of the record.
|
||||
*/
|
||||
uint64_t serial;
|
||||
|
||||
/**
|
||||
* Table-specific details.
|
||||
*/
|
||||
union
|
||||
{
|
||||
|
||||
/**
|
||||
* Details from the 'denominations' table.
|
||||
*/
|
||||
struct
|
||||
{
|
||||
// FIXME...
|
||||
} denominations;
|
||||
|
||||
// FIXME...
|
||||
|
||||
} details;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Function called on data to replicate in the auditor's database.
|
||||
*
|
||||
* @param cls closure
|
||||
* @param td record from an exchange table
|
||||
* @return #GNUNET_OK to continue to iterate,
|
||||
* #GNUNET_SYSERR to fail with an error
|
||||
*/
|
||||
typedef int
|
||||
(*TALER_EXCHANGEDB_ReplicationCallback)(
|
||||
void *cls,
|
||||
const struct TALER_EXCHANGEDB_TableData *td);
|
||||
|
||||
|
||||
/**
|
||||
* @brief All information about a denomination key (which is used to
|
||||
* sign coins into existence).
|
||||
@ -3499,6 +3566,60 @@ struct TALER_EXCHANGEDB_Plugin
|
||||
struct TALER_Amount *closing_fee);
|
||||
|
||||
|
||||
/**
|
||||
* Lookup the latest serial number of @a table. Used in
|
||||
* exchange-auditor database replication.
|
||||
*
|
||||
* @param cls closure
|
||||
* @param session a session
|
||||
* @param table table for which we should return the serial
|
||||
* @param[out] latest serial number in use
|
||||
* @return transaction status code, GNUNET_DB_STATUS_HARD_ERROR if
|
||||
* @a table does not have a serial number
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
(*lookup_serial_by_table)(void *cls,
|
||||
struct TALER_EXCHANGEDB_Session *session,
|
||||
enum TALER_EXCHANGEDB_ReplicatedTable table,
|
||||
uint64_t *serial);
|
||||
|
||||
/**
|
||||
* Lookup records above @a serial number in @a table. Used in
|
||||
* exchange-auditor database replication.
|
||||
*
|
||||
* @param cls closure
|
||||
* @param session a session
|
||||
* @param table table for which we should return the serial
|
||||
* @param serial largest serial number to exclude
|
||||
* @param cb function to call on the records
|
||||
* @param cb_cls closure for @a cb
|
||||
* @return transaction status code, GNUNET_DB_STATUS_HARD_ERROR if
|
||||
* @a table does not have a serial number
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
(*lookup_records_by_table)(void *cls,
|
||||
struct TALER_EXCHANGEDB_Session *session,
|
||||
enum TALER_EXCHANGEDB_ReplicatedTable table,
|
||||
uint64_t serial,
|
||||
TALER_EXCHANGEDB_ReplicationCallback cb,
|
||||
void *cb_cls);
|
||||
|
||||
|
||||
/**
|
||||
* Insert record set into @a table. Used in exchange-auditor database
|
||||
* replication.
|
||||
*
|
||||
* @param cls closure
|
||||
* @param session a session
|
||||
* @param tb table data to insert
|
||||
* @return transaction status code, GNUNET_DB_STATUS_HARD_ERROR if
|
||||
* @a table does not have a serial number
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
(*insert_records_by_table)(void *cls,
|
||||
struct TALER_EXCHANGEDB_Session *session,
|
||||
const struct TALER_EXCHANGEDB_TableData *td);
|
||||
|
||||
};
|
||||
|
||||
#endif /* _TALER_EXCHANGE_DB_H */
|
||||
|
Loading…
Reference in New Issue
Block a user