channeldb/migration21: add body and tests for migration 21

In this commit, we migrate all wire messages in the database from the
`legacy` to the `current` encoding.

This affects the way we write the `CommitDiff` and `LogUpdates` struct
to disk. We also need to migrate the network results bucket in the
switch as it includes a wire message without a length prefix.
This commit is contained in:
Johan T. Halseth committed 2021-02-24 17:31:55 +01:00
1 parent d4e90eae83
commit 466c079bbe
3 files changed
+863

No files matched your search

+7
View File
@@ -18,6 +18,7 @@ import (
"github.com/lightningnetwork/lnd/channeldb/migration13"
"github.com/lightningnetwork/lnd/channeldb/migration16"
"github.com/lightningnetwork/lnd/channeldb/migration20"
"github.com/lightningnetwork/lnd/channeldb/migration21"
"github.com/lightningnetwork/lnd/channeldb/migration_01_to_11"
"github.com/lightningnetwork/lnd/clock"
"github.com/lightningnetwork/lnd/lnwire"
@@ -182,6 +183,12 @@ var (
number: 20,
migration: migration20.MigrateOutpointIndex,
},
{
// Migrate to length prefixed wire messages everywhere
// in the database.
number: 21,
migration: migration21.MigrateDatabaseWireMessages,
},
}
// Big endian is the preferred byte order, due to cursor scans over