mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 22:25:24 +01:00
Merge pull request #1898 from Roasbeef/fix-migration
channeldb: don't use KeyN in latest migration
This commit is contained in:
commit
9e99f13f8d
1 changed files with 3 additions and 11 deletions
|
@ -473,12 +473,9 @@ func migratePruneEdgeUpdateIndex(tx *bolt.Tx) error {
|
|||
if edges == nil {
|
||||
return nil
|
||||
}
|
||||
edgeUpdateIndex, err := edges.CreateBucketIfNotExists(
|
||||
edgeUpdateIndexBucket,
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to create/fetch edge update " +
|
||||
"index bucket")
|
||||
edgeUpdateIndex := edges.Bucket(edgeUpdateIndexBucket)
|
||||
if edgeUpdateIndex == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Retrieve some buckets that will be needed later on. These should
|
||||
|
@ -518,7 +515,6 @@ func migratePruneEdgeUpdateIndex(tx *bolt.Tx) error {
|
|||
|
||||
// With the existing edge policies gathered, we'll recreate the index
|
||||
// and populate it with the correct entries.
|
||||
oldNumEntries := edgeUpdateIndex.Stats().KeyN
|
||||
if err := edges.DeleteBucket(edgeUpdateIndexBucket); err != nil {
|
||||
return fmt.Errorf("unable to remove existing edge update "+
|
||||
"index: %v", err)
|
||||
|
@ -558,10 +554,6 @@ func migratePruneEdgeUpdateIndex(tx *bolt.Tx) error {
|
|||
}
|
||||
}
|
||||
|
||||
newNumEntries := edgeUpdateIndex.Stats().KeyN
|
||||
log.Infof("Pruned %d stale entries from the edge update index",
|
||||
oldNumEntries-newNumEntries)
|
||||
|
||||
log.Info("Migration to properly prune edge update index complete!")
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Add table
Reference in a new issue