From 3b9c3811122f1d28cfa23579669ce21ca9d211ce Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 15 Jan 2021 11:53:54 +0100 Subject: remove master_pub from DB --- src/exchangedb/exchange-0002.sql | 4 ++++ src/exchangedb/irbt_callbacks.c | 2 -- src/exchangedb/plugin_exchangedb_postgres.c | 30 ++++++++++++----------------- 3 files changed, 16 insertions(+), 20 deletions(-) (limited to 'src/exchangedb') diff --git a/src/exchangedb/exchange-0002.sql b/src/exchangedb/exchange-0002.sql index 9b66d4d18..b03a7b512 100644 --- a/src/exchangedb/exchange-0002.sql +++ b/src/exchangedb/exchange-0002.sql @@ -44,6 +44,10 @@ COMMENT ON INDEX prepare_get_index IS 'for wire_prepare_data_get'; +-- we do not actually need the master public key, it is always the same +ALTER TABLE denominations + DROP COLUMN master_pub; + -- need serial IDs on various tables for exchange-auditor replication ALTER TABLE denominations ADD COLUMN denominations_serial BIGSERIAL UNIQUE; diff --git a/src/exchangedb/irbt_callbacks.c b/src/exchangedb/irbt_callbacks.c index 5f6cf6d48..e0e19ef09 100644 --- a/src/exchangedb/irbt_callbacks.c +++ b/src/exchangedb/irbt_callbacks.c @@ -38,13 +38,11 @@ irbt_cb_table_denominations (struct PostgresClosure *pg, const struct TALER_EXCHANGEDB_TableData *td) { struct GNUNET_HashCode denom_hash; - static struct TALER_MasterPublicKeyP master_pub; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&td->serial), GNUNET_PQ_query_param_auto_from_type (&denom_hash), GNUNET_PQ_query_param_rsa_public_key ( td->details.denominations.denom_pub.rsa_public_key), - GNUNET_PQ_query_param_auto_from_type (&master_pub), // FIXME: !? GNUNET_PQ_query_param_auto_from_type ( &td->details.denominations.master_sig), TALER_PQ_query_param_absolute_time ( diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 856853279..f203e60f7 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -273,7 +273,6 @@ postgres_get_session (void *cls) "INSERT INTO denominations " "(denom_pub_hash" ",denom_pub" - ",master_pub" ",master_sig" ",valid_from" ",expire_withdraw" @@ -291,13 +290,12 @@ postgres_get_session (void *cls) ",fee_refund_frac" ") VALUES " "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10," - " $11, $12, $13, $14, $15, $16, $17, $18);", - 18), + " $11, $12, $13, $14, $15, $16, $17);", + 17), /* Used in #postgres_iterate_denomination_info() */ GNUNET_PQ_make_prepare ("denomination_iterate", "SELECT" - " master_pub" - ",master_sig" + " master_sig" ",valid_from" ",expire_withdraw" ",expire_deposit" @@ -379,8 +377,7 @@ postgres_get_session (void *cls) /* Used in #postgres_get_denomination_info() */ GNUNET_PQ_make_prepare ("denomination_get", "SELECT" - " master_pub" - ",master_sig" + " master_sig" ",valid_from" ",expire_withdraw" ",expire_deposit" @@ -2187,7 +2184,6 @@ postgres_get_session (void *cls) "(denominations_serial" ",denom_pub_hash" ",denom_pub" - ",master_pub" ",master_sig" ",valid_from" ",expire_withdraw" @@ -2205,8 +2201,8 @@ postgres_get_session (void *cls) ",fee_refund_frac" ") VALUES " "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10," - " $11, $12, $13, $14, $15, $16, $17, $18, $19);", - 19), + " $11, $12, $13, $14, $15, $16, $17, $18);", + 18), GNUNET_PQ_make_prepare ("insert_into_table_denomination_revocations", "INSERT INTO denomination_revocations" "(denom_revocations_serial_id" @@ -2642,7 +2638,6 @@ postgres_insert_denomination_info ( struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_auto_from_type (&issue->properties.denom_hash), GNUNET_PQ_query_param_rsa_public_key (denom_pub->rsa_public_key), - GNUNET_PQ_query_param_auto_from_type (&issue->properties.master), GNUNET_PQ_query_param_auto_from_type (&issue->signature), TALER_PQ_query_param_absolute_time_nbo (&issue->properties.start), TALER_PQ_query_param_absolute_time_nbo (&issue->properties.expire_withdraw), @@ -2700,8 +2695,6 @@ postgres_get_denomination_info ( GNUNET_PQ_query_param_end }; struct GNUNET_PQ_ResultSpec rs[] = { - GNUNET_PQ_result_spec_auto_from_type ("master_pub", - &issue->properties.master), GNUNET_PQ_result_spec_auto_from_type ("master_sig", &issue->signature), TALER_PQ_result_spec_absolute_time_nbo ("valid_from", @@ -2725,6 +2718,9 @@ postgres_get_denomination_info ( GNUNET_PQ_result_spec_end }; + memset (&issue->properties.master, + 0, + sizeof (issue->properties.master)); qs = GNUNET_PQ_eval_prepared_singleton_select (session->conn, "denomination_get", params, @@ -2783,8 +2779,6 @@ domination_cb_helper (void *cls, struct TALER_EXCHANGEDB_DenominationKeyInformationP issue; struct TALER_DenominationPublicKey denom_pub; struct GNUNET_PQ_ResultSpec rs[] = { - GNUNET_PQ_result_spec_auto_from_type ("master_pub", - &issue.properties.master), GNUNET_PQ_result_spec_auto_from_type ("master_sig", &issue.signature), TALER_PQ_result_spec_absolute_time_nbo ("valid_from", @@ -2810,6 +2804,9 @@ domination_cb_helper (void *cls, GNUNET_PQ_result_spec_end }; + memset (&issue.properties.master, + 0, + sizeof (issue.properties.master)); if (GNUNET_OK != GNUNET_PQ_extract_result (result, rs, @@ -9411,7 +9408,6 @@ postgres_lookup_denomination_key ( * @param h_denom_pub hash of the denomination public key * @param denom_pub the actual denomination key * @param meta meta data about the denomination - * @param master_pub master public key * @param master_sig master signature to add * @return transaction status code */ @@ -9422,14 +9418,12 @@ postgres_add_denomination_key ( const struct GNUNET_HashCode *h_denom_pub, const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta, - const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterSignatureP *master_sig) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam iparams[] = { GNUNET_PQ_query_param_auto_from_type (h_denom_pub), GNUNET_PQ_query_param_rsa_public_key (denom_pub->rsa_public_key), - GNUNET_PQ_query_param_auto_from_type (master_pub), GNUNET_PQ_query_param_auto_from_type (master_sig), TALER_PQ_query_param_absolute_time (&meta->start), TALER_PQ_query_param_absolute_time (&meta->expire_withdraw), -- cgit v1.2.3