lsps2: extend store for forwarding

This commit is contained in:
Jesse de Wit
2023-08-31 13:03:52 +02:00
parent e0e56893d6
commit c3f13e999f
4 changed files with 198 additions and 1 deletions

View File

@@ -1,3 +1,5 @@
DROP INDEX idx_lsps2_bought_channels_registration_id;
DROP TABLE lsps2.bought_channels;
DROP INDEX idx_lsps2_buy_registrations_valid_until;
DROP INDEX idx_lsps2_buy_registrations_scid;
DROP TABLE lsps2.buy_registrations;

View File

@@ -15,3 +15,18 @@ CREATE TABLE lsps2.buy_registrations (
);
CREATE UNIQUE INDEX idx_lsps2_buy_registrations_scid ON lsps2.buy_registrations (scid);
CREATE INDEX idx_lsps2_buy_registrations_valid_until ON lsps2.buy_registrations (params_valid_until);
CREATE TABLE lsps2.bought_channels (
id bigserial PRIMARY KEY,
registration_id bigint NOT NULL,
funding_tx_id bytea NOT NULL,
funding_tx_outnum bigint NOT NULL,
fee_msat bigint NOT NULL,
payment_size_msat bigint NOT NULL,
is_completed boolean NOT NULL,
CONSTRAINT fk_buy_registration
FOREIGN KEY(registration_id)
REFERENCES lsps2.buy_registrations(id)
ON DELETE CASCADE
);
CREATE INDEX idx_lsps2_bought_channels_registration_id ON lsps2.bought_channels (registration_id);