channeldb: fully initialize meta-data bucket during DB creation
This commit is contained in:
1 file changed
+5
-1
+5
-1
@@ -95,6 +95,7 @@ func Open(dbPath string, netParams *chaincfg.Params) (*DB, error) {
|
|||||||
// database. The deletion is done in a single transaction, therefore this
|
// database. The deletion is done in a single transaction, therefore this
|
||||||
// operation is fully atomic.
|
// operation is fully atomic.
|
||||||
func (d *DB) Wipe() error {
|
func (d *DB) Wipe() error {
|
||||||
|
return d.Update(func(tx *bolt.Tx) error {
|
||||||
err := tx.DeleteBucket(openChannelBucket)
|
err := tx.DeleteBucket(openChannelBucket)
|
||||||
if err != nil && err != bolt.ErrBucketNotFound {
|
if err != nil && err != bolt.ErrBucketNotFound {
|
||||||
return err
|
return err
|
||||||
@@ -157,7 +158,10 @@ func createChannelDB(dbPath string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
meta := &Meta{
|
||||||
|
DbVersionNumber: getLatestDBVersion(dbVersions),
|
||||||
|
}
|
||||||
|
return putMeta(meta, tx)
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to create new channeldb")
|
return fmt.Errorf("unable to create new channeldb")
|
||||||
|
|||||||
Reference in new issue
Block a user