mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-19 13:17:50 +02:00
multi: migrate to btcd v2 modules
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.
This commit is contained in:
parent
6d1dbcb599
commit
d554b42ef6
172 changed files with 693 additions and 978 deletions
|
|
@ -5,7 +5,7 @@ import (
|
|||
"encoding/binary"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil/v2"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
btcaddr "github.com/btcsuite/btcd/address/v2"
|
||||
"github.com/btcsuite/btcd/btcutil/v2"
|
||||
"github.com/btcsuite/btcd/chaincfg/v2"
|
||||
"github.com/btcsuite/btcd/wire/v2"
|
||||
)
|
||||
|
||||
// LoopOutContract contains the data that is serialized to persistent storage
|
||||
|
|
@ -22,7 +23,7 @@ type LoopOutContract struct {
|
|||
SwapContract
|
||||
|
||||
// DestAddr is the destination address of the loop out swap.
|
||||
DestAddr btcutil.Address
|
||||
DestAddr btcaddr.Address
|
||||
|
||||
// IsExternalAddr indicates whether the destination address does not
|
||||
// belong to the backing lnd node.
|
||||
|
|
@ -202,7 +203,7 @@ func deserializeLoopOutContract(value []byte, chainParams *chaincfg.Params) (
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
contract.DestAddr, err = btcutil.DecodeAddress(addr, chainParams)
|
||||
contract.DestAddr, err = btcaddr.DecodeAddress(addr, chainParams)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/v2"
|
||||
"go.etcd.io/bbolt"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,15 +7,15 @@ import (
|
|||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
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, _ = btcutil.DecodeAddress(addr, &chaincfg.MainNetParams)
|
||||
addrBtc, _ = btcaddr.DecodeAddress(addr, &chaincfg.MainNetParams)
|
||||
)
|
||||
|
||||
// TestMigrationFromOnDiskBoltdb tests migrating from an on-disk boltdb to an
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/v2"
|
||||
"go.etcd.io/bbolt"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/v2"
|
||||
"go.etcd.io/bbolt"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/v2"
|
||||
"go.etcd.io/bbolt"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/v2"
|
||||
"go.etcd.io/bbolt"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/v2"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.etcd.io/bbolt"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/v2"
|
||||
postgres_migrate "github.com/golang-migrate/migrate/v4/database/postgres"
|
||||
_ "github.com/golang-migrate/migrate/v4/source/file"
|
||||
"github.com/lightninglabs/loop/loopdb/sqlc"
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
btcaddr "github.com/btcsuite/btcd/address/v2"
|
||||
"github.com/btcsuite/btcd/btcutil/v2"
|
||||
"github.com/btcsuite/btcd/chaincfg/v2"
|
||||
"github.com/btcsuite/btcd/chainhash/v2"
|
||||
"github.com/lightninglabs/loop/loopdb/sqlc"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
|
|
@ -586,7 +587,7 @@ func ConvertLoopOutRow(network *chaincfg.Params, row sqlc.GetLoopOutSwapRow,
|
|||
return nil, err
|
||||
}
|
||||
|
||||
destAddress, err := btcutil.DecodeAddress(row.DestAddress, network)
|
||||
destAddress, err := btcaddr.DecodeAddress(row.DestAddress, network)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/chainhash/v2"
|
||||
"github.com/lightninglabs/loop/loopdb/sqlc"
|
||||
"github.com/lightninglabs/loop/test"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
|
|
@ -576,9 +576,7 @@ func randomStruct(v any) error {
|
|||
}
|
||||
|
||||
val = val.Elem()
|
||||
for i := range val.NumField() {
|
||||
field := val.Field(i)
|
||||
|
||||
for _, field := range val.Fields() {
|
||||
switch field.Kind() {
|
||||
case reflect.Int64:
|
||||
if field.CanSet() {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/v2"
|
||||
sqlite_migrate "github.com/golang-migrate/migrate/v4/database/sqlite"
|
||||
"github.com/lightninglabs/loop/loopdb/sqlc"
|
||||
"github.com/lightningnetwork/lnd/zpay32"
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import (
|
|||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/chaincfg/v2"
|
||||
"github.com/btcsuite/btcd/chainhash/v2"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"go.etcd.io/bbolt"
|
||||
bbolterrors "go.etcd.io/bbolt/errors"
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/chaincfg/v2"
|
||||
"github.com/btcsuite/btcd/chainhash/v2"
|
||||
"github.com/lightninglabs/loop/test"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package loopdb
|
||||
|
||||
import (
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/btcutil/v2"
|
||||
"github.com/btcsuite/btcd/chainhash/v2"
|
||||
)
|
||||
|
||||
// SwapState indicates the current state of a swap. This enumeration is the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue