channeldb/db: properly reinit wallet during Wipe
Previously we wouldn't recreate some of the top level buckets that are now considered expected with our migration logic. This bug was preexisting, but never surfaced because the other TLB buckets were not touched by this unit test.
This commit is contained in:
2 files changed
+14
-11
No files matched your search
+6
-1
@@ -315,7 +315,7 @@ var topLevelBuckets = [][]byte{
|
||||
// database. The deletion is done in a single transaction, therefore this
|
||||
// operation is fully atomic.
|
||||
func (d *DB) Wipe() error {
|
||||
return kvdb.Update(d, func(tx kvdb.RwTx) error {
|
||||
err := kvdb.Update(d, func(tx kvdb.RwTx) error {
|
||||
for _, tlb := range topLevelBuckets {
|
||||
err := tx.DeleteTopLevelBucket(tlb)
|
||||
if err != nil && err != kvdb.ErrBucketNotFound {
|
||||
@@ -324,6 +324,11 @@ func (d *DB) Wipe() error {
|
||||
}
|
||||
return nil
|
||||
}, func() {})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return initChannelDB(d.Backend)
|
||||
}
|
||||
|
||||
// createChannelDB creates and initializes a fresh version of channeldb. In
|
||||
|
||||
Reference in new issue
Block a user