mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-29 07:00:55 +02:00
channeldb: perform init of top level buckets first
This commit is contained in:
committed by
Olaoluwa Osuntokun
parent
ff95646d42
commit
2ffcefc947
@@ -479,6 +479,12 @@ func initChannelDB(db kvdb.Backend) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, tlb := range dbTopLevelBuckets {
|
||||||
|
if _, err := tx.CreateTopLevelBucket(tlb); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
meta := &Meta{}
|
meta := &Meta{}
|
||||||
// Check if DB is already initialized.
|
// Check if DB is already initialized.
|
||||||
err := FetchMeta(meta, tx)
|
err := FetchMeta(meta, tx)
|
||||||
@@ -486,12 +492,6 @@ func initChannelDB(db kvdb.Backend) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tlb := range dbTopLevelBuckets {
|
|
||||||
if _, err := tx.CreateTopLevelBucket(tlb); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
meta.DbVersionNumber = getLatestDBVersion(dbVersions)
|
meta.DbVersionNumber = getLatestDBVersion(dbVersions)
|
||||||
return putMeta(meta, tx)
|
return putMeta(meta, tx)
|
||||||
}, func() {})
|
}, func() {})
|
||||||
|
Reference in New Issue
Block a user