You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We only store information about our peers when we succeed in making an
outgoing connection to them. The only informaiton we stored was the
address that we used when connecting. We now also store the features
supported by our peer when we last connected to them.
It's important to note that this means that we currently don't store
peers that always connect to us (e.g. mobile wallet users that never
have a stable address): we will address that in the next commit.
statement.executeUpdate("CREATE SCHEMA IF NOT EXISTS local")
66
-
statement.executeUpdate("CREATE TABLE local.peers (node_id TEXT NOT NULL PRIMARY KEY, data BYTEA NOT NULL)")
72
+
statement.executeUpdate("CREATE TABLE local.peers (node_id TEXT NOT NULL PRIMARY KEY, node_address BYTEA, node_features BYTEA)")
67
73
statement.executeUpdate("CREATE TABLE local.relay_fees (node_id TEXT NOT NULL PRIMARY KEY, fee_base_msat BIGINT NOT NULL, fee_proportional_millionths BIGINT NOT NULL)")
68
74
statement.executeUpdate("CREATE TABLE local.peer_storage (node_id TEXT NOT NULL PRIMARY KEY, data BYTEA NOT NULL, last_updated_at TIMESTAMP WITH TIME ZONE NOT NULL, removed_peer_at TIMESTAMP WITH TIME ZONE)")
69
75
70
76
statement.executeUpdate("CREATE INDEX removed_peer_at_idx ON local.peer_storage(removed_peer_at)")
71
-
caseSome(v@(1|2|3)) =>
77
+
caseSome(v@(1|2|3|4)) =>
72
78
logger.warn(s"migrating db $DB_NAME, found version=$v current=$CURRENT_VERSION")
73
79
if (v <2) {
74
80
migration12(statement)
@@ -79,26 +85,47 @@ class PgPeersDb(implicit ds: DataSource, lock: PgLock) extends PeersDb with Logg
79
85
if (v <4) {
80
86
migration34(statement)
81
87
}
88
+
if (v <5) {
89
+
migration45(statement)
90
+
}
82
91
caseSome(CURRENT_VERSION) => () // table is up-to-date, nothing to do
83
92
caseSome(unknownVersion) =>thrownewRuntimeException(s"Unknown version of DB $DB_NAME found, version=$unknownVersion")
0 commit comments