mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-09 09:15:35 +02:00
sqldb/sqlc: add zombie index table
Note that this table will only contain entries for channels that we have deleted from the `channels` table which is why we cannot use foreign keys. Similarly, we may no longer have node entries for the nodes in the table.
This commit is contained in:
@@ -25,4 +25,6 @@ DROP TABLE IF EXISTS source_nodes;
|
|||||||
DROP TABLE IF EXISTS node_addresses;
|
DROP TABLE IF EXISTS node_addresses;
|
||||||
DROP TABLE IF EXISTS node_features;
|
DROP TABLE IF EXISTS node_features;
|
||||||
DROP TABLE IF EXISTS node_extra_types;
|
DROP TABLE IF EXISTS node_extra_types;
|
||||||
DROP TABLE IF EXISTS nodes;
|
DROP TABLE IF EXISTS nodes;
|
||||||
|
DROP TABLE IF EXISTS channel_policy_extra_types;
|
||||||
|
DROP TABLE IF EXISTS zombie_channels;
|
@@ -292,3 +292,31 @@ CREATE TABLE IF NOT EXISTS channel_policy_extra_types (
|
|||||||
CREATE UNIQUE INDEX IF NOT EXISTS channel_policy_extra_types_unique ON channel_policy_extra_types (
|
CREATE UNIQUE INDEX IF NOT EXISTS channel_policy_extra_types_unique ON channel_policy_extra_types (
|
||||||
type, channel_policy_id
|
type, channel_policy_id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/* ─────────────────────────────────────────────
|
||||||
|
Other graph related tables
|
||||||
|
─────────────────────────────────────────────
|
||||||
|
*/
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS zombie_channels (
|
||||||
|
-- The channel id (short channel id) of the channel.
|
||||||
|
-- NOTE: we don't use a foreign key here to the `channels`
|
||||||
|
-- table since we may delete the channel record once it
|
||||||
|
-- is marked as a zombie.
|
||||||
|
scid BLOB NOT NULL,
|
||||||
|
|
||||||
|
-- The protocol version that this node was gossiped on.
|
||||||
|
version SMALLINT NOT NULL,
|
||||||
|
|
||||||
|
-- The public key of the node 1 node of the channel. If
|
||||||
|
-- this is not null, it means an update from this node
|
||||||
|
-- will be able to resurrect the channel.
|
||||||
|
node_key_1 BLOB,
|
||||||
|
|
||||||
|
-- The public key of the node 2 node of the channel. If
|
||||||
|
-- this is not null, it means an update from this node
|
||||||
|
-- will be able to resurrect the channel.
|
||||||
|
node_key_2 BLOB
|
||||||
|
);
|
||||||
|
CREATE UNIQUE INDEX IF NOT EXISTS zombie_channels_channel_id_version_idx
|
||||||
|
ON zombie_channels(scid, version);
|
||||||
|
@@ -184,3 +184,10 @@ type NodeFeature struct {
|
|||||||
type SourceNode struct {
|
type SourceNode struct {
|
||||||
NodeID int64
|
NodeID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ZombieChannel struct {
|
||||||
|
Scid []byte
|
||||||
|
Version int16
|
||||||
|
NodeKey1 []byte
|
||||||
|
NodeKey2 []byte
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user