From 20aad54c3e010020185c76d9e0727f3f497c2f73 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 8 May 2017 13:18:36 +0200 Subject: remove dead transfer details field from reserves_in (API, exchangedb, etc.) --- src/exchangedb/perf_taler_exchangedb_interpreter.c | 17 ++++++--------- src/exchangedb/plugin_exchangedb_common.c | 2 -- src/exchangedb/plugin_exchangedb_postgres.c | 25 ++++++---------------- src/exchangedb/test_exchangedb.c | 15 ++----------- 4 files changed, 14 insertions(+), 45 deletions(-) (limited to 'src/exchangedb') diff --git a/src/exchangedb/perf_taler_exchangedb_interpreter.c b/src/exchangedb/perf_taler_exchangedb_interpreter.c index 06078cfe7..9c4eb367a 100644 --- a/src/exchangedb/perf_taler_exchangedb_interpreter.c +++ b/src/exchangedb/perf_taler_exchangedb_interpreter.c @@ -1374,7 +1374,7 @@ interpret (struct PERF_TALER_EXCHANGEDB_interpreter_state *state) int ret; struct PERF_TALER_EXCHANGEDB_Reserve *reserve; json_t *sndr; - json_t *just; + uint32_t uid; reserve_index = state->cmd[state->i].details.insert_reserve.index_reserve; reserve = state->cmd[reserve_index].exposed.data.reserve; @@ -1382,11 +1382,8 @@ interpret (struct PERF_TALER_EXCHANGEDB_interpreter_state *state) "account", (int) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX)); - just = json_pack ("{s:i}", - "justification", - (int) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, - UINT32_MAX)); - GNUNET_assert (NULL != just); + uid = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, + UINT32_MAX); GNUNET_assert (NULL != sndr); ret = state->plugin->reserves_in_insert (state->plugin->cls, state->session, @@ -1394,12 +1391,10 @@ interpret (struct PERF_TALER_EXCHANGEDB_interpreter_state *state) &reserve->reserve.balance, GNUNET_TIME_absolute_get (), sndr, - "PERF", - 4, - just); + &uid, + sizeof (uid)); GNUNET_assert (GNUNET_SYSERR != ret); json_decref (sndr); - json_decref (just); } break; @@ -1486,7 +1481,7 @@ interpret (struct PERF_TALER_EXCHANGEDB_interpreter_state *state) dki_index = state->cmd[state->i].details.create_withdraw.index_dki; reserve_index = state->cmd[state->i].details.create_withdraw.index_reserve; coin = PERF_TALER_EXCHANGEDB_coin_init (state->cmd[dki_index].exposed.data.dki, - state->cmd[reserve_index].exposed.data.reserve); + state->cmd[reserve_index].exposed.data.reserve); GNUNET_assert (NULL != coin); state->cmd[state->i].exposed.data.coin = coin; } diff --git a/src/exchangedb/plugin_exchangedb_common.c b/src/exchangedb/plugin_exchangedb_common.c index 0f7d2fe76..61c00c14d 100644 --- a/src/exchangedb/plugin_exchangedb_common.c +++ b/src/exchangedb/plugin_exchangedb_common.c @@ -44,8 +44,6 @@ common_free_reserve_history (void *cls, bt = rh->details.bank; if (NULL != bt->sender_account_details) json_decref (bt->sender_account_details); - if (NULL != bt->transfer_details) - json_decref (bt->transfer_details); GNUNET_free_non_null (bt->wire_reference); GNUNET_free (bt); break; diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 6a59b9f58..0bf82f048 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -357,7 +357,6 @@ postgres_create_tables (void *cls) ",credit_frac INT4 NOT NULL" ",credit_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL" ",sender_account_details TEXT NOT NULL" - ",transfer_details TEXT NOT NULL" ",execution_date INT8 NOT NULL" ",PRIMARY KEY (reserve_pub, wire_reference)" ");"); @@ -764,11 +763,10 @@ postgres_prepare (PGconn *db_conn) ",credit_frac" ",credit_curr" ",sender_account_details" - ",transfer_details" ",execution_date" ") VALUES " - "($1, $2, $3, $4, $5, $6, $7, $8);", - 8, NULL); + "($1, $2, $3, $4, $5, $6, $7);", + 7, NULL); /* Used in postgres_select_reserves_in_above_serial_id() to obtain inbound @@ -782,7 +780,6 @@ postgres_prepare (PGconn *db_conn) ",credit_curr" ",execution_date" ",sender_account_details" - ",transfer_details" ",reserve_in_serial_id" " FROM reserves_in" " WHERE reserve_in_serial_id>=$1" @@ -799,7 +796,6 @@ postgres_prepare (PGconn *db_conn) ",credit_curr" ",execution_date" ",sender_account_details" - ",transfer_details" " FROM reserves_in" " WHERE reserve_pub=$1", 1, NULL); @@ -2080,7 +2076,6 @@ reserves_update (void *cls, * @param sender_account_details account information for the sender * @param wire_reference unique reference identifying the wire transfer (binary blob) * @param wire_reference_size number of bytes in @a wire_reference - * @param transfer_details information that uniquely identifies the transfer * @return #GNUNET_OK upon success; #GNUNET_NO if the given * @a details are already known for this @a reserve_pub, * #GNUNET_SYSERR upon failures (DB error, incompatible currency) @@ -2093,8 +2088,7 @@ postgres_reserves_in_insert (void *cls, struct GNUNET_TIME_Absolute execution_time, const json_t *sender_account_details, const void *wire_reference, - size_t wire_reference_size, - const json_t *transfer_details) + size_t wire_reference_size) { struct PostgresClosure *pg = cls; PGresult *result; @@ -2178,7 +2172,6 @@ postgres_reserves_in_insert (void *cls, wire_reference_size), TALER_PQ_query_param_amount (balance), TALER_PQ_query_param_json (sender_account_details), - TALER_PQ_query_param_json (transfer_details), GNUNET_PQ_query_param_absolute_time (&execution_time), GNUNET_PQ_query_param_end }; @@ -2479,8 +2472,6 @@ postgres_get_reserve_history (void *cls, &bt->execution_date), TALER_PQ_result_spec_json ("sender_account_details", &bt->sender_account_details), - TALER_PQ_result_spec_json ("transfer_details", - &bt->transfer_details), GNUNET_PQ_result_spec_end }; if (GNUNET_OK != @@ -5369,7 +5360,7 @@ postgres_start_deferred_wire_out (void *cls, * @param session database connection * @param date time of the wire transfer * @param wtid subject of the wire transfer - * @param wire details about the receiver account of the wire transfer + * @param wire_account details about the receiver account of the wire transfer * @param amount amount that was transmitted * @return #GNUNET_OK on success * #GNUNET_SYSERR on DB errors @@ -5379,14 +5370,14 @@ postgres_store_wire_transfer_out (void *cls, struct TALER_EXCHANGEDB_Session *session, struct GNUNET_TIME_Absolute date, const struct TALER_WireTransferIdentifierRawP *wtid, - const json_t *wire, + const json_t *wire_account, const struct TALER_Amount *amount) { PGresult *result; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_absolute_time (&date), GNUNET_PQ_query_param_auto_from_type (wtid), - TALER_PQ_query_param_json (wire), + TALER_PQ_query_param_json (wire_account), TALER_PQ_query_param_amount (amount), GNUNET_PQ_query_param_end }; @@ -5840,7 +5831,6 @@ postgres_select_reserves_in_above_serial_id (void *cls, struct TALER_ReservePublicKeyP reserve_pub; struct TALER_Amount credit; json_t *sender_account_details; - json_t *transfer_details; struct GNUNET_TIME_Absolute execution_date; uint64_t rowid; void *wire_reference; @@ -5858,8 +5848,6 @@ postgres_select_reserves_in_above_serial_id (void *cls, &execution_date), TALER_PQ_result_spec_json ("sender_account_details", &sender_account_details), - TALER_PQ_result_spec_json ("transfer_details", - &transfer_details), GNUNET_PQ_result_spec_uint64 ("reserve_in_serial_id", &rowid), GNUNET_PQ_result_spec_end @@ -5879,7 +5867,6 @@ postgres_select_reserves_in_above_serial_id (void *cls, &reserve_pub, &credit, sender_account_details, - transfer_details, wire_reference, wire_reference_size, execution_date); diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c index 7c6c362db..9b399233b 100644 --- a/src/exchangedb/test_exchangedb.c +++ b/src/exchangedb/test_exchangedb.c @@ -1032,7 +1032,6 @@ audit_refund_cb (void *cls, * @param reserve_pub public key of the reserve (also the WTID) * @param credit amount that was received * @param sender_account_details information about the sender's bank account - * @param transfer_details information that uniquely identifies the wire transfer * @param wire_reference unique reference identifying the wire transfer (binary blob) * @param wire_reference_size number of bytes in @a wire_reference * @param execution_date when did we receive the funds @@ -1044,7 +1043,6 @@ audit_reserve_in_cb (void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_Amount *credit, const json_t *sender_account_details, - const json_t *transfer_details, const void *wire_reference, size_t wire_reference_size, struct GNUNET_TIME_Absolute execution_date) @@ -1436,7 +1434,6 @@ run (void *cls) struct TALER_EXCHANGEDB_TransactionList *tl; struct TALER_EXCHANGEDB_TransactionList *tlp; json_t *wire; - json_t *just; json_t *sndr; unsigned int matched; const char * const json_wire_str = @@ -1506,8 +1503,6 @@ run (void *cls) result = 4; sndr = json_loads ("{ \"account\":\"1\" }", 0, NULL); GNUNET_assert (NULL != sndr); - just = json_loads ("{ \"justification\":\"1\" }", 0, NULL); - GNUNET_assert (NULL != just); FAILIF (GNUNET_OK != plugin->reserves_in_insert (plugin->cls, session, @@ -1516,16 +1511,13 @@ run (void *cls) GNUNET_TIME_absolute_get (), sndr, "TEST", - 4, - just)); - json_decref (just); + 4)); FAILIF (GNUNET_OK != check_reserve (session, &reserve_pub, value.value, value.fraction, value.currency)); - just = json_loads ("{ \"justification\":\"2\" }", 0, NULL); FAILIF (GNUNET_OK != plugin->reserves_in_insert (plugin->cls, session, @@ -1534,9 +1526,7 @@ run (void *cls) GNUNET_TIME_absolute_get (), sndr, "TEST2", - 5, - just)); - json_decref (just); + 5)); json_decref (sndr); FAILIF (GNUNET_OK != check_reserve (session, @@ -1672,7 +1662,6 @@ run (void *cls) FAILIF (1000 != bt->amount.fraction); FAILIF (0 != strcmp (CURRENCY, bt->amount.currency)); FAILIF (NULL == bt->sender_account_details); - FAILIF (NULL == bt->transfer_details); break; case TALER_EXCHANGEDB_RO_WITHDRAW_COIN: withdraw = rh_head->details.withdraw; -- cgit v1.2.3