lnd/channeldb/migration31/migration.go
ziggie 87fc58ecfe
multi: Add a channel.db migration.
The new migration removes the sweeper-last-tx top level bucket
from the channel.db database.
2023-08-15 10:00:30 +02:00

24 lines
541 B
Go

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
}