diff options
Diffstat (limited to 'src/exchangedb/0003-age_withdraw_commitments.sql')
-rw-r--r-- | src/exchangedb/0003-age_withdraw_commitments.sql | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/exchangedb/0003-age_withdraw_commitments.sql b/src/exchangedb/0003-age_withdraw_commitments.sql index d74a697c..3106a07a 100644 --- a/src/exchangedb/0003-age_withdraw_commitments.sql +++ b/src/exchangedb/0003-age_withdraw_commitments.sql @@ -26,20 +26,21 @@ BEGIN PERFORM create_partitioned_table( 'CREATE TABLE %I' '(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 CHECK (LENGTH(reserve_pub)=32)' - ',reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64)' - ',noreveal_index INT4 NOT NULL' + ',h_commitment BYTEA NOT NULL CONSTRAINT h_commitment_length CHECK(LENGTH(h_commitment)=64)' + ',max_age SMALLINT NOT NULL CONSTRAINT max_age_positive CHECK(max_age>=0)' + ',reserve_pub BYTEA NOT NULL CONSTRAINT reserve_pub_length CHECK(LENGTH(reserve_pub)=32)' + ',reserve_sig BYTEA NOT NULL CONSTRAINT reserve_sig_length CHECK(LENGTH(reserve_sig)=64)' + ',noreveal_index SMALLINT NOT NULL CONSTRAINT noreveal_index_positive CHECK(noreveal_index>=0)' + ',denominations_serials INT8[] NOT NULL CONSTRAINT denominations_serial_array_length CHECK(cardinality(denominations_serials)=cardinality(denom_sigs))' + ',denom_sigs BYTEA[] NOT NULL CONSTRAINT denom_sigs_array_length CHECK(cardinality(denom_sigs)=cardinality(denominations_serials))' ') %s ;' ,table_name ,'PARTITION BY HASH (reserve_pub)' ,partition_suffix ); PERFORM comment_partitioned_table( - 'Commitments made when withdrawing coins with age restriction and the gamma value chosen by the exchange.' + 'Commitments made when withdrawing coins with age restriction and the gamma value chosen by the exchange. ' + 'It also contains the blindly signed coins and related denominations.' ,table_name ,partition_suffix ); @@ -68,11 +69,23 @@ BEGIN ,partition_suffix ); PERFORM comment_partitioned_column( - 'Signature of the reserve''s private key over the withdraw-age request' + 'Signature of the reserve''s private key over the age-withdraw request' ,'reserve_sig' ,table_name ,partition_suffix ); + PERFORM comment_partitioned_column( + 'Array of references to the denominations' + ,'denominations_serials' + ,table_name + ,partition_suffix + ); + PERFORM comment_partitioned_column( + 'Array of signatures over the blinded envelopes' + ,'denom_sigs' + ,table_name + ,partition_suffix + ); END $$; @@ -122,13 +135,13 @@ END $$; -INSERT INTO exchange_tables +INSERT INTO exchange_tables (name ,version ,action ,partitioned ,by_range) -VALUES +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); |