From e6ff049c203a8a5ab0d14a44bca3e2aae356d786 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 9 Aug 2015 18:03:42 +0200 Subject: fix #3935 by removing error message: the test provokes this intentionally --- src/mintdb/plugin_mintdb_postgres.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/mintdb/plugin_mintdb_postgres.c') diff --git a/src/mintdb/plugin_mintdb_postgres.c b/src/mintdb/plugin_mintdb_postgres.c index 16330e04..b0f378e4 100644 --- a/src/mintdb/plugin_mintdb_postgres.c +++ b/src/mintdb/plugin_mintdb_postgres.c @@ -1751,11 +1751,8 @@ postgres_get_reserve_history (void *cls, * @param session database connection * @param deposit deposit to search for * @return #GNUNET_YES if we know this operation, - * #GNUNET_NO if this deposit is unknown to us - * #GNUNET_SYSERR on DB error or if same coin(pub), merchant(pub) and - * transaction ID are already in DB, but for different - * other transaction details (contract, wiring details, - * amount, etc.) + * #GNUNET_NO if this exact deposit is unknown to us + * #GNUNET_SYSERR on DB error */ static int postgres_have_deposit (void *cls, @@ -1823,13 +1820,12 @@ postgres_have_deposit (void *cls, &deposit2.h_wire, sizeof (struct GNUNET_HashCode))) ) { - /* Inconsistencies detected! Bug in merchant! (We might want to + /* Inconsistencies detected! Does not match! (We might want to expand the API with a 'get_deposit' function to return the original transaction details to be used for an error message in the future!) #3838 */ - GNUNET_break_op (0); PQclear (result); - return GNUNET_SYSERR; + return GNUNET_NO; } } PQclear (result); -- cgit v1.2.3 From 462d315247610e4223a0a94096e93b6036068e98 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 9 Aug 2015 18:18:13 +0200 Subject: silence useless PQ logging --- src/mintdb/plugin_mintdb_postgres.c | 48 ++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'src/mintdb/plugin_mintdb_postgres.c') diff --git a/src/mintdb/plugin_mintdb_postgres.c b/src/mintdb/plugin_mintdb_postgres.c index b0f378e4..57455fcc 100644 --- a/src/mintdb/plugin_mintdb_postgres.c +++ b/src/mintdb/plugin_mintdb_postgres.c @@ -166,7 +166,7 @@ static int postgres_drop_temporary (void *cls, struct TALER_MINTDB_Session *session) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Dropping temporary tables\n"); SQLEXEC_ (session->conn, "DROP SCHEMA " TALER_TEMP_SCHEMA_NAME " CASCADE;"); @@ -176,6 +176,40 @@ postgres_drop_temporary (void *cls, } +/** + * Function called by libpq whenever it wants to log something. + * We already log whenever we care, so this function does nothing + * and merely exists to silence the libpq logging. + * + * @param arg NULL + * @param res information about some libpq event + */ +static void +pq_notice_receiver_cb (void *arg, + const PGresult *res) +{ + /* do nothing, intentionally */ +} + + +/** + * Function called by libpq whenever it wants to log something. + * We log those using the Taler logger. + * + * @param arg NULL + * @param message information about some libpq event + */ +static void +pq_notice_processor_cb (void *arg, + const char *message) +{ + GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, + "pq", + "%s", + message); +} + + /** * Create the necessary tables if they are not present * @@ -198,6 +232,12 @@ postgres_create_tables (void *cls, PQfinish (conn); return GNUNET_SYSERR; } + PQsetNoticeReceiver (conn, + &pq_notice_receiver_cb, + NULL); + PQsetNoticeProcessor (conn, + &pq_notice_processor_cb, + NULL); if ( (GNUNET_YES == temporary) && (GNUNET_SYSERR == set_temporary_schema (conn))) { @@ -939,6 +979,12 @@ postgres_get_session (void *cls, GNUNET_break (0); return NULL; } + PQsetNoticeReceiver (db_conn, + &pq_notice_receiver_cb, + NULL); + PQsetNoticeProcessor (db_conn, + &pq_notice_processor_cb, + NULL); if ( (GNUNET_YES == temporary) && (GNUNET_SYSERR == set_temporary_schema(db_conn)) ) { -- cgit v1.2.3 From 6237981d9652889bbcc042e8b374c0addc65932f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 9 Aug 2015 21:25:49 +0200 Subject: rename struct TALER_MINTDB_RefreshCommitLinkP to struct TALER_RefreshCommitLinkP --- src/include/taler_mintdb_plugin.h | 6 +++--- src/include/taler_signatures.h | 2 +- src/mint-lib/mint_api_refresh.c | 4 ++-- src/mint/taler-mint-httpd_db.c | 6 +++--- src/mint/taler-mint-httpd_db.h | 2 +- src/mint/taler-mint-httpd_refresh.c | 12 ++++++------ src/mint/taler-mint-httpd_responses.c | 2 +- src/mintdb/plugin_mintdb_postgres.c | 6 +++--- 8 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src/mintdb/plugin_mintdb_postgres.c') diff --git a/src/include/taler_mintdb_plugin.h b/src/include/taler_mintdb_plugin.h index ba83c814..c5b9828d 100644 --- a/src/include/taler_mintdb_plugin.h +++ b/src/include/taler_mintdb_plugin.h @@ -539,7 +539,7 @@ struct TALER_MINTDB_MeltCommitment /** * 2D-Array of #TALER_CNC_KAPPA and @e new_oldcoins links. */ - struct TALER_MINTDB_RefreshCommitLinkP *commit_links[TALER_CNC_KAPPA]; + struct TALER_RefreshCommitLinkP *commit_links[TALER_CNC_KAPPA]; }; @@ -1002,7 +1002,7 @@ struct TALER_MINTDB_Plugin const struct GNUNET_HashCode *session_hash, uint16_t cnc_index, uint16_t num_links, - const struct TALER_MINTDB_RefreshCommitLinkP *commit_links); + const struct TALER_RefreshCommitLinkP *commit_links); /** * Obtain the commited (encrypted) refresh link data @@ -1024,7 +1024,7 @@ struct TALER_MINTDB_Plugin const struct GNUNET_HashCode *session_hash, uint16_t cnc_index, uint16_t num_links, - struct TALER_MINTDB_RefreshCommitLinkP *links); + struct TALER_RefreshCommitLinkP *links); /** diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h index 0b05bace..c5348eb5 100644 --- a/src/include/taler_signatures.h +++ b/src/include/taler_signatures.h @@ -657,7 +657,7 @@ struct TALER_MintKeyValidityPS * Part of the construction of the refresh session's hash and * thus of what is signed there. */ -struct TALER_MINTDB_RefreshCommitLinkP +struct TALER_RefreshCommitLinkP { /** * Transfer public key, used to decrypt the @e shared_secret_enc diff --git a/src/mint-lib/mint_api_refresh.c b/src/mint-lib/mint_api_refresh.c index 796eb23f..66e8ea83 100644 --- a/src/mint-lib/mint_api_refresh.c +++ b/src/mint-lib/mint_api_refresh.c @@ -990,7 +990,7 @@ TALER_MINT_refresh_prepare (unsigned int num_melts, { for (j = 0; j < num_melts; j++) { - struct TALER_MINTDB_RefreshCommitLinkP rcl; + struct TALER_RefreshCommitLinkP rcl; struct TALER_TransferSecretP trans_sec; GNUNET_CRYPTO_ecdhe_key_get_public (&md.melted_coins[j].transfer_priv[i].ecdhe_priv, @@ -1003,7 +1003,7 @@ TALER_MINT_refresh_prepare (unsigned int num_melts, &rcl.shared_secret_enc); GNUNET_CRYPTO_hash_context_read (hash_context, &rcl, - sizeof (struct TALER_MINTDB_RefreshCommitLinkP)); + sizeof (struct TALER_RefreshCommitLinkP)); } } diff --git a/src/mint/taler-mint-httpd_db.c b/src/mint/taler-mint-httpd_db.c index 4e91e7e7..e24102ea 100644 --- a/src/mint/taler-mint-httpd_db.c +++ b/src/mint/taler-mint-httpd_db.c @@ -623,7 +623,7 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection, unsigned int coin_count, const struct TMH_DB_MeltDetails *coin_melt_details, struct TALER_MINTDB_RefreshCommitCoin *const* commit_coin, - struct TALER_MINTDB_RefreshCommitLinkP *const* commit_link) + struct TALER_RefreshCommitLinkP *const* commit_link) { struct TMH_KS_StateHandle *key_state; struct TALER_MINTDB_RefreshSession refresh_session; @@ -839,11 +839,11 @@ check_commitment (struct MHD_Connection *connection, unsigned int j; struct TALER_LinkSecretP last_shared_secret; int secret_initialized = GNUNET_NO; - struct TALER_MINTDB_RefreshCommitLinkP *commit_links; + struct TALER_RefreshCommitLinkP *commit_links; struct TALER_MINTDB_RefreshCommitCoin *commit_coins; commit_links = GNUNET_malloc (num_oldcoins * - sizeof (struct TALER_MINTDB_RefreshCommitLinkP)); + sizeof (struct TALER_RefreshCommitLinkP)); if (GNUNET_OK != TMH_plugin->get_refresh_commit_links (TMH_plugin->cls, session, diff --git a/src/mint/taler-mint-httpd_db.h b/src/mint/taler-mint-httpd_db.h index 8a171153..c2f9a310 100644 --- a/src/mint/taler-mint-httpd_db.h +++ b/src/mint/taler-mint-httpd_db.h @@ -130,7 +130,7 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection, unsigned int coin_count, const struct TMH_DB_MeltDetails *coin_melt_details, struct TALER_MINTDB_RefreshCommitCoin *const* commit_coin, - struct TALER_MINTDB_RefreshCommitLinkP *const* commit_link); + struct TALER_RefreshCommitLinkP *const* commit_link); /** diff --git a/src/mint/taler-mint-httpd_refresh.c b/src/mint/taler-mint-httpd_refresh.c index 7bcaa799..954d8daf 100644 --- a/src/mint/taler-mint-httpd_refresh.c +++ b/src/mint/taler-mint-httpd_refresh.c @@ -57,7 +57,7 @@ handle_refresh_melt_binary (struct MHD_Connection *connection, const struct TMH_DB_MeltDetails *coin_melt_details, const struct GNUNET_HashCode *session_hash, struct TALER_MINTDB_RefreshCommitCoin *const* commit_coin, - struct TALER_MINTDB_RefreshCommitLinkP *const* commit_link) + struct TALER_RefreshCommitLinkP *const* commit_link) { unsigned int i; struct TMH_KS_StateHandle *key_state; @@ -324,7 +324,7 @@ free_commit_coins (struct TALER_MINTDB_RefreshCommitCoin **commit_coin, * @param num_old_coins size of 2nd dimension */ static void -free_commit_links (struct TALER_MINTDB_RefreshCommitLinkP **commit_link, +free_commit_links (struct TALER_RefreshCommitLinkP **commit_link, unsigned int kappa, unsigned int num_old_coins) { @@ -378,7 +378,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection, struct GNUNET_HashCode session_hash; struct GNUNET_HashContext *hash_context; struct TALER_MINTDB_RefreshCommitCoin *commit_coin[TALER_CNC_KAPPA]; - struct TALER_MINTDB_RefreshCommitLinkP *commit_link[TALER_CNC_KAPPA]; + struct TALER_RefreshCommitLinkP *commit_link[TALER_CNC_KAPPA]; /* For the signature check, we hash most of the inputs together (except for the signatures on the coins). */ @@ -532,10 +532,10 @@ handle_refresh_melt_json (struct MHD_Connection *connection, for (i = 0; i < TALER_CNC_KAPPA; i++) { commit_link[i] = GNUNET_malloc (num_oldcoins * - sizeof (struct TALER_MINTDB_RefreshCommitLinkP)); + sizeof (struct TALER_RefreshCommitLinkP)); for (j = 0; j < num_oldcoins; j++) { - struct TALER_MINTDB_RefreshCommitLinkP *rcl = &commit_link[i][j]; + struct TALER_RefreshCommitLinkP *rcl = &commit_link[i][j]; res = TMH_PARSE_navigate_json (connection, transfer_pubs, @@ -582,7 +582,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection, GNUNET_CRYPTO_hash_context_read (hash_context, rcl, - sizeof (struct TALER_MINTDB_RefreshCommitLinkP)); + sizeof (struct TALER_RefreshCommitLinkP)); } } diff --git a/src/mint/taler-mint-httpd_responses.c b/src/mint/taler-mint-httpd_responses.c index 0e2f9070..9a6813f1 100644 --- a/src/mint/taler-mint-httpd_responses.c +++ b/src/mint/taler-mint-httpd_responses.c @@ -900,7 +900,7 @@ TMH_RESPONSE_reply_refresh_reveal_missmatch (struct MHD_Connection *connection, info_link_k = json_array (); for (i=0;inum_newcoins;i++) { - const struct TALER_MINTDB_RefreshCommitLinkP *cl; + const struct TALER_RefreshCommitLinkP *cl; json_t *cl_json; cl = &mc->commit_links[k][i]; diff --git a/src/mintdb/plugin_mintdb_postgres.c b/src/mintdb/plugin_mintdb_postgres.c index 57455fcc..658d8dd9 100644 --- a/src/mintdb/plugin_mintdb_postgres.c +++ b/src/mintdb/plugin_mintdb_postgres.c @@ -2640,7 +2640,7 @@ postgres_insert_refresh_commit_links (void *cls, const struct GNUNET_HashCode *session_hash, uint16_t cnc_index, uint16_t num_links, - const struct TALER_MINTDB_RefreshCommitLinkP *links) + const struct TALER_RefreshCommitLinkP *links) { // FIXME: check logic! links is array! struct TALER_PQ_QueryParam params[] = { @@ -2693,7 +2693,7 @@ postgres_get_refresh_commit_links (void *cls, const struct GNUNET_HashCode *session_hash, uint16_t cnc_index, uint16_t num_links, - struct TALER_MINTDB_RefreshCommitLinkP *links) + struct TALER_RefreshCommitLinkP *links) { // FIXME: check logic: was written for a single link! struct TALER_PQ_QueryParam params[] = { @@ -2801,7 +2801,7 @@ postgres_get_melt_commitment (void *cls, goto cleanup; mc->commit_links[cnc_index] = GNUNET_malloc (mc->num_oldcoins * - sizeof (struct TALER_MINTDB_RefreshCommitLinkP)); + sizeof (struct TALER_RefreshCommitLinkP)); if (GNUNET_OK != postgres_get_refresh_commit_links (cls, session, -- cgit v1.2.3