From 376de032b514b9f85f9b6ec3a8616aa418a2a413 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 15 Apr 2023 23:11:36 +0200 Subject: create warnings on missing table syncs --- src/exchangedb/pg_insert_records_by_table.c | 9 ++-- src/exchangedb/pg_lookup_records_by_table.c | 10 ++-- src/include/taler_exchangedb_plugin.h | 72 ++++++++++++++++++++++++++++- 3 files changed, 83 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/exchangedb/pg_insert_records_by_table.c b/src/exchangedb/pg_insert_records_by_table.c index d6630797a..1ccf41b42 100644 --- a/src/exchangedb/pg_insert_records_by_table.c +++ b/src/exchangedb/pg_insert_records_by_table.c @@ -1877,7 +1877,7 @@ TEH_PG_insert_records_by_table (void *cls, const struct TALER_EXCHANGEDB_TableData *td) { struct PostgresClosure *pg = cls; - InsertRecordCallback rh; + InsertRecordCallback rh = NULL; switch (td->table) { @@ -2007,7 +2007,10 @@ TEH_PG_insert_records_by_table (void *cls, case TALER_EXCHANGEDB_RT_PROFIT_DRAINS: rh = &irbt_cb_table_profit_drains; break; - default: + } + + if (NULL == rh) + { GNUNET_break (0); return GNUNET_DB_STATUS_HARD_ERROR; } @@ -2016,4 +2019,4 @@ TEH_PG_insert_records_by_table (void *cls, } -/* end of irbt_callbacks.c */ +/* end of pg_insert_records_by_table.c */ diff --git a/src/exchangedb/pg_lookup_records_by_table.c b/src/exchangedb/pg_lookup_records_by_table.c index 806896e78..aa9ab046d 100644 --- a/src/exchangedb/pg_lookup_records_by_table.c +++ b/src/exchangedb/pg_lookup_records_by_table.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet - Copyright (C) 2020, 2021, 2022 Taler Systems SA + Copyright (C) 2020-2023 Taler Systems SA GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -2321,8 +2321,8 @@ TEH_PG_lookup_records_by_table (void *cls, .cb = cb, .cb_cls = cb_cls }; - GNUNET_PQ_PostgresResultHandler rh; - const char *statement; + GNUNET_PQ_PostgresResultHandler rh = NULL; + const char *statement = NULL; enum GNUNET_DB_QueryStatus qs; switch (table) @@ -2885,7 +2885,9 @@ TEH_PG_lookup_records_by_table (void *cls, " ORDER BY profit_drain_serial_id ASC;"); rh = &lrbt_cb_table_profit_drains; break; - default: + } + if (NULL == rh) + { GNUNET_break (0); return GNUNET_DB_STATUS_HARD_ERROR; } diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index 32a18f638..1ed5ab585 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014-2022 Taler Systems SA + Copyright (C) 2014-2023 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -234,6 +234,7 @@ struct TALER_EXCHANGEDB_SignkeyMetaData */ enum TALER_EXCHANGEDB_ReplicatedTable { + /* From exchange-0002.sql: */ TALER_EXCHANGEDB_RT_DENOMINATIONS, TALER_EXCHANGEDB_RT_DENOMINATION_REVOCATIONS, TALER_EXCHANGEDB_RT_WIRE_TARGETS, @@ -276,6 +277,13 @@ enum TALER_EXCHANGEDB_ReplicatedTable TALER_EXCHANGEDB_RT_WADS_IN, TALER_EXCHANGEDB_RT_WADS_IN_ENTRIES, TALER_EXCHANGEDB_RT_PROFIT_DRAINS, + /* From exchange-0003.sql: */ + TALER_EXCHAGNEDB_RT_AML_STAFF, + TALER_EXCHAGNEDB_RT_AML_HISTORY, + TALER_EXCHAGNEDB_RT_KYC_ATTRIBUTES, + TALER_EXCHANGEDB_RT_PURSE_DELETION, + TALER_EXCHANGEDB_RT_WITHDRAW_AGE_COMMITMENTS, + TALER_EXCHANGEDB_RT_WITHDRAW_AGE_REVEALS, }; @@ -701,6 +709,67 @@ struct TALER_EXCHANGEDB_TableData struct TALER_MasterSignatureP master_sig; } profit_drains; + struct + { + struct TALER_AmlOfficerPublicKeyP decider_pub; + struct TALER_MasterSignatureP master_sig; + char *decider_name; + bool is_active; + bool read_only; + struct GNUNET_TIME_Timestamp last_change; + } aml_staff; + + struct + { + struct TALER_PaytoHashP h_payto; + struct TALER_Amount new_threshold; + enum TALER_AmlDecisionState new_status; + struct GNUNET_TIME_Timestamp decision_time; + char *justification; + char *kyc_requirements; /* NULL allowed! */ + uint64_t kyc_req_row; + struct TALER_AmlOfficerPublicKeyP decider_pub; + struct TALER_AmlOfficerSignatureP decider_sig; + } aml_history; + + struct + { + struct TALER_PaytoHashP h_payto; + struct GNUNET_ShortHashCode kyc_prox; + char *provider; + char *birthdate; /* NULL allowed! */ + struct GNUNET_TIME_Timestamp collection_time; + struct GNUNET_TIME_Timestamp expiration_time; + void *encrypted_attributes; + size_t encrypted_attributes_size; + } kyc_attributes; + + struct + { + struct TALER_PurseContractPublicKeyP purse_pub; + struct TALER_PurseContractSignatureP purse_sig; + } purse_deletion; + + struct + { + struct TALER_AgeWithdrawCommitmentHashP h_commitment; + struct TALER_Amount amount_with_fee; + uint16_t max_age; + struct TALER_ReservePublicKeyP reserve_pub; + struct TALER_ReserveSignatureP reserve_sig; + uint32_t noreveal_index; + struct GNUNET_TIME_Absolute timestamp; + } withdraw_age_commitments; + + struct + { + struct TALER_AgeWithdrawCommitmentHashP h_commitment; + // FIXME-Oec: h_commitment --- schema says it is 32 byte, but it was 64 above??!? + uint32_t freshcoin_index; + uint64_t denominations_serial; + // FIXME-Oec: h_coin_ev --- schema says it is 32 byte!? + } withdraw_age_reveals; + } details; }; @@ -1106,6 +1175,7 @@ struct TALER_EXCHANGEDB_AgeWithdrawCommitment /** * Maximum age that the coins are restricted to. + * FIXME-Oec: use 16-bit integer (see DB schema!) */ uint32_t max_age; -- cgit v1.2.3