mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
Update LND, Aperture, and Taproot Assets to revisions using the btcd v2 modules, and update lndclient to v0.21.0-3. Migrate Loop chain, transaction, and address types to their corresponding v2 packages. The lndclient release includes the migration from: https://github.com/lightninglabs/lndclient/pull/280 Taproot Assets is temporarily replaced with its btcd v2 revision because the v0.8 release branch has not adopted the new modules. This raises the minimum Go version to 1.26 and changes exported address types.
38 lines
938 B
Go
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)
|
|
}
|