From 85350ced32108f2ec69fbf62e0a7c3b256840fb1 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 29 May 2017 01:15:41 +0200 Subject: rename proposal_data to contract_terms (see #4879) --- src/exchangedb/perf_taler_exchangedb_init.c | 10 +-- src/exchangedb/plugin_exchangedb_postgres.c | 106 ++++++++++++++-------------- src/exchangedb/test_exchangedb.c | 48 ++++++------- 3 files changed, 82 insertions(+), 82 deletions(-) (limited to 'src/exchangedb') diff --git a/src/exchangedb/perf_taler_exchangedb_init.c b/src/exchangedb/perf_taler_exchangedb_init.c index 967f74730..c46bea22d 100644 --- a/src/exchangedb/perf_taler_exchangedb_init.c +++ b/src/exchangedb/perf_taler_exchangedb_init.c @@ -209,7 +209,7 @@ PERF_TALER_EXCHANGEDB_deposit_init (const struct PERF_TALER_EXCHANGEDB_Coin *coi struct TALER_EXCHANGEDB_Deposit *deposit; struct TALER_CoinSpendSignatureP csig; struct TALER_MerchantPublicKeyP merchant_pub; - struct GNUNET_HashCode h_proposal_data; + struct GNUNET_HashCode h_contract_terms; struct GNUNET_HashCode h_wire; const char wire[] = "{" "\"type\":\"SEPA\"," @@ -225,7 +225,7 @@ PERF_TALER_EXCHANGEDB_deposit_init (const struct PERF_TALER_EXCHANGEDB_Coin *coi GNUNET_assert (NULL != (deposit = GNUNET_malloc (sizeof (struct TALER_EXCHANGEDB_Deposit) + sizeof (wire)))); GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, - &h_proposal_data); + &h_contract_terms); GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &h_wire); { //csig @@ -233,10 +233,10 @@ PERF_TALER_EXCHANGEDB_deposit_init (const struct PERF_TALER_EXCHANGEDB_Coin *coi { struct GNUNET_CRYPTO_EccSignaturePurpose purpose; struct GNUNET_HashCode h_wire; - struct GNUNET_HashCode h_proposal_data; + struct GNUNET_HashCode h_contract_terms; } unsigned_data; - unsigned_data.h_proposal_data = h_proposal_data; + unsigned_data.h_contract_terms = h_contract_terms; unsigned_data.h_wire = h_wire; unsigned_data.purpose.size = htonl (sizeof (struct u32_presign)); unsigned_data.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST); @@ -273,7 +273,7 @@ PERF_TALER_EXCHANGEDB_deposit_init (const struct PERF_TALER_EXCHANGEDB_Coin *coi GNUNET_assert (NULL != coin->public_info.denom_sig.rsa_signature); } deposit->csig = csig; - deposit->h_proposal_data = h_proposal_data; + deposit->h_contract_terms = h_contract_terms; deposit->h_wire = h_wire; deposit->receiver_wire_account = json_loads (wire, 0, NULL); deposit->timestamp = timestamp; diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 1a5a8dddd..a359f23be 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -529,17 +529,17 @@ postgres_create_tables (void *cls) ",refund_deadline INT8 NOT NULL" ",wire_deadline INT8 NOT NULL" ",merchant_pub BYTEA NOT NULL CHECK (LENGTH(merchant_pub)=32)" - ",h_proposal_data BYTEA NOT NULL CHECK (LENGTH(h_proposal_data)=64)" + ",h_contract_terms BYTEA NOT NULL CHECK (LENGTH(h_contract_terms)=64)" ",h_wire BYTEA NOT NULL CHECK (LENGTH(h_wire)=64)" ",coin_sig BYTEA NOT NULL CHECK (LENGTH(coin_sig)=64)" ",wire TEXT NOT NULL" ",tiny BOOLEAN NOT NULL DEFAULT false" ",done BOOLEAN NOT NULL DEFAULT false" - ",UNIQUE (coin_pub, h_proposal_data, merchant_pub)" + ",UNIQUE (coin_pub, h_contract_terms, merchant_pub)" ")"); - /* Index for get_deposit statement on coin_pub, h_proposal_data and merchant_pub */ + /* Index for get_deposit statement on coin_pub, h_contract_terms and merchant_pub */ SQLEXEC_INDEX("CREATE INDEX deposits_coin_pub_index " - "ON deposits(coin_pub, h_proposal_data, merchant_pub)"); + "ON deposits(coin_pub, h_contract_terms, merchant_pub)"); /* Table with information about coins that have been refunded. (Technically one of the deposit operations that a coin was involved with is refunded.)*/ @@ -548,12 +548,12 @@ postgres_create_tables (void *cls) ",coin_pub BYTEA NOT NULL REFERENCES known_coins (coin_pub) ON DELETE CASCADE" ",merchant_pub BYTEA NOT NULL CHECK(LENGTH(merchant_pub)=32)" ",merchant_sig BYTEA NOT NULL CHECK(LENGTH(merchant_sig)=64)" - ",h_proposal_data BYTEA NOT NULL CHECK(LENGTH(h_proposal_data)=64)" + ",h_contract_terms BYTEA NOT NULL CHECK(LENGTH(h_contract_terms)=64)" ",rtransaction_id INT8 NOT NULL" ",amount_with_fee_val INT8 NOT NULL" ",amount_with_fee_frac INT4 NOT NULL" ",amount_with_fee_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL" - ",PRIMARY KEY (coin_pub, merchant_pub, h_proposal_data, rtransaction_id)" /* this combo must be unique, and we usually select by coin_pub */ + ",PRIMARY KEY (coin_pub, merchant_pub, h_contract_terms, rtransaction_id)" /* this combo must be unique, and we usually select by coin_pub */ ") "); /* This table contains the data for @@ -1055,7 +1055,7 @@ postgres_prepare (PGconn *db_conn) "SELECT" " merchant_pub" ",merchant_sig" - ",h_proposal_data" + ",h_contract_terms" ",rtransaction_id" ",denom.denom_pub" ",coin_pub" @@ -1075,7 +1075,7 @@ postgres_prepare (PGconn *db_conn) "SELECT" " merchant_pub" ",merchant_sig" - ",h_proposal_data" + ",h_contract_terms" ",rtransaction_id" ",amount_with_fee_val" ",amount_with_fee_frac" @@ -1141,7 +1141,7 @@ postgres_prepare (PGconn *db_conn) ",refund_deadline" ",wire_deadline" ",merchant_pub" - ",h_proposal_data" + ",h_contract_terms" ",h_wire" ",coin_sig" ",wire" @@ -1156,7 +1156,7 @@ postgres_prepare (PGconn *db_conn) "(coin_pub " ",merchant_pub " ",merchant_sig " - ",h_proposal_data " + ",h_contract_terms " ",rtransaction_id " ",amount_with_fee_val " ",amount_with_fee_frac " @@ -1175,12 +1175,12 @@ postgres_prepare (PGconn *db_conn) ",timestamp" ",refund_deadline" ",wire_deadline" - ",h_proposal_data" + ",h_contract_terms" ",h_wire" " FROM deposits" " WHERE (" " (coin_pub=$1) AND" - " (h_proposal_data=$2) AND" + " (h_contract_terms=$2) AND" " (merchant_pub=$3)" " )", 3, NULL); @@ -1198,7 +1198,7 @@ postgres_prepare (PGconn *db_conn) ",coin_sig" ",refund_deadline" ",wire_deadline" - ",h_proposal_data" + ",h_contract_terms" ",wire" ",done" ",deposit_serial_id" @@ -1228,7 +1228,7 @@ postgres_prepare (PGconn *db_conn) " WHERE (" " (coin_pub=$1) AND" " (merchant_pub=$2) AND" - " (h_proposal_data=$3) AND" + " (h_contract_terms=$3) AND" " (h_wire=$4)" " )", 4, NULL); @@ -1244,7 +1244,7 @@ postgres_prepare (PGconn *db_conn) ",denom.fee_deposit_frac" ",denom.fee_deposit_curr" ",wire_deadline" - ",h_proposal_data" + ",h_contract_terms" ",wire" ",merchant_pub" ",coin_pub" @@ -1271,7 +1271,7 @@ postgres_prepare (PGconn *db_conn) ",denom.fee_deposit_frac" ",denom.fee_deposit_curr" ",wire_deadline" - ",h_proposal_data" + ",h_contract_terms" ",coin_pub" " FROM deposits" " JOIN known_coins USING (coin_pub)" @@ -1304,7 +1304,7 @@ postgres_prepare (PGconn *db_conn) " FROM deposits" " WHERE coin_pub=$1" " AND merchant_pub=$2" - " AND h_proposal_data=$3" + " AND h_contract_terms=$3" " AND h_wire=$4", 5, NULL); @@ -1321,7 +1321,7 @@ postgres_prepare (PGconn *db_conn) ",timestamp" ",refund_deadline" ",merchant_pub" - ",h_proposal_data" + ",h_contract_terms" ",h_wire" ",wire" ",coin_sig" @@ -1395,7 +1395,7 @@ postgres_prepare (PGconn *db_conn) PREPARE ("lookup_transactions", "SELECT" " aggregation_serial_id" - ",deposits.h_proposal_data" + ",deposits.h_contract_terms" ",deposits.wire" ",deposits.h_wire" ",deposits.coin_pub" @@ -1432,7 +1432,7 @@ postgres_prepare (PGconn *db_conn) " JOIN denominations denom USING (denom_pub_hash)" " JOIN wire_out USING (wtid_raw)" " WHERE coin_pub=$1" - " AND h_proposal_data=$2" + " AND h_contract_terms=$2" " AND h_wire=$3" " AND merchant_pub=$4", 4, NULL); @@ -3060,7 +3060,7 @@ postgres_have_deposit (void *cls, { struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_auto_from_type (&deposit->coin.coin_pub), - GNUNET_PQ_query_param_auto_from_type (&deposit->h_proposal_data), + GNUNET_PQ_query_param_auto_from_type (&deposit->h_contract_terms), GNUNET_PQ_query_param_auto_from_type (&deposit->merchant_pub), GNUNET_PQ_query_param_end }; @@ -3095,8 +3095,8 @@ postgres_have_deposit (void *cls, &deposit2.refund_deadline), GNUNET_PQ_result_spec_absolute_time ("wire_deadline", &deposit2.wire_deadline), - GNUNET_PQ_result_spec_auto_from_type ("h_proposal_data", - &deposit2.h_proposal_data), + GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms", + &deposit2.h_contract_terms), GNUNET_PQ_result_spec_auto_from_type ("h_wire", &deposit2.h_wire), GNUNET_PQ_result_spec_end @@ -3116,8 +3116,8 @@ postgres_have_deposit (void *cls, deposit2.timestamp.abs_value_us) || (deposit->refund_deadline.abs_value_us != deposit2.refund_deadline.abs_value_us) || - (0 != memcmp (&deposit->h_proposal_data, - &deposit2.h_proposal_data, + (0 != memcmp (&deposit->h_contract_terms, + &deposit2.h_contract_terms, sizeof (struct GNUNET_HashCode))) || (0 != memcmp (&deposit->h_wire, &deposit2.h_wire, @@ -3182,7 +3182,7 @@ postgres_test_deposit_done (void *cls, struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_auto_from_type (&deposit->coin.coin_pub), GNUNET_PQ_query_param_auto_from_type (&deposit->merchant_pub), - GNUNET_PQ_query_param_auto_from_type (&deposit->h_proposal_data), + GNUNET_PQ_query_param_auto_from_type (&deposit->h_contract_terms), GNUNET_PQ_query_param_auto_from_type (&deposit->h_wire), GNUNET_PQ_query_param_end }; @@ -3308,7 +3308,7 @@ postgres_get_ready_deposit (void *cls, struct TALER_Amount amount_with_fee; struct TALER_Amount deposit_fee; struct GNUNET_TIME_Absolute wire_deadline; - struct GNUNET_HashCode h_proposal_data; + struct GNUNET_HashCode h_contract_terms; struct TALER_MerchantPublicKeyP merchant_pub; struct TALER_CoinSpendPublicKeyP coin_pub; uint64_t serial_id; @@ -3322,8 +3322,8 @@ postgres_get_ready_deposit (void *cls, &deposit_fee), GNUNET_PQ_result_spec_absolute_time ("wire_deadline", &wire_deadline), - GNUNET_PQ_result_spec_auto_from_type ("h_proposal_data", - &h_proposal_data), + GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms", + &h_contract_terms), GNUNET_PQ_result_spec_auto_from_type ("merchant_pub", &merchant_pub), GNUNET_PQ_result_spec_auto_from_type ("coin_pub", @@ -3348,7 +3348,7 @@ postgres_get_ready_deposit (void *cls, &coin_pub, &amount_with_fee, &deposit_fee, - &h_proposal_data, + &h_contract_terms, wire_deadline, wire); GNUNET_PQ_cleanup_result (rs); @@ -3412,7 +3412,7 @@ postgres_iterate_matching_deposits (void *cls, struct TALER_Amount amount_with_fee; struct TALER_Amount deposit_fee; struct GNUNET_TIME_Absolute wire_deadline; - struct GNUNET_HashCode h_proposal_data; + struct GNUNET_HashCode h_contract_terms; struct TALER_CoinSpendPublicKeyP coin_pub; uint64_t serial_id; int ret; @@ -3425,8 +3425,8 @@ postgres_iterate_matching_deposits (void *cls, &deposit_fee), GNUNET_PQ_result_spec_absolute_time ("wire_deadline", &wire_deadline), - GNUNET_PQ_result_spec_auto_from_type ("h_proposal_data", - &h_proposal_data), + GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms", + &h_contract_terms), GNUNET_PQ_result_spec_auto_from_type ("coin_pub", &coin_pub), GNUNET_PQ_result_spec_end @@ -3446,7 +3446,7 @@ postgres_iterate_matching_deposits (void *cls, &coin_pub, &amount_with_fee, &deposit_fee, - &h_proposal_data, + &h_contract_terms, wire_deadline, NULL); GNUNET_PQ_cleanup_result (rs); @@ -3584,7 +3584,7 @@ postgres_insert_deposit (void *cls, GNUNET_PQ_query_param_absolute_time (&deposit->refund_deadline), GNUNET_PQ_query_param_absolute_time (&deposit->wire_deadline), GNUNET_PQ_query_param_auto_from_type (&deposit->merchant_pub), - GNUNET_PQ_query_param_auto_from_type (&deposit->h_proposal_data), + GNUNET_PQ_query_param_auto_from_type (&deposit->h_contract_terms), GNUNET_PQ_query_param_auto_from_type (&deposit->h_wire), GNUNET_PQ_query_param_auto_from_type (&deposit->csig), TALER_PQ_query_param_json (deposit->receiver_wire_account), @@ -3638,7 +3638,7 @@ postgres_insert_refund (void *cls, GNUNET_PQ_query_param_auto_from_type (&refund->coin.coin_pub), GNUNET_PQ_query_param_auto_from_type (&refund->merchant_pub), GNUNET_PQ_query_param_auto_from_type (&refund->merchant_sig), - GNUNET_PQ_query_param_auto_from_type (&refund->h_proposal_data), + GNUNET_PQ_query_param_auto_from_type (&refund->h_contract_terms), GNUNET_PQ_query_param_uint64 (&refund->rtransaction_id), TALER_PQ_query_param_amount (&refund->refund_amount), GNUNET_PQ_query_param_end @@ -4474,8 +4474,8 @@ postgres_get_coin_transactions (void *cls, &deposit->refund_deadline), GNUNET_PQ_result_spec_auto_from_type ("merchant_pub", &deposit->merchant_pub), - GNUNET_PQ_result_spec_auto_from_type ("h_proposal_data", - &deposit->h_proposal_data), + GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms", + &deposit->h_contract_terms), GNUNET_PQ_result_spec_auto_from_type ("h_wire", &deposit->h_wire), TALER_PQ_result_spec_json ("wire", @@ -4618,8 +4618,8 @@ postgres_get_coin_transactions (void *cls, &refund->merchant_pub), GNUNET_PQ_result_spec_auto_from_type ("merchant_sig", &refund->merchant_sig), - GNUNET_PQ_result_spec_auto_from_type ("h_proposal_data", - &refund->h_proposal_data), + GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms", + &refund->h_contract_terms), GNUNET_PQ_result_spec_uint64 ("rtransaction_id", &refund->rtransaction_id), TALER_PQ_result_spec_amount ("amount_with_fee", @@ -4782,7 +4782,7 @@ postgres_lookup_wire_transfer (void *cls, for (int i=0;iamount_with_fee)) || (0 != TALER_amount_cmp (deposit_fee, &deposit->deposit_fee)) || - (0 != memcmp (h_proposal_data, - &deposit->h_proposal_data, + (0 != memcmp (h_contract_terms, + &deposit->h_contract_terms, sizeof (struct GNUNET_HashCode))) || (0 != memcmp (coin_pub, &deposit->coin.coin_pub, @@ -963,7 +963,7 @@ deposit_cb (void *cls, * @param coin_pub public key of the coin * @param coin_sig signature from the coin * @param amount_with_fee amount that was deposited including fee - * @param h_proposal_data hash of the proposal data known to merchant and customer + * @param h_contract_terms hash of the proposal data known to merchant and customer * @param refund_deadline by which the merchant adviced that he might want * to get a refund * @param wire_deadline by which the merchant adviced that he would like the @@ -981,7 +981,7 @@ audit_deposit_cb (void *cls, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendSignatureP *coin_sig, const struct TALER_Amount *amount_with_fee, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, struct GNUNET_TIME_Absolute refund_deadline, struct GNUNET_TIME_Absolute wire_deadline, const json_t *receiver_wire_account, @@ -1002,7 +1002,7 @@ audit_deposit_cb (void *cls, * @param coin_pub public key of the coin * @param merchant_pub public key of the merchant * @param merchant_sig signature of the merchant - * @param h_proposal_data hash of the proposal data in + * @param h_contract_terms hash of the proposal data in * the contract between merchant and customer * @param rtransaction_id refund transaction ID chosen by the merchant * @param amount_with_fee amount that was deposited including fee @@ -1015,7 +1015,7 @@ audit_refund_cb (void *cls, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantSignatureP *merchant_sig, - const struct GNUNET_HashCode *h_proposal_data, + const struct GNUNET_HashCode *h_contract_terms, uint64_t rtransaction_id, const struct TALER_Amount *amount_with_fee) { @@ -1290,7 +1290,7 @@ test_wire_out (struct TALER_EXCHANGEDB_Session *session, /* setup values for wire transfer aggregation data */ merchant_pub_wt = deposit->merchant_pub; h_wire_wt = deposit->h_wire; - h_proposal_data_wt = deposit->h_proposal_data; + h_contract_terms_wt = deposit->h_contract_terms; coin_pub_wt = deposit->coin.coin_pub; coin_value_wt = deposit->amount_with_fee; @@ -1307,13 +1307,13 @@ test_wire_out (struct TALER_EXCHANGEDB_Session *session, NULL)); { - struct GNUNET_HashCode h_proposal_data_wt2 = h_proposal_data_wt; + struct GNUNET_HashCode h_contract_terms_wt2 = h_contract_terms_wt; - h_proposal_data_wt2.bits[0]++; + h_contract_terms_wt2.bits[0]++; FAILIF (GNUNET_NO != plugin->wire_lookup_deposit_wtid (plugin->cls, session, - &h_proposal_data_wt2, + &h_contract_terms_wt2, &h_wire_wt, &coin_pub_wt, &merchant_pub_wt, @@ -1350,7 +1350,7 @@ test_wire_out (struct TALER_EXCHANGEDB_Session *session, FAILIF (GNUNET_OK != plugin->wire_lookup_deposit_wtid (plugin->cls, session, - &h_proposal_data_wt, + &h_contract_terms_wt, &h_wire_wt, &coin_pub_wt, &merchant_pub_wt, @@ -1760,7 +1760,7 @@ run (void *cls) deposit.coin.denom_sig = cbc.sig; RND_BLK (&deposit.csig); RND_BLK (&deposit.merchant_pub); - RND_BLK (&deposit.h_proposal_data); + RND_BLK (&deposit.h_contract_terms); wire = json_loads (json_wire_str, 0, NULL); TALER_JSON_hash (wire, &deposit.h_wire); @@ -1856,7 +1856,7 @@ run (void *cls) refund.coin = deposit.coin; refund.merchant_pub = deposit.merchant_pub; RND_BLK (&refund.merchant_sig); - refund.h_proposal_data = deposit.h_proposal_data; + refund.h_contract_terms = deposit.h_contract_terms; refund.rtransaction_id = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); refund.refund_amount = deposit.amount_with_fee; refund.refund_fee = fee_refund; @@ -1952,8 +1952,8 @@ run (void *cls) FAILIF (0 != memcmp (&have->merchant_pub, &deposit.merchant_pub, sizeof (struct TALER_MerchantPublicKeyP))); - FAILIF (0 != memcmp (&have->h_proposal_data, - &deposit.h_proposal_data, + FAILIF (0 != memcmp (&have->h_contract_terms, + &deposit.h_contract_terms, sizeof (struct GNUNET_HashCode))); FAILIF (0 != memcmp (&have->h_wire, &deposit.h_wire, @@ -1994,8 +1994,8 @@ run (void *cls) FAILIF (0 != memcmp (&have->merchant_sig, &refund.merchant_sig, sizeof (struct TALER_MerchantSignatureP))); - FAILIF (0 != memcmp (&have->h_proposal_data, - &refund.h_proposal_data, + FAILIF (0 != memcmp (&have->h_contract_terms, + &refund.h_contract_terms, sizeof (struct GNUNET_HashCode))); FAILIF (have->rtransaction_id != refund.rtransaction_id); FAILIF (0 != TALER_amount_cmp (&have->refund_amount, -- cgit v1.2.3