watchtower/wtdb: add tower-to-session index entry for all towers

In this commit, a small migration is added to the watchtower client DB
to ensure that there is an entry in the towerID-to-sessionID index for
all towers in the db regardless of if they have sessions or not. This is
required as a follow up to migration 1 since that migration only created
entries in the index for towers that had associated sessions which would
lead to "tower not found" errors on start up.
This commit is contained in:
Elle Mouton committed 2023-03-08 11:00:40 +02:00
1 parent d26cfd241a
commit f6ef3db6ea
7 files changed
+313 -1

No files matched your search

+4
View File
@@ -9,6 +9,7 @@ import (
"github.com/lightningnetwork/lnd/watchtower/wtdb/migration2"
"github.com/lightningnetwork/lnd/watchtower/wtdb/migration3"
"github.com/lightningnetwork/lnd/watchtower/wtdb/migration4"
"github.com/lightningnetwork/lnd/watchtower/wtdb/migration5"
)
// txMigration is a function which takes a prior outdated version of the
@@ -55,6 +56,9 @@ var clientDBVersions = []version{
migration4.DefaultSessionsPerTx,
),
},
{
txMigration: migration5.MigrateCompleteTowerToSessionIndex,
},
}
// getLatestDBVersion returns the last known database version.