-fix wire_deadline SQL

This commit is contained in:
Christian Grothoff 2021-11-06 20:21:36 +01:00
parent e8943b019c
commit fadfc735fa
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
2 changed files with 28 additions and 26 deletions

View File

@ -30,7 +30,7 @@ COMMENT ON TABLE auditor_exchanges
CREATE TABLE IF NOT EXISTS auditor_exchange_signkeys
(master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
(master_pub BYTEA NOT NULL CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,ep_start INT8 NOT NULL
,ep_expire INT8 NOT NULL
,ep_end INT8 NOT NULL
@ -42,7 +42,7 @@ COMMENT ON TABLE auditor_exchange_signkeys
CREATE TABLE IF NOT EXISTS auditor_progress_reserve
(master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
(master_pub BYTEA NOT NULL CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,last_reserve_in_serial_id INT8 NOT NULL DEFAULT 0
,last_reserve_out_serial_id INT8 NOT NULL DEFAULT 0
,last_reserve_recoup_serial_id INT8 NOT NULL DEFAULT 0
@ -65,7 +65,7 @@ COMMENT ON TABLE auditor_progress_aggregation
CREATE TABLE IF NOT EXISTS auditor_progress_deposit_confirmation
(master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
(master_pub BYTEA NOT NULL CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,last_deposit_confirmation_serial_id INT8 NOT NULL DEFAULT 0
,PRIMARY KEY (master_pub)
);
@ -75,7 +75,7 @@ COMMENT ON TABLE auditor_progress_deposit_confirmation
CREATE TABLE IF NOT EXISTS auditor_progress_coin
(master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
(master_pub BYTEA NOT NULL CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,last_withdraw_serial_id INT8 NOT NULL DEFAULT 0
,last_deposit_serial_id INT8 NOT NULL DEFAULT 0
,last_melt_serial_id INT8 NOT NULL DEFAULT 0
@ -90,12 +90,12 @@ COMMENT ON TABLE auditor_progress_coin
CREATE TABLE IF NOT EXISTS wire_auditor_account_progress
(master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
(master_pub BYTEA NOT NULL CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,account_name TEXT NOT NULL
,last_wire_reserve_in_serial_id INT8 NOT NULL DEFAULT 0
,last_wire_wire_out_serial_id INT8 NOT NULL DEFAULT 0
,wire_in_off INT8
,wire_out_off INT8
,wire_in_off INT8 NOT NULL
,wire_out_off INT8 NOT NULL
,PRIMARY KEY (master_pub,account_name)
);
COMMENT ON TABLE wire_auditor_account_progress
@ -104,7 +104,7 @@ COMMENT ON TABLE wire_auditor_account_progress
CREATE TABLE IF NOT EXISTS wire_auditor_progress
(master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
(master_pub BYTEA NOT NULL CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,last_timestamp INT8 NOT NULL
,last_reserve_close_uuid INT8 NOT NULL
,PRIMARY KEY (master_pub)
@ -113,7 +113,7 @@ CREATE TABLE IF NOT EXISTS wire_auditor_progress
CREATE TABLE IF NOT EXISTS auditor_reserves
(reserve_pub BYTEA NOT NULL CHECK(LENGTH(reserve_pub)=32)
,master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,master_pub BYTEA NOT NULL CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,reserve_balance_val INT8 NOT NULL
,reserve_balance_frac INT4 NOT NULL
,withdraw_fee_balance_val INT8 NOT NULL
@ -131,7 +131,7 @@ CREATE INDEX IF NOT EXISTS auditor_reserves_by_reserve_pub
CREATE TABLE IF NOT EXISTS auditor_reserve_balance
(master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
(master_pub BYTEA NOT NULL CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,reserve_balance_val INT8 NOT NULL
,reserve_balance_frac INT4 NOT NULL
,withdraw_fee_balance_val INT8 NOT NULL
@ -142,7 +142,7 @@ COMMENT ON TABLE auditor_reserve_balance
CREATE TABLE IF NOT EXISTS auditor_wire_fee_balance
(master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
(master_pub BYTEA NOT NULL CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,wire_fee_balance_val INT8 NOT NULL
,wire_fee_balance_frac INT4 NOT NULL
);
@ -173,7 +173,7 @@ COMMENT ON COLUMN auditor_denomination_pending.recoup_loss_val
CREATE TABLE IF NOT EXISTS auditor_balance_summary
(master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
(master_pub BYTEA NOT NULL CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,denom_balance_val INT8 NOT NULL
,denom_balance_frac INT4 NOT NULL
,deposit_fee_balance_val INT8 NOT NULL
@ -194,7 +194,7 @@ COMMENT ON TABLE auditor_balance_summary
CREATE TABLE IF NOT EXISTS auditor_historic_denomination_revenue
(master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
(master_pub BYTEA NOT NULL CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,denom_pub_hash BYTEA PRIMARY KEY CHECK (LENGTH(denom_pub_hash)=64)
,revenue_timestamp INT8 NOT NULL
,revenue_balance_val INT8 NOT NULL
@ -209,7 +209,7 @@ COMMENT ON COLUMN auditor_historic_denomination_revenue.revenue_balance_val
CREATE TABLE IF NOT EXISTS auditor_historic_reserve_summary
(master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
(master_pub BYTEA NOT NULL CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,start_date INT8 NOT NULL
,end_date INT8 NOT NULL
,reserve_profits_val INT8 NOT NULL
@ -225,21 +225,21 @@ CREATE INDEX IF NOT EXISTS auditor_historic_reserve_summary_by_master_pub_start_
CREATE TABLE IF NOT EXISTS deposit_confirmations
(master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,serial_id BIGSERIAL UNIQUE
,h_contract_terms BYTEA CHECK (LENGTH(h_contract_terms)=64)
,h_extensions BYTEA CHECK (LENGTH(h_contract_terms)=64)
,h_wire BYTEA CHECK (LENGTH(h_wire)=64)
(master_pub BYTEA NOT NULL CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,serial_id BIGSERIAL NOT NULL UNIQUE
,h_contract_terms BYTEA NOT NULL CHECK (LENGTH(h_contract_terms)=64)
,h_extensions BYTEA NOT NULL CHECK (LENGTH(h_contract_terms)=64)
,h_wire BYTEA NOT NULL CHECK (LENGTH(h_wire)=64)
,exchange_timestamp INT8 NOT NULL
,refund_deadline INT8 NOT NULL
,wire_deadline INT8 NOT NULL
,amount_without_fee_val INT8 NOT NULL
,amount_without_fee_frac INT4 NOT NULL
,coin_pub BYTEA CHECK (LENGTH(coin_pub)=32)
,merchant_pub BYTEA CHECK (LENGTH(merchant_pub)=32)
,exchange_sig BYTEA CHECK (LENGTH(exchange_sig)=64)
,exchange_pub BYTEA CHECK (LENGTH(exchange_pub)=32)
,master_sig BYTEA CHECK (LENGTH(master_sig)=64)
,coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)
,merchant_pub BYTEA NOT NULL CHECK (LENGTH(merchant_pub)=32)
,exchange_sig BYTEA NOT NULL CHECK (LENGTH(exchange_sig)=64)
,exchange_pub BYTEA NOT NULL CHECK (LENGTH(exchange_pub)=32)
,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
,PRIMARY KEY (h_contract_terms,h_wire,coin_pub,merchant_pub,exchange_sig,exchange_pub,master_sig)
);
COMMENT ON TABLE deposit_confirmations
@ -247,7 +247,7 @@ COMMENT ON TABLE deposit_confirmations
CREATE TABLE IF NOT EXISTS auditor_predicted_result
(master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
(master_pub BYTEA NOT NULL CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,balance_val INT8 NOT NULL
,balance_frac INT4 NOT NULL
);

View File

@ -207,8 +207,10 @@ setup_connection (struct PostgresClosure *pg)
"SELECT"
" serial_id"
",h_contract_terms"
",h_extensions"
",h_wire"
",exchange_timestamp"
",wire_deadline"
",refund_deadline"
",amount_without_fee_val"
",amount_without_fee_frac"
@ -1113,7 +1115,7 @@ deposit_confirmation_cb (void *cls,
GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms",
&dc.h_contract_terms),
GNUNET_PQ_result_spec_auto_from_type ("h_extensions",
&dc.h_contract_terms),
&dc.h_extensions),
GNUNET_PQ_result_spec_auto_from_type ("h_wire",
&dc.h_wire),
GNUNET_PQ_result_spec_absolute_time ("exchange_timestamp",