multi: Add a channel.db migration.

The new migration removes the sweeper-last-tx top level bucket
from the channel.db database.
This commit is contained in:
ziggie committed 2023-08-15 10:00:30 +02:00
1 parent 07502a8fb0
commit 87fc58ecfe
6 files changed
+105

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
package migration31
import (
"errors"
"github.com/btcsuite/btcwallet/walletdb"
"github.com/lightningnetwork/lnd/kvdb"
)
// DeleteLastPublishedTxTLB deletes the top level bucket with the key
// "sweeper-last-tx".
func DeleteLastPublishedTxTLB(tx kvdb.RwTx) error {
log.Infof("Deleting top-level bucket: %x ...", lastTxBucketKey)
err := tx.DeleteTopLevelBucket(lastTxBucketKey)
if err != nil && !errors.Is(err, walletdb.ErrBucketNotFound) {
return err
}
log.Infof("Deleted top-level bucket: %x", lastTxBucketKey)
return nil
}