watchtower: add sessionID index

In this commit, a new session-ID index is added to the tower client db
with the help of a migration. This index holds a mapping from a
db-assigned-ID (a uint64 encoded using BigSize encoding) to real session
ID (33 bytes). This mapping will help us save space in future when
persisting references to sessions.
This commit is contained in:
Elle Mouton committed 2023-03-20 10:46:52 +02:00
1 parent ae39cd9e91
commit b16df45076
7 files changed
+373 -7

No files matched your search

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