From 99de3a49c3c336418a53c6a1842cf4b2e45d80dc Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 27 Nov 2020 14:46:48 +0100 Subject: add tables for signing key revocation and for wire accounts --- src/exchangedb/exchange-0002.sql | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src/exchangedb/exchange-0002.sql') diff --git a/src/exchangedb/exchange-0002.sql b/src/exchangedb/exchange-0002.sql index a670876af..04f1a3621 100644 --- a/src/exchangedb/exchange-0002.sql +++ b/src/exchangedb/exchange-0002.sql @@ -42,7 +42,6 @@ COMMENT ON INDEX prepare_get_index IS 'for wire_prepare_data_get'; - CREATE TABLE IF NOT EXISTS future_denominations (denom_pub_hash BYTEA PRIMARY KEY CHECK (LENGTH(denom_pub_hash)=64) ,denom_pub BYTEA NOT NULL @@ -131,5 +130,31 @@ COMMENT ON COLUMN exchange_sign_keys.legal_end IS 'Time when this online signing key legally expires.'; +CREATE TABLE IF NOT EXISTS wire_accounts + (payto_uri VARCHAR PRIMARY KEY + ,master_pub BYTEA NOT NULL CHECK (LENGTH(master_pub)=32) + ,master_sig BYTEA CHECK (LENGTH(master_sig)=64) + ,is_active BOOLEAN NOT NULL + ,last_change INT8 NOT NULL + ); +COMMENT ON TABLE wire_accounts + IS 'Table with current and historic bank accounts of the exchange. Entries never expire as we need to remember the last_change column indefinitely.'; +COMMENT ON COLUMN wire_accounts.payto_uri + IS 'payto URI (RFC 8905) with the bank account of the exchange.'; +COMMENT ON COLUMN wire_accounts.is_active + IS 'true if we are currently supporting the use of this account.'; +COMMENT ON COLUMN wire_accounts.last_change + IS 'Latest time when active status changed. Used to detect replays of old messages.'; + + +CREATE TABLE IF NOT EXISTS signkey_revocations + (signkey_revocations_serial_id BIGSERIAL UNIQUE + ,exchange_pub BYTEA PRIMARY KEY REFERENCES exchange_sign_keys (exchange_pub) ON DELETE CASCADE + ,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64) + ); +COMMENT ON TABLE signkey_revocations + IS 'remembering which online signing keys have been revoked'; + + -- Complete transaction COMMIT; -- cgit v1.2.3