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/auditor/.gitignore | 1 + src/auditor/report-lib.c | 1 + .../taler-exchange-httpd_management_post_keys.c | 1 - src/exchangedb/exchange-0002.sql | 4 +++ src/exchangedb/irbt_callbacks.c | 2 -- src/exchangedb/plugin_exchangedb_postgres.c | 30 +++++++++------------- src/include/taler_exchangedb_plugin.h | 10 +++++--- 7 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/auditor/.gitignore b/src/auditor/.gitignore index caffec44e..6d25d8bae 100644 --- a/src/auditor/.gitignore +++ b/src/auditor/.gitignore @@ -18,3 +18,4 @@ generate-auditor-basedb-prod.conf generate-auditor-basedb-revocation.conf revocation-tmp-* auditor-basedb.wdb +taler-auditor-sync diff --git a/src/auditor/report-lib.c b/src/auditor/report-lib.c index 6334e6f65..36baf640e 100644 --- a/src/auditor/report-lib.c +++ b/src/auditor/report-lib.c @@ -212,6 +212,7 @@ add_denomination ( i = GNUNET_new (struct TALER_DenominationKeyValidityPS); *i = *issue; + i->master = TALER_ARL_master_pub; GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (denominations, &issue->denom_hash, diff --git a/src/exchange/taler-exchange-httpd_management_post_keys.c b/src/exchange/taler-exchange-httpd_management_post_keys.c index df044b6d7..1e7936535 100644 --- a/src/exchange/taler-exchange-httpd_management_post_keys.c +++ b/src/exchange/taler-exchange-httpd_management_post_keys.c @@ -199,7 +199,6 @@ add_keys (void *cls, &akc->d_sigs[i].h_denom_pub, &denom_pub, &meta, - &TEH_master_public_key, &akc->d_sigs[i].master_sig); GNUNET_CRYPTO_rsa_public_key_free (denom_pub.rsa_public_key); if (qs < 0) 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), diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index fc17f70c7..177177938 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -2017,10 +2017,12 @@ typedef void /** * Function called with information about the exchange's denomination keys. + * Note that the 'master' field in @a issue will not yet be initialized when + * this function is called! * * @param cls closure * @param denom_pub public key of the denomination - * @param issue detailed information about the denomination (value, expiration times, fees) + * @param issue detailed information about the denomination (value, expiration times, fees); */ typedef void (*TALER_EXCHANGEDB_DenominationCallback)( @@ -2167,7 +2169,9 @@ struct TALER_EXCHANGEDB_Plugin /** * Function called on every known denomination key. Runs in its - * own read-only transaction (hence no session provided). + * own read-only transaction (hence no session provided). Note that + * the "master" field in the callback's 'issue' argument will NOT + * be initialized yet. * * @param cls the @e cls of this struct with the plugin-specific state * @param session session to use @@ -3648,7 +3652,6 @@ struct TALER_EXCHANGEDB_Plugin * @param h_denom_pub hash of the denomination public key * @param denom_pub the denomination public key * @param meta meta data about the denomination - * @param master_pub master public key (consider removing this in the future!) * @param master_sig master signature to add * @return transaction status code */ @@ -3659,7 +3662,6 @@ struct TALER_EXCHANGEDB_Plugin 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); -- cgit v1.2.3