diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2023-05-01 14:05:58 +0200 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2023-05-01 14:05:58 +0200 |
commit | 1a63275d9804762f0bcdc1cd23060c2e9b364fbb (patch) | |
tree | 2ac8d645d80089cb4674c9878c217025c0a984de /src/exchangedb | |
parent | af3c92f9d5a9e0d674ab2b1d8028268552ab9f5b (diff) |
WiP: age-withdraw, finished reveal-request, 10/n
- /age-withdraw/$ACH/reveal handler now fully implemented
- for consistency with api: rename of tables from withdraw_age_... to
age_withdraw
Diffstat (limited to 'src/exchangedb')
-rw-r--r-- | src/exchangedb/0003-age_withdraw_commitments.sql (renamed from src/exchangedb/0003-withdraw_age_commitments.sql) | 66 | ||||
-rw-r--r-- | src/exchangedb/0003-age_withdraw_reveals.sql (renamed from src/exchangedb/0003-withdraw_age_reveals.sql) | 33 | ||||
-rw-r--r-- | src/exchangedb/exchange-0003.sql.in | 2 | ||||
-rw-r--r-- | src/exchangedb/pg_get_age_withdraw_info.c | 2 | ||||
-rw-r--r-- | src/exchangedb/pg_insert_age_withdraw_reveal.c | 4 | ||||
-rw-r--r-- | src/exchangedb/pg_insert_records_by_table.c | 60 | ||||
-rw-r--r-- | src/exchangedb/pg_lookup_records_by_table.c | 58 | ||||
-rw-r--r-- | src/exchangedb/pg_lookup_serial_by_table.c | 20 |
8 files changed, 116 insertions, 129 deletions
diff --git a/src/exchangedb/0003-withdraw_age_commitments.sql b/src/exchangedb/0003-age_withdraw_commitments.sql index b8451129a..d74a697c3 100644 --- a/src/exchangedb/0003-withdraw_age_commitments.sql +++ b/src/exchangedb/0003-age_withdraw_commitments.sql @@ -14,24 +14,24 @@ -- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> -- -CREATE FUNCTION create_table_withdraw_age_commitments( +CREATE FUNCTION create_table_age_withdraw_commitments( IN partition_suffix VARCHAR DEFAULT NULL ) RETURNS VOID LANGUAGE plpgsql AS $$ DECLARE - table_name VARCHAR DEFAULT 'withdraw_age_commitments'; + table_name VARCHAR DEFAULT 'age_withdraw_commitments'; BEGIN PERFORM create_partitioned_table( 'CREATE TABLE %I' - '(withdraw_age_commitment_id BIGINT GENERATED BY DEFAULT AS IDENTITY' - ',h_commitment BYTEA PRIMARY KEY CHECK (LENGTH(h_commitment)=64)' + '(age_withdraw_commitment_id BIGINT GENERATED BY DEFAULT AS IDENTITY' + ',h_commitment BYTEA CHECK (LENGTH(h_commitment)=64)' ',amount_with_fee_val INT8 NOT NULL' ',amount_with_fee_frac INT4 NOT NULL' ',max_age INT2 NOT NULL' - ',reserve_pub BYTEA NOT NULL CHECK (LENGTH(reserve_pub)=32)' - ',reserve_sig BYTEA CHECK (LENGTH(reserve_sig)=64)' + ',reserve_pub BYTEA CHECK (LENGTH(reserve_pub)=32)' + ',reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64)' ',noreveal_index INT4 NOT NULL' ') %s ;' ,table_name @@ -77,66 +77,58 @@ END $$; -CREATE FUNCTION constrain_table_withdraw_age_commitments( +CREATE FUNCTION constrain_table_age_withdraw_commitments( IN partition_suffix VARCHAR ) RETURNS void LANGUAGE plpgsql AS $$ DECLARE - table_name VARCHAR DEFAULT 'withdraw_age_commitments'; + table_name VARCHAR DEFAULT 'age_withdraw_commitments'; BEGIN table_name = concat_ws('_', table_name, partition_suffix); - EXECUTE FORMAT ( 'ALTER TABLE ' || table_name || - ' ADD PRIMARY KEY (h_commitment, reserve_pub);' + ' ADD PRIMARY KEY (h_commitment);' + ); + EXECUTE FORMAT ( + 'ALTER TABLE ' || table_name || + ' ADD CONSTRAINT ' || table_name || '_h_commitment_reserve_pub_key' + ' UNIQUE (h_commitment, reserve_pub);' ); EXECUTE FORMAT ( 'ALTER TABLE ' || table_name || - ' ADD CONSTRAINT ' || table_name || '_withdraw_age_commitment_id_key' - ' UNIQUE (withdraw_age_commitment_id);' + ' ADD CONSTRAINT ' || table_name || '_age_withdraw_commitment_id_key' + ' UNIQUE (age_withdraw_commitment_id);' ); END $$; -CREATE FUNCTION foreign_table_withdraw_age_commitments() +CREATE FUNCTION foreign_table_age_withdraw_commitments() RETURNS void LANGUAGE plpgsql AS $$ DECLARE - table_name VARCHAR DEFAULT 'withdraw_age_commitments'; + table_name VARCHAR DEFAULT 'age_withdraw_commitments'; BEGIN EXECUTE FORMAT ( 'ALTER TABLE ' || table_name || ' ADD CONSTRAINT ' || table_name || '_foreign_reserve_pub' ' FOREIGN KEY (reserve_pub)' - ' REFERENCES reserves (reserve_pub) ON DELETE CASCADE;' + ' REFERENCES reserves(reserve_pub) ON DELETE CASCADE;' ); END $$; -INSERT INTO exchange_tables - (name - ,version - ,action - ,partitioned - ,by_range) - VALUES - ('withdraw_age_commitments' - ,'exchange-0003' - ,'create' - ,TRUE - ,FALSE), - ('withdraw_age_commitments' - ,'exchange-0003' - ,'constrain' - ,TRUE - ,FALSE), - ('withdraw_age_commitments' - ,'exchange-0003' - ,'foreign' - ,TRUE - ,FALSE); +INSERT INTO exchange_tables + (name + ,version + ,action + ,partitioned + ,by_range) +VALUES + ('age_withdraw_commitments', 'exchange-0003', 'create', TRUE ,FALSE), + ('age_withdraw_commitments', 'exchange-0003', 'constrain',TRUE ,FALSE), + ('age_withdraw_commitments', 'exchange-0003', 'foreign', TRUE ,FALSE); diff --git a/src/exchangedb/0003-withdraw_age_reveals.sql b/src/exchangedb/0003-age_withdraw_reveals.sql index af66eab75..1c55fb190 100644 --- a/src/exchangedb/0003-withdraw_age_reveals.sql +++ b/src/exchangedb/0003-age_withdraw_reveals.sql @@ -14,25 +14,24 @@ -- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> -- -CREATE FUNCTION create_table_withdraw_age_revealed_coins( +CREATE FUNCTION create_table_age_withdraw_revealed_coins( IN partition_suffix VARCHAR DEFAULT NULL ) RETURNS VOID LANGUAGE plpgsql AS $$ DECLARE - table_name VARCHAR DEFAULT 'withdraw_age_revealed_coins'; + table_name VARCHAR DEFAULT 'age_withdraw_revealed_coins'; BEGIN PERFORM create_partitioned_table( 'CREATE TABLE %I' - '(withdraw_age_revealed_coins_id BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE + '(age_withdraw_revealed_coins_id BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE ',h_commitment BYTEA NOT NULL CHECK (LENGTH(h_commitment)=64)' ',freshcoin_index INT4 NOT NULL' ',denominations_serial INT8 NOT NULL' ',coin_ev BYTEA NOT NULL' ',h_coin_ev BYTEA CHECK (LENGTH(h_coin_ev)=64)' ',ev_sig BYTEA NOT NULL' - ',ewv BYTEA NOT NULL' ') %s ;' ,table_name ,'PARTITION BY HASH (h_commitment)' @@ -79,30 +78,24 @@ BEGIN ,table_name ,partition_suffix ); - PERFORM comment_partitioned_column( - 'Exchange contributed values in the creation of the fresh coin (see /csr)' - ,'ewv' - ,table_name - ,partition_suffix - ); END $$; -CREATE FUNCTION constrain_table_withdraw_age_revealed_coins( +CREATE FUNCTION constrain_table_age_withdraw_revealed_coins( IN partition_suffix VARCHAR ) RETURNS void LANGUAGE plpgsql AS $$ DECLARE - table_name VARCHAR DEFAULT 'withdraw_age_revealed_coins'; + table_name VARCHAR DEFAULT 'age_withdraw_revealed_coins'; BEGIN table_name = concat_ws('_', table_name, partition_suffix); EXECUTE FORMAT ( 'ALTER TABLE ' || table_name || - ' ADD CONSTRAINT ' || table_name || '_withdraw_age_revealed_coins_id_key' - ' UNIQUE (withdraw_age_revealed_coins_id);' + ' ADD CONSTRAINT ' || table_name || '_age_withdraw_revealed_coins_id_key' + ' UNIQUE (age_withdraw_revealed_coins_id);' ); EXECUTE FORMAT ( 'ALTER TABLE ' || table_name || @@ -112,18 +105,18 @@ BEGIN END $$; -CREATE FUNCTION foreign_table_withdraw_age_revealed_coins() +CREATE FUNCTION foreign_table_age_withdraw_revealed_coins() RETURNS void LANGUAGE plpgsql AS $$ DECLARE - table_name VARCHAR DEFAULT 'withdraw_age_revealed_coins'; + table_name VARCHAR DEFAULT 'age_withdraw_revealed_coins'; BEGIN EXECUTE FORMAT ( 'ALTER TABLE ' || table_name || ' ADD CONSTRAINT ' || table_name || '_foreign_h_commitment' ' FOREIGN KEY (h_commitment)' - ' REFERENCES withdraw_age_commitments (h_commitment) ON DELETE CASCADE;' + ' REFERENCES age_withdraw_commitments (h_commitment) ON DELETE CASCADE;' ); EXECUTE FORMAT ( 'ALTER TABLE ' || table_name || @@ -142,17 +135,17 @@ INSERT INTO exchange_tables ,partitioned ,by_range) VALUES - ('withdraw_age_revealed_coins' + ('age_withdraw_revealed_coins' ,'exchange-0003' ,'create' ,TRUE ,FALSE), - ('withdraw_age_revealed_coins' + ('age_withdraw_revealed_coins' ,'exchange-0003' ,'constrain' ,TRUE ,FALSE), - ('withdraw_age_revealed_coins' + ('age_withdraw_revealed_coins' ,'exchange-0003' ,'foreign' ,TRUE diff --git a/src/exchangedb/exchange-0003.sql.in b/src/exchangedb/exchange-0003.sql.in index 5461c0dd3..01733ea24 100644 --- a/src/exchangedb/exchange-0003.sql.in +++ b/src/exchangedb/exchange-0003.sql.in @@ -25,6 +25,8 @@ SET search_path TO exchange; #include "0003-aml_status.sql" #include "0003-aml_staff.sql" #include "0003-aml_history.sql" +#include "0003-age_withdraw_commitments.sql" +#include "0003-age_withdraw_reveals.sql" COMMIT; diff --git a/src/exchangedb/pg_get_age_withdraw_info.c b/src/exchangedb/pg_get_age_withdraw_info.c index 754b572c9..f4a68b377 100644 --- a/src/exchangedb/pg_get_age_withdraw_info.c +++ b/src/exchangedb/pg_get_age_withdraw_info.c @@ -69,7 +69,7 @@ TEH_PG_get_age_withdraw_info ( ",amount_with_fee_val" ",amount_with_fee_frac" ",noreveal_index" - " FROM withdraw_age_commitments" + " FROM age_withdraw_commitments" " WHERE reserve_pub=$1 and h_commitment=$2;"); return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, "get_age_withdraw_info", diff --git a/src/exchangedb/pg_insert_age_withdraw_reveal.c b/src/exchangedb/pg_insert_age_withdraw_reveal.c index 336ed384f..ebba7ebbc 100644 --- a/src/exchangedb/pg_insert_age_withdraw_reveal.c +++ b/src/exchangedb/pg_insert_age_withdraw_reveal.c @@ -42,8 +42,8 @@ TEH_PG_insert_age_withdraw_reveal ( /* TODO */ #if 0 PREPARE (pg, - "insert_withdraw_age_revealed_coin", - "INSERT INTO withdraw_age_reveals " + "insert_age_withdraw_revealed_coin", + "INSERT INTO age_withdraw_reveals " "(h_commitment " ",freshcoin_index " ",denominations_serial " diff --git a/src/exchangedb/pg_insert_records_by_table.c b/src/exchangedb/pg_insert_records_by_table.c index 3ec9c77cc..e597f2bf5 100644 --- a/src/exchangedb/pg_insert_records_by_table.c +++ b/src/exchangedb/pg_insert_records_by_table.c @@ -2062,39 +2062,39 @@ irbt_cb_table_purse_deletion (struct PostgresClosure *pg, /** - * Function called with withdraw_age_commitments records to insert into table. + * Function called with age_withdraw_commitments records to insert into table. * * @param pg plugin context * @param td record to insert */ static enum GNUNET_DB_QueryStatus -irbt_cb_table_withdraw_age_commitments (struct PostgresClosure *pg, +irbt_cb_table_age_withdraw_commitments (struct PostgresClosure *pg, const struct TALER_EXCHANGEDB_TableData *td) { struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&td->serial), GNUNET_PQ_query_param_auto_from_type ( - &td->details.withdraw_age_commitments.h_commitment), + &td->details.age_withdraw_commitments.h_commitment), TALER_PQ_query_param_amount ( - &td->details.withdraw_age_commitments.amount_with_fee), + &td->details.age_withdraw_commitments.amount_with_fee), GNUNET_PQ_query_param_uint16 ( - &td->details.withdraw_age_commitments.max_age), + &td->details.age_withdraw_commitments.max_age), GNUNET_PQ_query_param_auto_from_type ( - &td->details.withdraw_age_commitments.reserve_pub), + &td->details.age_withdraw_commitments.reserve_pub), GNUNET_PQ_query_param_auto_from_type ( - &td->details.withdraw_age_commitments.reserve_sig), + &td->details.age_withdraw_commitments.reserve_sig), GNUNET_PQ_query_param_uint32 ( - &td->details.withdraw_age_commitments.noreveal_index), + &td->details.age_withdraw_commitments.noreveal_index), GNUNET_PQ_query_param_absolute_time ( - &td->details.withdraw_age_commitments.timestamp), + &td->details.age_withdraw_commitments.timestamp), GNUNET_PQ_query_param_end }; PREPARE (pg, - "insert_into_table_withdraw_age_commitments", - "INSERT INTO withdraw_age_commitments" - "(withdraw_age_commitment_id" + "insert_into_table_age_withdraw_commitments", + "INSERT INTO age_withdraw_commitments" + "(age_withdraw_commitment_id" ",h_commitment" ",amount_with_fee_val" ",amount_with_fee_frac" @@ -2106,19 +2106,19 @@ irbt_cb_table_withdraw_age_commitments (struct PostgresClosure *pg, ") VALUES " "($1, $2, $3, $4, $5, $6, $7, $8, $9);"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "insert_into_table_withdraw_age_commitments", + "insert_into_table_age_withdraw_commitments", params); } /** - * Function called with withdraw_age_revealed_coins records to insert into table. + * Function called with age_withdraw_revealed_coins records to insert into table. * * @param pg plugin context * @param td record to insert */ static enum GNUNET_DB_QueryStatus -irbt_cb_table_withdraw_age_revealed_coins (struct PostgresClosure *pg, +irbt_cb_table_age_withdraw_revealed_coins (struct PostgresClosure *pg, const struct TALER_EXCHANGEDB_TableData *td) { @@ -2126,26 +2126,26 @@ irbt_cb_table_withdraw_age_revealed_coins (struct PostgresClosure *pg, struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&td->serial), GNUNET_PQ_query_param_auto_from_type ( - &td->details.withdraw_age_revealed_coins.h_commitment), + &td->details.age_withdraw_revealed_coins.h_commitment), GNUNET_PQ_query_param_uint32 ( - &td->details.withdraw_age_revealed_coins.freshcoin_index), + &td->details.age_withdraw_revealed_coins.freshcoin_index), GNUNET_PQ_query_param_uint64 ( - &td->details.withdraw_age_revealed_coins.denominations_serial), + &td->details.age_withdraw_revealed_coins.denominations_serial), GNUNET_PQ_query_param_fixed_size ( - td->details.withdraw_age_revealed_coins.coin_ev, - td->details.withdraw_age_revealed_coins.coin_ev_size), + td->details.age_withdraw_revealed_coins.coin_ev, + td->details.age_withdraw_revealed_coins.coin_ev_size), GNUNET_PQ_query_param_auto_from_type (&h_coin_ev), TALER_PQ_query_param_blinded_denom_sig ( - &td->details.withdraw_age_revealed_coins.ev_sig), + &td->details.age_withdraw_revealed_coins.ev_sig), TALER_PQ_query_param_exchange_withdraw_values ( - &td->details.withdraw_age_revealed_coins.ewv), + &td->details.age_withdraw_revealed_coins.ewv), GNUNET_PQ_query_param_end }; PREPARE (pg, - "insert_into_table_withdraw_age_revealed_coins", - "INSERT INTO withdraw_age_revealed_coins" - "(withdraw_age_revealed_coins_id" + "insert_into_table_age_withdraw_revealed_coins", + "INSERT INTO age_withdraw_revealed_coins" + "(age_withdraw_revealed_coins_id" ",h_commitment" ",freshcoin_index" ",denominations_serial" @@ -2156,12 +2156,12 @@ irbt_cb_table_withdraw_age_revealed_coins (struct PostgresClosure *pg, ") VALUES " "($1, $2, $3, $4, $5, $6, $7, $8);"); - GNUNET_CRYPTO_hash (td->details.withdraw_age_revealed_coins.coin_ev, - td->details.withdraw_age_revealed_coins.coin_ev_size, + GNUNET_CRYPTO_hash (td->details.age_withdraw_revealed_coins.coin_ev, + td->details.age_withdraw_revealed_coins.coin_ev_size, &h_coin_ev); return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "insert_into_table_withdraw_age_revealed_coins", + "insert_into_table_age_withdraw_revealed_coins", params); } @@ -2314,10 +2314,10 @@ TEH_PG_insert_records_by_table (void *cls, rh = &irbt_cb_table_purse_deletion; break; case TALER_EXCHANGEDB_RT_WITHDRAW_AGE_COMMITMENTS: - rh = &irbt_cb_table_withdraw_age_commitments; + rh = &irbt_cb_table_age_withdraw_commitments; break; case TALER_EXCHANGEDB_RT_WITHDRAW_AGE_REVEALED_COINS: - rh = &irbt_cb_table_withdraw_age_revealed_coins; + rh = &irbt_cb_table_age_withdraw_revealed_coins; break; } if (NULL == rh) diff --git a/src/exchangedb/pg_lookup_records_by_table.c b/src/exchangedb/pg_lookup_records_by_table.c index 2e157360f..efa0fec54 100644 --- a/src/exchangedb/pg_lookup_records_by_table.c +++ b/src/exchangedb/pg_lookup_records_by_table.c @@ -2767,14 +2767,14 @@ lrbt_cb_table_purse_deletion (void *cls, /** - * Function called with withdraw_age_commitments table entries. + * Function called with age_withdraw_commitments table entries. * * @param cls closure * @param result the postgres result * @param num_results the number of results in @a result */ static void -lrbt_cb_table_withdraw_age_commitments (void *cls, +lrbt_cb_table_age_withdraw_commitments (void *cls, PGresult *result, unsigned int num_results) { @@ -2788,26 +2788,26 @@ lrbt_cb_table_withdraw_age_commitments (void *cls, { struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_uint64 ( - "withdraw_age_commitment_id", + "age_withdraw_commitment_id", &td.serial), GNUNET_PQ_result_spec_auto_from_type ( "h_commitment", - &td.details.withdraw_age_commitments.h_commitment), + &td.details.age_withdraw_commitments.h_commitment), GNUNET_PQ_result_spec_uint16 ( "max_age", - &td.details.withdraw_age_commitments.max_age), + &td.details.age_withdraw_commitments.max_age), TALER_PQ_RESULT_SPEC_AMOUNT ( "amount_with_fee", - &td.details.withdraw_age_commitments.amount_with_fee), + &td.details.age_withdraw_commitments.amount_with_fee), GNUNET_PQ_result_spec_auto_from_type ( "reserve_pub", - &td.details.withdraw_age_commitments.reserve_pub), + &td.details.age_withdraw_commitments.reserve_pub), GNUNET_PQ_result_spec_auto_from_type ( "reserve_sig", - &td.details.withdraw_age_commitments.reserve_sig), + &td.details.age_withdraw_commitments.reserve_sig), GNUNET_PQ_result_spec_uint32 ( "noreveal_index", - &td.details.withdraw_age_commitments.noreveal_index), + &td.details.age_withdraw_commitments.noreveal_index), GNUNET_PQ_result_spec_end }; @@ -2828,14 +2828,14 @@ lrbt_cb_table_withdraw_age_commitments (void *cls, /** - * Function called with withdraw_age_revealed_coins table entries. + * Function called with age_withdraw_revealed_coins table entries. * * @param cls closure * @param result the postgres result * @param num_results the number of results in @a result */ static void -lrbt_cb_table_withdraw_age_revealed_coins (void *cls, +lrbt_cb_table_age_withdraw_revealed_coins (void *cls, PGresult *result, unsigned int num_results) { @@ -2848,22 +2848,22 @@ lrbt_cb_table_withdraw_age_revealed_coins (void *cls, { struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_uint64 ( - "withdraw_age_revealed_coins_id", + "age_withdraw_revealed_coins_id", &td.serial), GNUNET_PQ_result_spec_auto_from_type ( "h_commitment", - &td.details.withdraw_age_revealed_coins.h_commitment), + &td.details.age_withdraw_revealed_coins.h_commitment), GNUNET_PQ_result_spec_uint32 ( "freshcoin_index", - &td.details.withdraw_age_revealed_coins.freshcoin_index), + &td.details.age_withdraw_revealed_coins.freshcoin_index), GNUNET_PQ_result_spec_uint64 ( "denominations_serial", - &td.details.withdraw_age_revealed_coins.denominations_serial), + &td.details.age_withdraw_revealed_coins.denominations_serial), /* Note: h_coin_ev is recalculated */ GNUNET_PQ_result_spec_variable_size ( "coin_ev", - (void **) &td.details.withdraw_age_revealed_coins.coin_ev, - &td.details.withdraw_age_revealed_coins.coin_ev_size), + (void **) &td.details.age_withdraw_revealed_coins.coin_ev, + &td.details.age_withdraw_revealed_coins.coin_ev_size), TALER_PQ_result_spec_blinded_denom_sig ( "ev_sig", &td.details.refresh_revealed_coins.ev_sig), @@ -3598,9 +3598,9 @@ TEH_PG_lookup_records_by_table (void *cls, rh = &lrbt_cb_table_purse_deletion; break; case TALER_EXCHANGEDB_RT_WITHDRAW_AGE_COMMITMENTS: - XPREPARE ("select_above_serial_by_table_withdraw_age_commitments", + XPREPARE ("select_above_serial_by_table_age_withdraw_commitments", "SELECT" - " withdraw_age_commitment_id" + " age_withdraw_commitment_id" ",h_commitment" ",amount_with_fee_val" ",amount_with_fee_frac" @@ -3608,15 +3608,15 @@ TEH_PG_lookup_records_by_table (void *cls, ",reserve_pub" ",reserve_sig" ",noreveal_index" - " FROM withdraw_age_commitments" - " WHERE withdraw_age_commitment_id > $1" - " ORDER BY withdraw_age_commitment_id ASC;"); - rh = &lrbt_cb_table_withdraw_age_commitments; + " FROM age_withdraw_commitments" + " WHERE age_withdraw_commitment_id > $1" + " ORDER BY age_withdraw_commitment_id ASC;"); + rh = &lrbt_cb_table_age_withdraw_commitments; break; case TALER_EXCHANGEDB_RT_WITHDRAW_AGE_REVEALED_COINS: - XPREPARE ("select_above_serial_by_table_withdraw_age_revealed_coins", + XPREPARE ("select_above_serial_by_table_age_withdraw_revealed_coins", "SELECT" - " withdraw_age_revealed_coins_serial_id" + " age_withdraw_revealed_coins_serial_id" ",h_commitment" ",freshcoin_index" ",denominations_serial" @@ -3624,10 +3624,10 @@ TEH_PG_lookup_records_by_table (void *cls, ",h_coin_ev" ",ev_sig" ",ewv" - " FROM withdraw_age_revealed_coins" - " WHERE withdraw_age_revealed_coins_serial_id > $1" - " ORDER BY withdraw_age_revealed_coins_serial_id ASC;"); - rh = &lrbt_cb_table_withdraw_age_revealed_coins; + " FROM age_withdraw_revealed_coins" + " WHERE age_withdraw_revealed_coins_serial_id > $1" + " ORDER BY age_withdraw_revealed_coins_serial_id ASC;"); + rh = &lrbt_cb_table_age_withdraw_revealed_coins; break; } if (NULL == rh) diff --git a/src/exchangedb/pg_lookup_serial_by_table.c b/src/exchangedb/pg_lookup_serial_by_table.c index c98b4539e..2e3b41304 100644 --- a/src/exchangedb/pg_lookup_serial_by_table.c +++ b/src/exchangedb/pg_lookup_serial_by_table.c @@ -427,22 +427,22 @@ TEH_PG_lookup_serial_by_table (void *cls, statement = "select_serial_by_table_purse_deletion"; break; case TALER_EXCHANGEDB_RT_WITHDRAW_AGE_COMMITMENTS: - XPREPARE ("select_serial_by_table_withdraw_age_commitments", + XPREPARE ("select_serial_by_table_age_withdraw_commitments", "SELECT" - " withdraw_age_commitment_id AS serial" - " FROM withdraw_age_commitments" - " ORDER BY withdraw_age_commitment_id DESC" + " age_withdraw_commitment_id AS serial" + " FROM age_withdraw_commitments" + " ORDER BY age_withdraw_commitment_id DESC" " LIMIT 1;"); - statement = "select_serial_by_table_withdraw_age_commitments"; + statement = "select_serial_by_table_age_withdraw_commitments"; break; case TALER_EXCHANGEDB_RT_WITHDRAW_AGE_REVEALED_COINS: - XPREPARE ("select_serial_by_table_withdraw_age_revealed_coins", + XPREPARE ("select_serial_by_table_age_withdraw_revealed_coins", "SELECT" - " withdraw_age_revealed_coins_id AS serial" - " FROM withdraw_age_revealed_coins" - " ORDER BY withdraw_age_revealed_coins_id DESC" + " age_withdraw_revealed_coins_id AS serial" + " FROM age_withdraw_revealed_coins" + " ORDER BY age_withdraw_revealed_coins_id DESC" " LIMIT 1;"); - statement = "select_serial_by_table_withdraw_age_revealed_coins"; + statement = "select_serial_by_table_age_withdraw_revealed_coins"; break; } if (NULL == statement) |