diff options
Diffstat (limited to 'src/exchangedb/0003-withdraw_age_reveals.sql')
-rw-r--r-- | src/exchangedb/0003-withdraw_age_reveals.sql | 51 |
1 files changed, 36 insertions, 15 deletions
diff --git a/src/exchangedb/0003-withdraw_age_reveals.sql b/src/exchangedb/0003-withdraw_age_reveals.sql index 3353d9367..af66eab75 100644 --- a/src/exchangedb/0003-withdraw_age_reveals.sql +++ b/src/exchangedb/0003-withdraw_age_reveals.sql @@ -14,22 +14,25 @@ -- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> -- -CREATE FUNCTION create_table_withdraw_age_reveals( +CREATE FUNCTION create_table_withdraw_age_revealed_coins( IN partition_suffix VARCHAR DEFAULT NULL ) RETURNS VOID LANGUAGE plpgsql AS $$ DECLARE - table_name VARCHAR DEFAULT 'withdraw_age_reveals'; + table_name VARCHAR DEFAULT 'withdraw_age_revealed_coins'; BEGIN PERFORM create_partitioned_table( 'CREATE TABLE %I' - '(withdraw_age_reveals_id BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE - ',h_commitment BYTEA NOT NULL CHECK (LENGTH(h_commitment)=32)' + '(withdraw_age_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' - ',h_coin_ev BYTEA CHECK (LENGTH(h_coin_ev)=32)' + ',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)' @@ -59,29 +62,47 @@ BEGIN ,partition_suffix ); PERFORM comment_partitioned_column( - 'Hash of the blinded coins' + 'Envelope of the new coin to be signed' + ,'coin_ev' + ,table_name + ,partition_suffix + ); + PERFORM comment_partitioned_column( + 'Hash of the envelope of the new coin to be signed (for lookups)' ,'h_coin_ev' ,table_name ,partition_suffix ); + PERFORM comment_partitioned_column( + 'Exchange signature over the envelope' + ,'ev_sig' + ,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_reveals( +CREATE FUNCTION constrain_table_withdraw_age_revealed_coins( IN partition_suffix VARCHAR ) RETURNS void LANGUAGE plpgsql AS $$ DECLARE - table_name VARCHAR DEFAULT 'withdraw_age_reveals'; + table_name VARCHAR DEFAULT 'withdraw_age_revealed_coins'; BEGIN table_name = concat_ws('_', table_name, partition_suffix); EXECUTE FORMAT ( 'ALTER TABLE ' || table_name || - ' ADD CONSTRAINT ' || table_name || '_withdraw_age_reveals_id_key' - ' UNIQUE (withdraw_age_reveals_id);' + ' ADD CONSTRAINT ' || table_name || '_withdraw_age_revealed_coins_id_key' + ' UNIQUE (withdraw_age_revealed_coins_id);' ); EXECUTE FORMAT ( 'ALTER TABLE ' || table_name || @@ -91,12 +112,12 @@ BEGIN END $$; -CREATE FUNCTION foreign_table_withdraw_age_reveals() +CREATE FUNCTION foreign_table_withdraw_age_revealed_coins() RETURNS void LANGUAGE plpgsql AS $$ DECLARE - table_name VARCHAR DEFAULT 'withdraw_age_reveals'; + table_name VARCHAR DEFAULT 'withdraw_age_revealed_coins'; BEGIN EXECUTE FORMAT ( 'ALTER TABLE ' || table_name || @@ -121,17 +142,17 @@ INSERT INTO exchange_tables ,partitioned ,by_range) VALUES - ('withdraw_age_reveals' + ('withdraw_age_revealed_coins' ,'exchange-0003' ,'create' ,TRUE ,FALSE), - ('withdraw_age_reveals' + ('withdraw_age_revealed_coins' ,'exchange-0003' ,'constrain' ,TRUE ,FALSE), - ('withdraw_age_reveals' + ('withdraw_age_revealed_coins' ,'exchange-0003' ,'foreign' ,TRUE |