loop/loopdb/migrate_test.go
Boris Nagaev 0ee07198f6
build: update lndclient (btcd v2)
Include https://github.com/lightninglabs/lndclient/pull/280
multi: migrate to btcd v2 modules + add WalletKit.SubmitPackage

Migrate Loop imports and update Aperture and Taproot Assets to compatible
revisions so this commit remains green on its own.
2026-08-11 13:36:02 -05:00

38 lines
938 B
Go

//go:build test_migration
// +build test_migration
package loopdb
import (
"context"
"testing"
btcaddr "github.com/btcsuite/btcd/address/v2"
"github.com/btcsuite/btcd/chaincfg/v2"
"github.com/stretchr/testify/require"
)
var (
boltDbFile = "../loopdb-kon"
addr = "bc1p4g493qcmzt79r87363fvyvq5sfz58q5gsz74g2c4ejqy5xnpcpesh3yq2y"
addrBtc, _ = btcaddr.DecodeAddress(addr, &chaincfg.MainNetParams)
)
// TestMigrationFromOnDiskBoltdb tests migrating from an on-disk boltdb to an
// sqlite database.
func TestMigrationFromOnDiskBoltdb(t *testing.T) {
ctxb := context.Background()
// Open a boltdbStore from the on-disk file.
boltDb, err := NewBoltSwapStore(boltDbFile, &chaincfg.TestNet3Params)
require.NoError(t, err)
// Create a new sqlite store for testing.
sqlDB := NewTestDB(t)
migrator := NewMigratorManager(boltDb, sqlDB)
// Run the migration.
err = migrator.RunMigrations(ctxb)
require.NoError(t, err)
}