mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-04 19:33:30 +02:00
channeldb: add database migration for new node+edge update indexes
In this commit, we add a new database migration required to update old database to the version of the database that tracks the update index for the nodes and edge policies. The migration is straight forward, we simply need to populate the new indexes for the all the nodes, and then all the edges.
This commit is contained in:
@@ -40,6 +40,13 @@ var (
|
||||
number: 0,
|
||||
migration: nil,
|
||||
},
|
||||
{
|
||||
// The version of the database where two new indexes
|
||||
// for the update time of node and channel updates were
|
||||
// added.
|
||||
number: 1,
|
||||
migration: migrateNodeAndEdgeUpdateIndex,
|
||||
},
|
||||
}
|
||||
|
||||
// Big endian is the preferred byte order, due to cursor scans over
|
||||
@@ -523,8 +530,9 @@ func (d *DB) FetchClosedChannel(chanID *wire.OutPoint) (*ChannelCloseSummary, er
|
||||
|
||||
// MarkChanFullyClosed marks a channel as fully closed within the database. A
|
||||
// channel should be marked as fully closed if the channel was initially
|
||||
// cooperatively closed and it's reached a single confirmation, or after all the
|
||||
// pending funds in a channel that has been forcibly closed have been swept.
|
||||
// cooperatively closed and it's reached a single confirmation, or after all
|
||||
// the pending funds in a channel that has been forcibly closed have been
|
||||
// swept.
|
||||
func (d *DB) MarkChanFullyClosed(chanPoint *wire.OutPoint) error {
|
||||
return d.Update(func(tx *bolt.Tx) error {
|
||||
var b bytes.Buffer
|
||||
@@ -594,8 +602,9 @@ func (d *DB) syncVersions(versions []version) error {
|
||||
// Otherwise, we fetch the migrations which need to applied, and
|
||||
// execute them serially within a single database transaction to ensure
|
||||
// the migration is atomic.
|
||||
migrations, migrationVersions := getMigrationsToApply(versions,
|
||||
meta.DbVersionNumber)
|
||||
migrations, migrationVersions := getMigrationsToApply(
|
||||
versions, meta.DbVersionNumber,
|
||||
)
|
||||
return d.Update(func(tx *bolt.Tx) error {
|
||||
for i, migration := range migrations {
|
||||
if migration == nil {
|
||||
|
Reference in New Issue
Block a user