channeldb+migration: add migration to save the initial balances

This commit adds a migration to patch the newly added fields,
`InitialLocalBalance` and `InitialRemoteBalance` to channel info.
This commit is contained in:
yyforyongyu
2022-04-16 11:50:05 +08:00
parent 8b289e79f5
commit c9843fd206
4 changed files with 954 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ import (
"github.com/lightningnetwork/lnd/channeldb/migration21"
"github.com/lightningnetwork/lnd/channeldb/migration23"
"github.com/lightningnetwork/lnd/channeldb/migration24"
"github.com/lightningnetwork/lnd/channeldb/migration25"
"github.com/lightningnetwork/lnd/channeldb/migration_01_to_11"
"github.com/lightningnetwork/lnd/clock"
"github.com/lightningnetwork/lnd/kvdb"
@@ -205,6 +206,12 @@ var (
number: 24,
migration: migration24.MigrateFwdPkgCleanup,
},
{
// Save the initial local/remote balances in channel
// info.
number: 25,
migration: migration25.MigrateInitialBalances,
},
}
// Big endian is the preferred byte order, due to cursor scans over