mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
multi: use btcd's btcec/v2 and btcutil modules
This commit was previously split into the following parts to ease review: - 2d746f68: replace imports - 4008f0fd: use ecdsa.Signature - 849e33d1: remove btcec.S256() - b8f6ebbd: use v2 library correctly - fa80bca9: bump go modules
This commit is contained in:
parent
8ee9fc837b
commit
7dfe4018ce
@ -8,8 +8,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
)
|
||||
@ -731,7 +731,7 @@ func (a *Agent) executeDirective(directive AttachmentDirective) {
|
||||
// We'll start out by attempting to connect to the peer in order to
|
||||
// begin the funding workflow.
|
||||
nodeID := directive.NodeID
|
||||
pub, err := btcec.ParsePubKey(nodeID[:], btcec.S256())
|
||||
pub, err := btcec.ParsePubKey(nodeID[:])
|
||||
if err != nil {
|
||||
log.Errorf("Unable to parse pubkey %x: %v", nodeID, err)
|
||||
return
|
||||
|
@ -1,7 +1,7 @@
|
||||
package autopilot
|
||||
|
||||
import (
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
)
|
||||
|
||||
// AgentConstraints is an interface the agent will query to determine what
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
)
|
||||
|
||||
|
@ -8,9 +8,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
)
|
||||
|
||||
type moreChansResp struct {
|
||||
|
@ -3,8 +3,8 @@ package autopilot
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
@ -3,7 +3,7 @@ package autopilot
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
)
|
||||
|
||||
// WeightedHeuristic is a tuple that associates a weight to an
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
)
|
||||
|
||||
// ExternalScoreAttachment is an implementation of the AttachmentHeuristic
|
||||
|
@ -3,14 +3,14 @@ package autopilot_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/lightningnetwork/lnd/autopilot"
|
||||
)
|
||||
|
||||
// randKey returns a random public key.
|
||||
func randKey() (*btcec.PublicKey, error) {
|
||||
priv, err := btcec.NewPrivateKey(btcec.S256())
|
||||
priv, err := btcec.NewPrivateKey()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -2,14 +2,15 @@ package autopilot
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"math/big"
|
||||
"encoding/hex"
|
||||
"net"
|
||||
"sort"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@ -17,12 +18,13 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
testSig = &btcec.Signature{
|
||||
R: new(big.Int),
|
||||
S: new(big.Int),
|
||||
}
|
||||
_, _ = testSig.R.SetString("63724406601629180062774974542967536251589935445068131219452686511677818569431", 10)
|
||||
_, _ = testSig.S.SetString("18801056069249825825291287104931333862866033135609736119018462340006816851118", 10)
|
||||
testRBytes, _ = hex.DecodeString("8ce2bc69281ce27da07e6683571319d18e949ddfa2965fb6caa1bf0314f882d7")
|
||||
testSBytes, _ = hex.DecodeString("299105481d63e0f4bc2a88121167221b6700d72a0ead154c03be696a292d24ae")
|
||||
testRScalar = new(btcec.ModNScalar)
|
||||
testSScalar = new(btcec.ModNScalar)
|
||||
_ = testRScalar.SetByteSlice(testRBytes)
|
||||
_ = testSScalar.SetByteSlice(testSBytes)
|
||||
testSig = ecdsa.NewSignature(testRScalar, testSScalar)
|
||||
|
||||
chanIDCounter uint64 // To be used atomically.
|
||||
)
|
||||
@ -344,7 +346,7 @@ func randChanID() lnwire.ShortChannelID {
|
||||
|
||||
// randKey returns a random public key.
|
||||
func randKey() (*btcec.PublicKey, error) {
|
||||
priv, err := btcec.NewPrivateKey(btcec.S256())
|
||||
priv, err := btcec.NewPrivateKey()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package autopilot_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/lightningnetwork/lnd/autopilot"
|
||||
)
|
||||
|
||||
|
@ -3,9 +3,9 @@ package autopilot
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
)
|
||||
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
|
@ -4,8 +4,8 @@ import (
|
||||
prand "math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
)
|
||||
|
||||
// minMedianChanSizeFraction determines the minimum size a channel must have to
|
||||
|
@ -8,8 +8,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
)
|
||||
|
||||
@ -252,9 +252,7 @@ func TestPrefAttachmentSelectGreedyAllocation(t *testing.T) {
|
||||
t1.Fatalf("unable to create channel: %v", err)
|
||||
}
|
||||
peerPubBytes := edge1.Peer.PubKey()
|
||||
peerPub, err := btcec.ParsePubKey(
|
||||
peerPubBytes[:], btcec.S256(),
|
||||
)
|
||||
peerPub, err := btcec.ParsePubKey(peerPubBytes[:])
|
||||
if err != nil {
|
||||
t.Fatalf("unable to parse pubkey: %v", err)
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package autopilot
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
)
|
||||
|
||||
// TopCentrality is a simple greedy technique to create connections to nodes
|
||||
|
@ -3,8 +3,8 @@ package autopilot
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
package blockcache
|
||||
|
||||
import (
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightninglabs/neutrino/cache"
|
||||
"github.com/lightninglabs/neutrino/cache/lru"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
|
@ -6,9 +6,9 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightninglabs/neutrino/cache"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/tor"
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"golang.org/x/crypto/chacha20poly1305"
|
||||
"golang.org/x/crypto/hkdf"
|
||||
@ -63,7 +63,7 @@ var (
|
||||
// ephemeralGen is the default ephemeral key generator, used to derive a
|
||||
// unique ephemeral key for each brontide handshake.
|
||||
ephemeralGen = func() (*btcec.PrivateKey, error) {
|
||||
return btcec.NewPrivateKey(btcec.S256())
|
||||
return btcec.NewPrivateKey()
|
||||
}
|
||||
)
|
||||
|
||||
@ -500,7 +500,7 @@ func (b *Machine) RecvActOne(actOne [ActOneSize]byte) error {
|
||||
copy(p[:], actOne[34:])
|
||||
|
||||
// e
|
||||
b.remoteEphemeral, err = btcec.ParsePubKey(e[:], btcec.S256())
|
||||
b.remoteEphemeral, err = btcec.ParsePubKey(e[:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -578,7 +578,7 @@ func (b *Machine) RecvActTwo(actTwo [ActTwoSize]byte) error {
|
||||
copy(p[:], actTwo[34:])
|
||||
|
||||
// e
|
||||
b.remoteEphemeral, err = btcec.ParsePubKey(e[:], btcec.S256())
|
||||
b.remoteEphemeral, err = btcec.ParsePubKey(e[:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -654,7 +654,7 @@ func (b *Machine) RecvActThree(actThree [ActThreeSize]byte) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.remoteStatic, err = btcec.ParsePubKey(remotePub, btcec.S256())
|
||||
b.remoteStatic, err = btcec.ParsePubKey(remotePub)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -890,23 +890,3 @@ func (b *Machine) ReadBody(r io.Reader, buf []byte) ([]byte, error) {
|
||||
// buffer to decode the plaintext.
|
||||
return b.recvCipher.Decrypt(nil, buf[:0], buf)
|
||||
}
|
||||
|
||||
// SetCurveToNil sets the 'Curve' parameter to nil on the handshakeState keys.
|
||||
// This allows us to log the Machine object without spammy log messages.
|
||||
func (b *Machine) SetCurveToNil() {
|
||||
if b.localStatic != nil {
|
||||
b.localStatic.PubKey().Curve = nil
|
||||
}
|
||||
|
||||
if b.localEphemeral != nil {
|
||||
b.localEphemeral.PubKey().Curve = nil
|
||||
}
|
||||
|
||||
if b.remoteStatic != nil {
|
||||
b.remoteStatic.Curve = nil
|
||||
}
|
||||
|
||||
if b.remoteEphemeral != nil {
|
||||
b.remoteEphemeral.Curve = nil
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
"testing"
|
||||
"testing/iotest"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/tor"
|
||||
@ -23,7 +23,7 @@ type maybeNetConn struct {
|
||||
|
||||
func makeListener() (*Listener, *lnwire.NetAddress, error) {
|
||||
// First, generate the long-term private keys for the brontide listener.
|
||||
localPriv, err := btcec.NewPrivateKey(btcec.S256())
|
||||
localPriv, err := btcec.NewPrivateKey()
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
@ -56,7 +56,7 @@ func establishTestConnection() (net.Conn, net.Conn, func(), error) {
|
||||
|
||||
// Nos, generate the long-term private keys remote end of the connection
|
||||
// within our test.
|
||||
remotePriv, err := btcec.NewPrivateKey(btcec.S256())
|
||||
remotePriv, err := btcec.NewPrivateKey()
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
@ -193,7 +193,7 @@ func TestConcurrentHandshakes(t *testing.T) {
|
||||
|
||||
// Now, construct a new private key and use the brontide dialer to
|
||||
// connect to the listener.
|
||||
remotePriv, err := btcec.NewPrivateKey(btcec.S256())
|
||||
remotePriv, err := btcec.NewPrivateKey()
|
||||
if err != nil {
|
||||
t.Fatalf("unable to generate private key: %v", err)
|
||||
}
|
||||
@ -326,7 +326,7 @@ func TestBolt0008TestVectors(t *testing.T) {
|
||||
t.Fatalf("unable to decode hex: %v", err)
|
||||
}
|
||||
initiatorPriv, _ := btcec.PrivKeyFromBytes(
|
||||
btcec.S256(), initiatorKeyBytes,
|
||||
initiatorKeyBytes,
|
||||
)
|
||||
initiatorKeyECDH := &keychain.PrivKeyECDH{PrivKey: initiatorPriv}
|
||||
|
||||
@ -337,7 +337,7 @@ func TestBolt0008TestVectors(t *testing.T) {
|
||||
t.Fatalf("unable to decode hex: %v", err)
|
||||
}
|
||||
responderPriv, responderPub := btcec.PrivKeyFromBytes(
|
||||
btcec.S256(), responderKeyBytes,
|
||||
responderKeyBytes,
|
||||
)
|
||||
responderKeyECDH := &keychain.PrivKeyECDH{PrivKey: responderPriv}
|
||||
|
||||
@ -353,7 +353,7 @@ func TestBolt0008TestVectors(t *testing.T) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
priv, _ := btcec.PrivKeyFromBytes(btcec.S256(), eBytes)
|
||||
priv, _ := btcec.PrivKeyFromBytes(eBytes)
|
||||
return priv, nil
|
||||
})
|
||||
responderEphemeral := EphemeralGenerator(func() (*btcec.PrivateKey, error) {
|
||||
@ -364,7 +364,7 @@ func TestBolt0008TestVectors(t *testing.T) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
priv, _ := btcec.PrivKeyFromBytes(btcec.S256(), eBytes)
|
||||
priv, _ := btcec.PrivKeyFromBytes(eBytes)
|
||||
return priv, nil
|
||||
})
|
||||
|
||||
|
@ -194,7 +194,7 @@ func IsOutdated(cert *x509.Certificate, tlsExtraIPs,
|
||||
// real PKI.
|
||||
//
|
||||
// This function is adapted from https://github.com/btcsuite/btcd and
|
||||
// https://github.com/btcsuite/btcutil
|
||||
// https://github.com/btcsuite/btcd/btcutil
|
||||
func GenCertPair(org, certFile, keyFile string, tlsExtraIPs,
|
||||
tlsExtraDomains []string, tlsDisableAutofill bool,
|
||||
certValidity time.Duration) error {
|
||||
|
@ -7,11 +7,11 @@ import (
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/btcsuite/btcd/btcjson"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcwallet/chain"
|
||||
"github.com/lightningnetwork/lnd/blockcache"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
|
@ -8,12 +8,12 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcjson"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/rpcclient"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/blockcache"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/queue"
|
||||
|
@ -9,12 +9,12 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcjson"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil/gcs/builder"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/rpcclient"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcutil/gcs/builder"
|
||||
"github.com/lightninglabs/neutrino"
|
||||
"github.com/lightninglabs/neutrino/headerfs"
|
||||
"github.com/lightningnetwork/lnd/blockcache"
|
||||
|
@ -12,11 +12,11 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/integration/rpctest"
|
||||
"github.com/btcsuite/btcd/rpcclient"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcwallet/chain"
|
||||
_ "github.com/btcsuite/btcwallet/walletdb/bdb" // Required to auto-register the boltdb walletdb implementation.
|
||||
"github.com/lightninglabs/neutrino"
|
||||
|
@ -14,14 +14,14 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcjson"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/integration/rpctest"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcwallet/chain"
|
||||
"github.com/btcsuite/btcwallet/walletdb"
|
||||
"github.com/lightninglabs/neutrino"
|
||||
@ -42,7 +42,7 @@ var (
|
||||
// randPubKeyHashScript generates a P2PKH script that pays to the public key of
|
||||
// a randomly-generated private key.
|
||||
func randPubKeyHashScript() ([]byte, *btcec.PrivateKey, error) {
|
||||
privKey, err := btcec.NewPrivateKey(btcec.S256())
|
||||
privKey, err := btcec.NewPrivateKey()
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
)
|
||||
|
||||
|
@ -6,9 +6,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
@ -14,9 +14,9 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/rpcclient"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcwallet/chain"
|
||||
"github.com/lightninglabs/neutrino"
|
||||
"github.com/lightningnetwork/lnd/blockcache"
|
||||
|
@ -4,9 +4,9 @@ import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcwallet/chain"
|
||||
"github.com/btcsuite/btcwallet/waddrmgr"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
|
@ -2,13 +2,12 @@ package chanacceptor
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"math/big"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chancloser"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@ -126,10 +125,10 @@ func (c *channelAcceptorCtx) stop() {
|
||||
// request in a goroutine and then asserts that we get the outcome we expect.
|
||||
func (c *channelAcceptorCtx) queryAndAssert(queries map[*lnwire.OpenChannel]*ChannelAcceptResponse) {
|
||||
var (
|
||||
node = &btcec.PublicKey{
|
||||
X: big.NewInt(1),
|
||||
Y: big.NewInt(1),
|
||||
}
|
||||
node = btcec.NewPublicKey(
|
||||
new(btcec.FieldVal).SetInt(1),
|
||||
new(btcec.FieldVal).SetInt(1),
|
||||
)
|
||||
|
||||
responses = make(chan struct{})
|
||||
)
|
||||
|
@ -3,8 +3,8 @@ package chanacceptor
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
)
|
||||
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
)
|
||||
|
||||
|
@ -7,8 +7,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chancloser"
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chancloser"
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"net"
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
)
|
||||
|
||||
@ -30,7 +30,7 @@ func (m *mockKeyRing) DeriveKey(keyLoc keychain.KeyLocator) (keychain.KeyDescrip
|
||||
return keychain.KeyDescriptor{}, fmt.Errorf("fail")
|
||||
}
|
||||
|
||||
_, pub := btcec.PrivKeyFromBytes(btcec.S256(), testWalletPrivKey)
|
||||
_, pub := btcec.PrivKeyFromBytes(testWalletPrivKey)
|
||||
return keychain.KeyDescriptor{
|
||||
PubKey: pub,
|
||||
}, nil
|
||||
|
@ -3,7 +3,7 @@ package chanbackup
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"net"
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
)
|
||||
|
||||
type mockChannelRestorer struct {
|
||||
|
@ -6,10 +6,10 @@ import (
|
||||
"io"
|
||||
"net"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@ -160,7 +160,7 @@ func NewSingle(channel *channeldb.OpenChannel,
|
||||
// the backups plaintext don't carry any private information. When
|
||||
// we go to recover, we'll present this in order to derive the
|
||||
// private key.
|
||||
_, shaChainPoint := btcec.PrivKeyFromBytes(btcec.S256(), b.Bytes())
|
||||
_, shaChainPoint := btcec.PrivKeyFromBytes(b.Bytes())
|
||||
|
||||
shaChainRootDesc = keychain.KeyDescriptor{
|
||||
PubKey: shaChainPoint,
|
||||
@ -369,13 +369,11 @@ func readRemoteKeyDesc(r io.Reader) (keychain.KeyDescriptor, error) {
|
||||
return keychain.KeyDescriptor{}, err
|
||||
}
|
||||
|
||||
keyDesc.PubKey, err = btcec.ParsePubKey(pub[:], btcec.S256())
|
||||
keyDesc.PubKey, err = btcec.ParsePubKey(pub[:])
|
||||
if err != nil {
|
||||
return keychain.KeyDescriptor{}, err
|
||||
}
|
||||
|
||||
keyDesc.PubKey.Curve = nil
|
||||
|
||||
return keyDesc, nil
|
||||
}
|
||||
|
||||
@ -480,7 +478,7 @@ func (s *Single) Deserialize(r io.Reader) error {
|
||||
// been specified or not.
|
||||
if !bytes.Equal(shaChainPub[:], zeroPub[:]) {
|
||||
s.ShaChainRootDesc.PubKey, err = btcec.ParsePubKey(
|
||||
shaChainPub[:], btcec.S256(),
|
||||
shaChainPub[:],
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
@ -101,15 +101,13 @@ func genRandomOpenChannelShell() (*channeldb.OpenChannel, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, pub := btcec.PrivKeyFromBytes(btcec.S256(), testPriv[:])
|
||||
_, pub := btcec.PrivKeyFromBytes(testPriv[:])
|
||||
|
||||
var chanPoint wire.OutPoint
|
||||
if _, err := rand.Read(chanPoint.Hash[:]); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pub.Curve = nil
|
||||
|
||||
chanPoint.Index = uint32(rand.Intn(math.MaxUint16))
|
||||
|
||||
var shaChainRoot [32]byte
|
||||
@ -209,7 +207,6 @@ func TestSinglePackUnpack(t *testing.T) {
|
||||
}
|
||||
|
||||
singleChanBackup := NewSingle(channel, []net.Addr{addr1, addr2})
|
||||
singleChanBackup.RemoteNodePub.Curve = nil
|
||||
|
||||
keyRing := &mockKeyRing{}
|
||||
|
||||
@ -285,7 +282,6 @@ func TestSinglePackUnpack(t *testing.T) {
|
||||
t.Fatalf("#%v unable to unpack single: %v",
|
||||
i, err)
|
||||
}
|
||||
unpackedSingle.RemoteNodePub.Curve = nil
|
||||
|
||||
assertSingleEqual(t, singleChanBackup, unpackedSingle)
|
||||
|
||||
|
@ -2,11 +2,10 @@ package chanfitness
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"math/big"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/clock"
|
||||
@ -88,11 +87,10 @@ func TestStartStoreError(t *testing.T) {
|
||||
// of uptime and lifespan requests, as they are tested in their own tests.
|
||||
func TestMonitorChannelEvents(t *testing.T) {
|
||||
var (
|
||||
pubKey = &btcec.PublicKey{
|
||||
X: big.NewInt(0),
|
||||
Y: big.NewInt(1),
|
||||
Curve: btcec.S256(),
|
||||
}
|
||||
pubKey = btcec.NewPublicKey(
|
||||
new(btcec.FieldVal).SetInt(0),
|
||||
new(btcec.FieldVal).SetInt(1),
|
||||
)
|
||||
|
||||
chan1 = wire.OutPoint{Index: 1}
|
||||
chan2 = wire.OutPoint{Index: 2}
|
||||
|
@ -1,11 +1,10 @@
|
||||
package chanfitness
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
@ -144,11 +143,10 @@ func (c *chanEventStoreTestCtx) newChannel() (route.Vertex, *btcec.PublicKey,
|
||||
wire.OutPoint) {
|
||||
|
||||
// Create a pubkey for our channel peer.
|
||||
pubKey := &btcec.PublicKey{
|
||||
X: big.NewInt(int64(c.testVarIdx)),
|
||||
Y: big.NewInt(int64(c.testVarIdx)),
|
||||
Curve: btcec.S256(),
|
||||
}
|
||||
pubKey := btcec.NewPublicKey(
|
||||
new(btcec.FieldVal).SetInt(uint16(c.testVarIdx)),
|
||||
new(btcec.FieldVal).SetInt(uint16(c.testVarIdx)),
|
||||
)
|
||||
|
||||
// Create vertex from our pubkey.
|
||||
vertex, err := route.NewVertexFromBytes(pubKey.SerializeCompressed())
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/chanbackup"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
|
@ -12,10 +12,10 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
|
@ -8,10 +8,10 @@ import (
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
_ "github.com/btcsuite/btcwallet/walletdb/bdb"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/clock"
|
||||
@ -35,7 +35,7 @@ var (
|
||||
0x48, 0x59, 0xe6, 0x96, 0x31, 0x13, 0xa1, 0x17,
|
||||
0x2d, 0xe7, 0x93, 0xe4,
|
||||
}
|
||||
privKey, pubKey = btcec.PrivKeyFromBytes(btcec.S256(), key[:])
|
||||
privKey, pubKey = btcec.PrivKeyFromBytes(key[:])
|
||||
|
||||
wireSig, _ = lnwire.NewSigFromSignature(testSig)
|
||||
|
||||
@ -412,7 +412,7 @@ func TestOpenChannelPutGetDelete(t *testing.T) {
|
||||
// We'll also test that the channel is properly able to hot swap the
|
||||
// next revocation for the state machine. This tests the initial
|
||||
// post-funding revocation exchange.
|
||||
nextRevKey, err := btcec.NewPrivateKey(btcec.S256())
|
||||
nextRevKey, err := btcec.NewPrivateKey()
|
||||
if err != nil {
|
||||
t.Fatalf("unable to create new private key: %v", err)
|
||||
}
|
||||
@ -756,7 +756,7 @@ func TestChannelStateTransition(t *testing.T) {
|
||||
// current uncollapsed revocation state to simulate a state transition
|
||||
// by the remote party.
|
||||
channel.RemoteCurrentRevocation = channel.RemoteNextRevocation
|
||||
newPriv, err := btcec.NewPrivateKey(btcec.S256())
|
||||
newPriv, err := btcec.NewPrivateKey()
|
||||
if err != nil {
|
||||
t.Fatalf("unable to generate key: %v", err)
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ import (
|
||||
"io"
|
||||
"net"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/shachain"
|
||||
@ -346,7 +346,7 @@ func ReadElement(r io.Reader, element interface{}) error {
|
||||
return err
|
||||
}
|
||||
|
||||
priv, _ := btcec.PrivKeyFromBytes(btcec.S256(), b[:])
|
||||
priv, _ := btcec.PrivKeyFromBytes(b[:])
|
||||
*e = priv
|
||||
|
||||
case **btcec.PublicKey:
|
||||
@ -355,7 +355,7 @@ func ReadElement(r io.Reader, element interface{}) error {
|
||||
return err
|
||||
}
|
||||
|
||||
pubKey, err := btcec.ParsePubKey(b[:], btcec.S256())
|
||||
pubKey, err := btcec.ParsePubKey(b[:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"net"
|
||||
"os"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/go-errors/errors"
|
||||
mig "github.com/lightningnetwork/lnd/channeldb/migration"
|
||||
|
@ -10,10 +10,10 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
@ -300,15 +300,13 @@ func genRandomChannelShell() (*ChannelShell, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, pub := btcec.PrivKeyFromBytes(btcec.S256(), testPriv[:])
|
||||
_, pub := btcec.PrivKeyFromBytes(testPriv[:])
|
||||
|
||||
var chanPoint wire.OutPoint
|
||||
if _, err := rand.Read(chanPoint.Hash[:]); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pub.Curve = nil
|
||||
|
||||
chanPoint.Index = uint32(rand.Intn(math.MaxUint16))
|
||||
|
||||
chanStatus := ChanStatusDefault | ChanStatusRestored
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
|
@ -14,11 +14,12 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/batch"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@ -2660,7 +2661,7 @@ func (l *LightningNode) PubKey() (*btcec.PublicKey, error) {
|
||||
return l.pubKey, nil
|
||||
}
|
||||
|
||||
key, err := btcec.ParsePubKey(l.PubKeyBytes[:], btcec.S256())
|
||||
key, err := btcec.ParsePubKey(l.PubKeyBytes[:])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -2674,8 +2675,8 @@ func (l *LightningNode) PubKey() (*btcec.PublicKey, error) {
|
||||
//
|
||||
// NOTE: By having this method to access an attribute, we ensure we only need
|
||||
// to fully deserialize the signature if absolutely necessary.
|
||||
func (l *LightningNode) AuthSig() (*btcec.Signature, error) {
|
||||
return btcec.ParseSignature(l.AuthSigBytes, btcec.S256())
|
||||
func (l *LightningNode) AuthSig() (*ecdsa.Signature, error) {
|
||||
return ecdsa.ParseSignature(l.AuthSigBytes)
|
||||
}
|
||||
|
||||
// AddPubKey is a setter-link method that can be used to swap out the public
|
||||
@ -3104,7 +3105,7 @@ func (c *ChannelEdgeInfo) NodeKey1() (*btcec.PublicKey, error) {
|
||||
return c.nodeKey1, nil
|
||||
}
|
||||
|
||||
key, err := btcec.ParsePubKey(c.NodeKey1Bytes[:], btcec.S256())
|
||||
key, err := btcec.ParsePubKey(c.NodeKey1Bytes[:])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -3126,7 +3127,7 @@ func (c *ChannelEdgeInfo) NodeKey2() (*btcec.PublicKey, error) {
|
||||
return c.nodeKey2, nil
|
||||
}
|
||||
|
||||
key, err := btcec.ParsePubKey(c.NodeKey2Bytes[:], btcec.S256())
|
||||
key, err := btcec.ParsePubKey(c.NodeKey2Bytes[:])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -3146,7 +3147,7 @@ func (c *ChannelEdgeInfo) BitcoinKey1() (*btcec.PublicKey, error) {
|
||||
return c.bitcoinKey1, nil
|
||||
}
|
||||
|
||||
key, err := btcec.ParsePubKey(c.BitcoinKey1Bytes[:], btcec.S256())
|
||||
key, err := btcec.ParsePubKey(c.BitcoinKey1Bytes[:])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -3166,7 +3167,7 @@ func (c *ChannelEdgeInfo) BitcoinKey2() (*btcec.PublicKey, error) {
|
||||
return c.bitcoinKey2, nil
|
||||
}
|
||||
|
||||
key, err := btcec.ParsePubKey(c.BitcoinKey2Bytes[:], btcec.S256())
|
||||
key, err := btcec.ParsePubKey(c.BitcoinKey2Bytes[:])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -3249,28 +3250,28 @@ func (c *ChannelEdgeInfo) FetchOtherNode(tx kvdb.RTx,
|
||||
// features.
|
||||
type ChannelAuthProof struct {
|
||||
// nodeSig1 is a cached instance of the first node signature.
|
||||
nodeSig1 *btcec.Signature
|
||||
nodeSig1 *ecdsa.Signature
|
||||
|
||||
// NodeSig1Bytes are the raw bytes of the first node signature encoded
|
||||
// in DER format.
|
||||
NodeSig1Bytes []byte
|
||||
|
||||
// nodeSig2 is a cached instance of the second node signature.
|
||||
nodeSig2 *btcec.Signature
|
||||
nodeSig2 *ecdsa.Signature
|
||||
|
||||
// NodeSig2Bytes are the raw bytes of the second node signature
|
||||
// encoded in DER format.
|
||||
NodeSig2Bytes []byte
|
||||
|
||||
// bitcoinSig1 is a cached instance of the first bitcoin signature.
|
||||
bitcoinSig1 *btcec.Signature
|
||||
bitcoinSig1 *ecdsa.Signature
|
||||
|
||||
// BitcoinSig1Bytes are the raw bytes of the first bitcoin signature
|
||||
// encoded in DER format.
|
||||
BitcoinSig1Bytes []byte
|
||||
|
||||
// bitcoinSig2 is a cached instance of the second bitcoin signature.
|
||||
bitcoinSig2 *btcec.Signature
|
||||
bitcoinSig2 *ecdsa.Signature
|
||||
|
||||
// BitcoinSig2Bytes are the raw bytes of the second bitcoin signature
|
||||
// encoded in DER format.
|
||||
@ -3283,12 +3284,12 @@ type ChannelAuthProof struct {
|
||||
//
|
||||
// NOTE: By having this method to access an attribute, we ensure we only need
|
||||
// to fully deserialize the signature if absolutely necessary.
|
||||
func (c *ChannelAuthProof) Node1Sig() (*btcec.Signature, error) {
|
||||
func (c *ChannelAuthProof) Node1Sig() (*ecdsa.Signature, error) {
|
||||
if c.nodeSig1 != nil {
|
||||
return c.nodeSig1, nil
|
||||
}
|
||||
|
||||
sig, err := btcec.ParseSignature(c.NodeSig1Bytes, btcec.S256())
|
||||
sig, err := ecdsa.ParseSignature(c.NodeSig1Bytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -3304,12 +3305,12 @@ func (c *ChannelAuthProof) Node1Sig() (*btcec.Signature, error) {
|
||||
//
|
||||
// NOTE: By having this method to access an attribute, we ensure we only need
|
||||
// to fully deserialize the signature if absolutely necessary.
|
||||
func (c *ChannelAuthProof) Node2Sig() (*btcec.Signature, error) {
|
||||
func (c *ChannelAuthProof) Node2Sig() (*ecdsa.Signature, error) {
|
||||
if c.nodeSig2 != nil {
|
||||
return c.nodeSig2, nil
|
||||
}
|
||||
|
||||
sig, err := btcec.ParseSignature(c.NodeSig2Bytes, btcec.S256())
|
||||
sig, err := ecdsa.ParseSignature(c.NodeSig2Bytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -3324,12 +3325,12 @@ func (c *ChannelAuthProof) Node2Sig() (*btcec.Signature, error) {
|
||||
//
|
||||
// NOTE: By having this method to access an attribute, we ensure we only need
|
||||
// to fully deserialize the signature if absolutely necessary.
|
||||
func (c *ChannelAuthProof) BitcoinSig1() (*btcec.Signature, error) {
|
||||
func (c *ChannelAuthProof) BitcoinSig1() (*ecdsa.Signature, error) {
|
||||
if c.bitcoinSig1 != nil {
|
||||
return c.bitcoinSig1, nil
|
||||
}
|
||||
|
||||
sig, err := btcec.ParseSignature(c.BitcoinSig1Bytes, btcec.S256())
|
||||
sig, err := ecdsa.ParseSignature(c.BitcoinSig1Bytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -3344,12 +3345,12 @@ func (c *ChannelAuthProof) BitcoinSig1() (*btcec.Signature, error) {
|
||||
//
|
||||
// NOTE: By having this method to access an attribute, we ensure we only need
|
||||
// to fully deserialize the signature if absolutely necessary.
|
||||
func (c *ChannelAuthProof) BitcoinSig2() (*btcec.Signature, error) {
|
||||
func (c *ChannelAuthProof) BitcoinSig2() (*ecdsa.Signature, error) {
|
||||
if c.bitcoinSig2 != nil {
|
||||
return c.bitcoinSig2, nil
|
||||
}
|
||||
|
||||
sig, err := btcec.ParseSignature(c.BitcoinSig2Bytes, btcec.S256())
|
||||
sig, err := ecdsa.ParseSignature(c.BitcoinSig2Bytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -3381,7 +3382,7 @@ type ChannelEdgePolicy struct {
|
||||
SigBytes []byte
|
||||
|
||||
// sig is a cached fully parsed signature.
|
||||
sig *btcec.Signature
|
||||
sig *ecdsa.Signature
|
||||
|
||||
// ChannelID is the unique channel ID for the channel. The first 3
|
||||
// bytes are the block height, the next 3 the index within the block,
|
||||
@ -3441,12 +3442,12 @@ type ChannelEdgePolicy struct {
|
||||
//
|
||||
// NOTE: By having this method to access an attribute, we ensure we only need
|
||||
// to fully deserialize the signature if absolutely necessary.
|
||||
func (c *ChannelEdgePolicy) Signature() (*btcec.Signature, error) {
|
||||
func (c *ChannelEdgePolicy) Signature() (*ecdsa.Signature, error) {
|
||||
if c.sig != nil {
|
||||
return c.sig, nil
|
||||
}
|
||||
|
||||
sig, err := btcec.ParseSignature(c.SigBytes, btcec.S256())
|
||||
sig, err := ecdsa.ParseSignature(c.SigBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/routing/route"
|
||||
|
@ -3,12 +3,12 @@ package channeldb
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"image/color"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"math/big"
|
||||
prand "math/rand"
|
||||
"net"
|
||||
"os"
|
||||
@ -18,10 +18,11 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@ -36,12 +37,13 @@ var (
|
||||
"[2001:db8:85a3:0:0:8a2e:370:7334]:80")
|
||||
testAddrs = []net.Addr{testAddr, anotherAddr}
|
||||
|
||||
testSig = &btcec.Signature{
|
||||
R: new(big.Int),
|
||||
S: new(big.Int),
|
||||
}
|
||||
_, _ = testSig.R.SetString("63724406601629180062774974542967536251589935445068131219452686511677818569431", 10)
|
||||
_, _ = testSig.S.SetString("18801056069249825825291287104931333862866033135609736119018462340006816851118", 10)
|
||||
testRBytes, _ = hex.DecodeString("8ce2bc69281ce27da07e6683571319d18e949ddfa2965fb6caa1bf0314f882d7")
|
||||
testSBytes, _ = hex.DecodeString("299105481d63e0f4bc2a88121167221b6700d72a0ead154c03be696a292d24ae")
|
||||
testRScalar = new(btcec.ModNScalar)
|
||||
testSScalar = new(btcec.ModNScalar)
|
||||
_ = testRScalar.SetByteSlice(testRBytes)
|
||||
_ = testSScalar.SetByteSlice(testSBytes)
|
||||
testSig = ecdsa.NewSignature(testRScalar, testSScalar)
|
||||
|
||||
testFeatures = lnwire.NewFeatureVector(
|
||||
lnwire.NewRawFeatureVector(lnwire.GossipQueriesRequired),
|
||||
@ -114,7 +116,7 @@ func createLightningNode(db kvdb.Backend, priv *btcec.PrivateKey) (*LightningNod
|
||||
}
|
||||
|
||||
func createTestVertex(db kvdb.Backend) (*LightningNode, error) {
|
||||
priv, err := btcec.NewPrivateKey(btcec.S256())
|
||||
priv, err := btcec.NewPrivateKey()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -3491,15 +3493,12 @@ func TestLightningNodeSigVerification(t *testing.T) {
|
||||
}
|
||||
|
||||
// Create private key and sign the data with it.
|
||||
priv, err := btcec.NewPrivateKey(btcec.S256())
|
||||
priv, err := btcec.NewPrivateKey()
|
||||
if err != nil {
|
||||
t.Fatalf("unable to crete priv key: %v", err)
|
||||
}
|
||||
|
||||
sign, err := priv.Sign(data[:])
|
||||
if err != nil {
|
||||
t.Fatalf("unable to sign: %v", err)
|
||||
}
|
||||
sign := ecdsa.Sign(priv, data[:])
|
||||
|
||||
// Sanity check that the signature checks out.
|
||||
if !sign.Verify(data[:], priv.PubKey()) {
|
||||
|
@ -3,8 +3,8 @@ package lnwire
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
)
|
||||
|
||||
// AcceptChannel is the message Bob sends to Alice after she initiates the
|
||||
|
@ -3,7 +3,7 @@ package lnwire
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
)
|
||||
|
||||
// ChannelReestablish is a message sent between peers that have an existing
|
||||
|
@ -3,7 +3,7 @@ package lnwire
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
)
|
||||
|
||||
// ClosingSigned is sent by both parties to a channel once the channel is clear
|
||||
|
@ -3,7 +3,7 @@ package lnwire
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
)
|
||||
|
||||
// FundingLocked is the message that both parties to a new channel creation
|
||||
|
@ -9,10 +9,10 @@ import (
|
||||
"math"
|
||||
"net"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/go-errors/errors"
|
||||
"github.com/lightningnetwork/lnd/tor"
|
||||
)
|
||||
@ -529,7 +529,7 @@ func ReadElement(r io.Reader, element interface{}) error {
|
||||
return err
|
||||
}
|
||||
|
||||
pubKey, err := btcec.ParsePubKey(b[:], btcec.S256())
|
||||
pubKey, err := btcec.ParsePubKey(b[:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package lnwire
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
)
|
||||
|
||||
|
@ -3,9 +3,9 @@ package lnwire
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcutil"
|
||||
)
|
||||
|
||||
// FundingFlag represents the possible bit mask values for the ChannelFlags
|
||||
|
@ -3,7 +3,7 @@ package lnwire
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
)
|
||||
|
||||
// RevokeAndAck is sent by either side once a CommitSig message has been
|
||||
|
@ -3,14 +3,14 @@ package lnwire
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
)
|
||||
|
||||
// Sig is a fixed-sized ECDSA signature. Unlike Bitcoin, we use fixed sized
|
||||
// signatures on the wire, instead of DER encoded signatures. This type
|
||||
// provides several methods to convert to/from a regular Bitcoin DER encoded
|
||||
// signature (raw bytes and *btcec.Signature).
|
||||
// signature (raw bytes and *ecdsa.Signature).
|
||||
type Sig [64]byte
|
||||
|
||||
// NewSigFromRawSignature returns a Sig from a Bitcoin raw signature encoded in
|
||||
@ -27,7 +27,7 @@ func NewSigFromRawSignature(sig []byte) (Sig, error) {
|
||||
// which means the length of R is the 4th byte and the length of S
|
||||
// is the second byte after R ends. 0x02 signifies a length-prefixed,
|
||||
// zero-padded, big-endian bigint. 0x30 signifies a DER signature.
|
||||
// See the Serialize() method for btcec.Signature for details.
|
||||
// See the Serialize() method for ecdsa.Signature for details.
|
||||
rLen := sig[3]
|
||||
sLen := sig[5+rLen]
|
||||
|
||||
@ -64,7 +64,7 @@ func NewSigFromRawSignature(sig []byte) (Sig, error) {
|
||||
}
|
||||
|
||||
// NewSigFromSignature creates a new signature as used on the wire, from an
|
||||
// existing btcec.Signature.
|
||||
// existing ecdsa.Signature.
|
||||
func NewSigFromSignature(e input.Signature) (Sig, error) {
|
||||
if e == nil {
|
||||
return Sig{}, fmt.Errorf("cannot decode empty signature")
|
||||
@ -74,12 +74,12 @@ func NewSigFromSignature(e input.Signature) (Sig, error) {
|
||||
return NewSigFromRawSignature(e.Serialize())
|
||||
}
|
||||
|
||||
// ToSignature converts the fixed-sized signature to a btcec.Signature objects
|
||||
// ToSignature converts the fixed-sized signature to a ecdsa.Signature objects
|
||||
// which can be used for signature validation checks.
|
||||
func (b *Sig) ToSignature() (*btcec.Signature, error) {
|
||||
func (b *Sig) ToSignature() (*ecdsa.Signature, error) {
|
||||
// Parse the signature with strict checks.
|
||||
sigBytes := b.ToSignatureBytes()
|
||||
sig, err := btcec.ParseDERSignature(sigBytes, btcec.S256())
|
||||
sig, err := ecdsa.ParseDERSignature(sigBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ import (
|
||||
"encoding/binary"
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
lnwire "github.com/lightningnetwork/lnd/channeldb/migration/lnwire21"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
)
|
||||
|
@ -6,10 +6,10 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
lnwire "github.com/lightningnetwork/lnd/channeldb/migration/lnwire21"
|
||||
"github.com/lightningnetwork/lnd/channeldb/migration21/common"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
@ -317,7 +317,7 @@ func ReadElement(r io.Reader, element interface{}) error {
|
||||
return err
|
||||
}
|
||||
|
||||
priv, _ := btcec.PrivKeyFromBytes(btcec.S256(), b[:])
|
||||
priv, _ := btcec.PrivKeyFromBytes(b[:])
|
||||
*e = priv
|
||||
|
||||
case **btcec.PublicKey:
|
||||
@ -326,7 +326,7 @@ func ReadElement(r io.Reader, element interface{}) error {
|
||||
return err
|
||||
}
|
||||
|
||||
pubKey, err := btcec.ParsePubKey(b[:], btcec.S256())
|
||||
pubKey, err := btcec.ParsePubKey(b[:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
lnwire "github.com/lightningnetwork/lnd/channeldb/migration/lnwire21"
|
||||
"github.com/lightningnetwork/lnd/channeldb/migration21/common"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
@ -276,7 +276,7 @@ func ReadElement(r io.Reader, element interface{}) error {
|
||||
return err
|
||||
}
|
||||
|
||||
pubKey, err := btcec.ParsePubKey(b[:], btcec.S256())
|
||||
pubKey, err := btcec.ParsePubKey(b[:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -2,12 +2,13 @@ package migration21
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
@ -27,16 +28,17 @@ var (
|
||||
0x1e, 0xb, 0x4c, 0xf9, 0x9e, 0xc5, 0x8c, 0xe9,
|
||||
}
|
||||
|
||||
_, pubKey = btcec.PrivKeyFromBytes(btcec.S256(), key[:])
|
||||
_, pubKey = btcec.PrivKeyFromBytes(key[:])
|
||||
|
||||
wireSig, _ = lnwire.NewSigFromSignature(testSig)
|
||||
|
||||
testSig = &btcec.Signature{
|
||||
R: new(big.Int),
|
||||
S: new(big.Int),
|
||||
}
|
||||
_, _ = testSig.R.SetString("63724406601629180062774974542967536251589935445068131219452686511677818569431", 10)
|
||||
_, _ = testSig.S.SetString("18801056069249825825291287104931333862866033135609736119018462340006816851118", 10)
|
||||
testRBytes, _ = hex.DecodeString("8ce2bc69281ce27da07e6683571319d18e949ddfa2965fb6caa1bf0314f882d7")
|
||||
testSBytes, _ = hex.DecodeString("299105481d63e0f4bc2a88121167221b6700d72a0ead154c03be696a292d24ae")
|
||||
testRScalar = new(btcec.ModNScalar)
|
||||
testSScalar = new(btcec.ModNScalar)
|
||||
_ = testRScalar.SetByteSlice(testRBytes)
|
||||
_ = testSScalar.SetByteSlice(testSBytes)
|
||||
testSig = ecdsa.NewSignature(testRScalar, testSScalar)
|
||||
|
||||
testTx = &wire.MsgTx{
|
||||
Version: 1,
|
||||
@ -390,16 +392,6 @@ func TestMigrateDatabaseWireMessages(t *testing.T) {
|
||||
return err
|
||||
}
|
||||
|
||||
testChanCloseSummary.RemotePub.Curve = nil
|
||||
testChanCloseSummary.RemoteCurrentRevocation.Curve = nil
|
||||
testChanCloseSummary.RemoteNextRevocation.Curve = nil
|
||||
testChanCloseSummary.LastChanSyncMsg.LocalUnrevokedCommitPoint.Curve = nil
|
||||
|
||||
newChanCloseSummary.RemotePub.Curve = nil
|
||||
newChanCloseSummary.RemoteCurrentRevocation.Curve = nil
|
||||
newChanCloseSummary.RemoteNextRevocation.Curve = nil
|
||||
newChanCloseSummary.LastChanSyncMsg.LocalUnrevokedCommitPoint.Curve = nil
|
||||
|
||||
if !reflect.DeepEqual(
|
||||
newChanCloseSummary, testChanCloseSummary,
|
||||
) {
|
||||
|
@ -9,10 +9,10 @@ import (
|
||||
"math/rand"
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
lnwire "github.com/lightningnetwork/lnd/channeldb/migration/lnwire21"
|
||||
mig "github.com/lightningnetwork/lnd/channeldb/migration_01_to_11"
|
||||
"github.com/lightningnetwork/lnd/channeldb/migtest"
|
||||
@ -62,7 +62,7 @@ var (
|
||||
},
|
||||
LockTime: 5,
|
||||
}
|
||||
_, pubKey = btcec.PrivKeyFromBytes(btcec.S256(), key[:])
|
||||
_, pubKey = btcec.PrivKeyFromBytes(key[:])
|
||||
)
|
||||
|
||||
// TestMigrateFwdPkgCleanup asserts that the migration will delete all the
|
||||
|
@ -8,10 +8,10 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
lnwire "github.com/lightningnetwork/lnd/channeldb/migration/lnwire21"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/shachain"
|
||||
|
@ -6,10 +6,10 @@ import (
|
||||
"math/rand"
|
||||
"os"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
_ "github.com/btcsuite/btcwallet/walletdb/bdb"
|
||||
lnwire "github.com/lightningnetwork/lnd/channeldb/migration/lnwire21"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
@ -60,7 +60,7 @@ var (
|
||||
},
|
||||
LockTime: 5,
|
||||
}
|
||||
privKey, pubKey = btcec.PrivKeyFromBytes(btcec.S256(), key[:])
|
||||
privKey, pubKey = btcec.PrivKeyFromBytes(key[:])
|
||||
)
|
||||
|
||||
// makeTestDB creates a new instance of the ChannelDB for testing purposes. A
|
||||
|
@ -6,10 +6,10 @@ import (
|
||||
"io"
|
||||
"net"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
lnwire "github.com/lightningnetwork/lnd/channeldb/migration/lnwire21"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/shachain"
|
||||
@ -324,7 +324,7 @@ func ReadElement(r io.Reader, element interface{}) error {
|
||||
return err
|
||||
}
|
||||
|
||||
priv, _ := btcec.PrivKeyFromBytes(btcec.S256(), b[:])
|
||||
priv, _ := btcec.PrivKeyFromBytes(b[:])
|
||||
*e = priv
|
||||
|
||||
case **btcec.PublicKey:
|
||||
@ -333,7 +333,7 @@ func ReadElement(r io.Reader, element interface{}) error {
|
||||
return err
|
||||
}
|
||||
|
||||
pubKey, err := btcec.ParsePubKey(b[:], btcec.S256())
|
||||
pubKey, err := btcec.ParsePubKey(b[:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -9,10 +9,10 @@ import (
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
lnwire "github.com/lightningnetwork/lnd/channeldb/migration/lnwire21"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
)
|
||||
@ -384,7 +384,7 @@ func (l *LightningNode) PubKey() (*btcec.PublicKey, error) {
|
||||
return l.pubKey, nil
|
||||
}
|
||||
|
||||
key, err := btcec.ParsePubKey(l.PubKeyBytes[:], btcec.S256())
|
||||
key, err := btcec.ParsePubKey(l.PubKeyBytes[:])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
package migration_01_to_11
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"image/color"
|
||||
"math/big"
|
||||
prand "math/rand"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
|
||||
lnwire "github.com/lightningnetwork/lnd/channeldb/migration/lnwire21"
|
||||
)
|
||||
|
||||
@ -18,12 +19,13 @@ var (
|
||||
"[2001:db8:85a3:0:0:8a2e:370:7334]:80")
|
||||
testAddrs = []net.Addr{testAddr, anotherAddr}
|
||||
|
||||
testSig = &btcec.Signature{
|
||||
R: new(big.Int),
|
||||
S: new(big.Int),
|
||||
}
|
||||
_, _ = testSig.R.SetString("63724406601629180062774974542967536251589935445068131219452686511677818569431", 10)
|
||||
_, _ = testSig.S.SetString("18801056069249825825291287104931333862866033135609736119018462340006816851118", 10)
|
||||
testRBytes, _ = hex.DecodeString("8ce2bc69281ce27da07e6683571319d18e949ddfa2965fb6caa1bf0314f882d7")
|
||||
testSBytes, _ = hex.DecodeString("299105481d63e0f4bc2a88121167221b6700d72a0ead154c03be696a292d24ae")
|
||||
testRScalar = new(btcec.ModNScalar)
|
||||
testSScalar = new(btcec.ModNScalar)
|
||||
_ = testRScalar.SetByteSlice(testRBytes)
|
||||
_ = testSScalar.SetByteSlice(testSBytes)
|
||||
testSig = ecdsa.NewSignature(testRScalar, testSScalar)
|
||||
|
||||
testFeatures = lnwire.NewFeatureVector(nil, nil)
|
||||
)
|
||||
@ -48,7 +50,7 @@ func createLightningNode(db *DB, priv *btcec.PrivateKey) (*LightningNode, error)
|
||||
}
|
||||
|
||||
func createTestVertex(db *DB) (*LightningNode, error) {
|
||||
priv, err := btcec.NewPrivateKey(btcec.S256())
|
||||
priv, err := btcec.NewPrivateKey()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -6,7 +6,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
|
||||
bitcoinCfg "github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
"github.com/lightningnetwork/lnd/zpay32"
|
||||
@ -150,12 +151,10 @@ func signDigestCompact(hash []byte) ([]byte, error) {
|
||||
// Should the signature reference a compressed public key or not.
|
||||
isCompressedKey := true
|
||||
|
||||
privKey, _ := btcec.PrivKeyFromBytes(btcec.S256(), testPrivKeyBytes)
|
||||
privKey, _ := btcec.PrivKeyFromBytes(testPrivKeyBytes)
|
||||
|
||||
// btcec.SignCompact returns a pubkey-recoverable signature
|
||||
sig, err := btcec.SignCompact(
|
||||
btcec.S256(), privKey, hash, isCompressedKey,
|
||||
)
|
||||
// ecdsa.SignCompact returns a pubkey-recoverable signature
|
||||
sig, err := ecdsa.SignCompact(privKey, hash, isCompressedKey)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("can't sign the hash: %v", err)
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
lnwire "github.com/lightningnetwork/lnd/channeldb/migration/lnwire21"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
)
|
||||
@ -839,7 +839,7 @@ func MigrateOutgoingPayments(tx kvdb.RwTx) error {
|
||||
// Since we don't have the session key for old payments, we
|
||||
// create a random one to be able to serialize the attempt
|
||||
// info.
|
||||
priv, _ := btcec.NewPrivateKey(btcec.S256())
|
||||
priv, _ := btcec.NewPrivateKey()
|
||||
s := &PaymentAttemptInfo{
|
||||
PaymentID: 0, // unknown.
|
||||
SessionKey: priv, // unknown.
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/go-errors/errors"
|
||||
lnwire "github.com/lightningnetwork/lnd/channeldb/migration/lnwire21"
|
||||
@ -440,8 +440,6 @@ func TestMigrateOptionalChannelCloseSummaryFields(t *testing.T) {
|
||||
|
||||
dbChan := dbChannels[0]
|
||||
if !reflect.DeepEqual(dbChan, test.closeSummary) {
|
||||
dbChan.RemotePub.Curve = nil
|
||||
test.closeSummary.RemotePub.Curve = nil
|
||||
t.Fatalf("not equal: %v vs %v",
|
||||
spew.Sdump(dbChan),
|
||||
spew.Sdump(test.closeSummary))
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
lnwire "github.com/lightningnetwork/lnd/channeldb/migration/lnwire21"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
|
@ -6,12 +6,12 @@ import (
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
lnwire "github.com/lightningnetwork/lnd/channeldb/migration/lnwire21"
|
||||
)
|
||||
|
||||
var (
|
||||
priv, _ = btcec.NewPrivateKey(btcec.S256())
|
||||
priv, _ = btcec.NewPrivateKey()
|
||||
pub = priv.PubKey()
|
||||
)
|
||||
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
sphinx "github.com/lightningnetwork/lightning-onion"
|
||||
lnwire "github.com/lightningnetwork/lnd/channeldb/migration/lnwire21"
|
||||
"github.com/lightningnetwork/lnd/record"
|
||||
@ -246,9 +246,7 @@ func (r *Route) ToSphinxPath() (*sphinx.PaymentPath, error) {
|
||||
// to an OnionHop with matching per-hop payload within the path as used
|
||||
// by the sphinx package.
|
||||
for i, hop := range r.Hops {
|
||||
pub, err := btcec.ParsePubKey(
|
||||
hop.PubKeyBytes[:], btcec.S256(),
|
||||
)
|
||||
pub, err := btcec.ParsePubKey(hop.PubKeyBytes[:])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -8,11 +8,12 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil/bech32"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcutil/bech32"
|
||||
lnwire "github.com/lightningnetwork/lnd/channeldb/migration/lnwire21"
|
||||
)
|
||||
|
||||
@ -112,8 +113,7 @@ func Decode(invoice string, net *chaincfg.Params) (*Invoice, error) {
|
||||
} else {
|
||||
headerByte := recoveryID + 27 + 4
|
||||
compactSign := append([]byte{headerByte}, sig[:]...)
|
||||
pubkey, _, err := btcec.RecoverCompact(btcec.S256(),
|
||||
compactSign, hash)
|
||||
pubkey, _, err := ecdsa.RecoverCompact(compactSign, hash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -350,7 +350,7 @@ func parseDestination(data []byte) (*btcec.PublicKey, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return btcec.ParsePubKey(base256Data, btcec.S256())
|
||||
return btcec.ParsePubKey(base256Data)
|
||||
}
|
||||
|
||||
// parseExpiry converts the data (encoded in base32) into the expiry time.
|
||||
@ -452,7 +452,7 @@ func parseRouteHint(data []byte) ([]HopHint, error) {
|
||||
|
||||
for len(base256Data) > 0 {
|
||||
hopHint := HopHint{}
|
||||
hopHint.NodeID, err = btcec.ParsePubKey(base256Data[:33], btcec.S256())
|
||||
hopHint.NodeID, err = btcec.ParsePubKey(base256Data[:33])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package zpay32
|
||||
|
||||
import "github.com/btcsuite/btcd/btcec"
|
||||
import "github.com/btcsuite/btcd/btcec/v2"
|
||||
|
||||
const (
|
||||
// DefaultFinalCLTVDelta is the default value to be used as the final
|
||||
|
@ -5,9 +5,9 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcutil"
|
||||
lnwire "github.com/lightningnetwork/lnd/channeldb/migration/lnwire21"
|
||||
)
|
||||
|
||||
@ -103,7 +103,7 @@ type MessageSigner struct {
|
||||
// SignCompact signs the passed hash with the node's privkey. The
|
||||
// returned signature should be 65 bytes, where the last 64 are the
|
||||
// compact signature, and the first one is a header byte. This is the
|
||||
// format returned by btcec.SignCompact.
|
||||
// format returned by ecdsa.SignCompact.
|
||||
SignCompact func(hash []byte) ([]byte, error)
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@ -68,7 +68,7 @@ func NewHtlcAttemptInfo(attemptID uint64, sessionKey *btcec.PrivateKey,
|
||||
func (h *HTLCAttemptInfo) SessionKey() *btcec.PrivateKey {
|
||||
if h.cachedSessionKey == nil {
|
||||
h.cachedSessionKey, _ = btcec.PrivKeyFromBytes(
|
||||
btcec.S256(), h.sessionKey[:],
|
||||
h.sessionKey[:],
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
)
|
||||
@ -298,7 +298,7 @@ func deserializeLinkNode(r io.Reader) (*LinkNode, error) {
|
||||
if _, err := io.ReadFull(r, pub[:]); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
node.IdentityPub, err = btcec.ParsePubKey(pub[:], btcec.S256())
|
||||
node.IdentityPub, err = btcec.ParsePubKey(pub[:])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
)
|
||||
|
||||
@ -23,8 +23,8 @@ func TestLinkNodeEncodeDecode(t *testing.T) {
|
||||
|
||||
// First we'll create some initial data to use for populating our test
|
||||
// LinkNode instances.
|
||||
_, pub1 := btcec.PrivKeyFromBytes(btcec.S256(), key[:])
|
||||
_, pub2 := btcec.PrivKeyFromBytes(btcec.S256(), rev[:])
|
||||
_, pub1 := btcec.PrivKeyFromBytes(key[:])
|
||||
_, pub2 := btcec.PrivKeyFromBytes(rev[:])
|
||||
addr1, err := net.ResolveTCPAddr("tcp", "10.0.0.1:9000")
|
||||
if err != nil {
|
||||
t.Fatalf("unable to create test addr: %v", err)
|
||||
@ -120,7 +120,7 @@ func TestDeleteLinkNode(t *testing.T) {
|
||||
|
||||
cdb := fullDB.ChannelStateDB()
|
||||
|
||||
_, pubKey := btcec.PrivKeyFromBytes(btcec.S256(), key[:])
|
||||
_, pubKey := btcec.PrivKeyFromBytes(key[:])
|
||||
addr := &net.TCPAddr{
|
||||
IP: net.ParseIP("127.0.0.1"),
|
||||
Port: 1337,
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcwallet/walletdb"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
@ -19,7 +19,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
priv, _ = btcec.NewPrivateKey(btcec.S256())
|
||||
priv, _ = btcec.NewPrivateKey()
|
||||
pub = priv.PubKey()
|
||||
|
||||
testHop1 = &route.Hop{
|
||||
|
@ -5,9 +5,9 @@ import (
|
||||
"errors"
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
"github.com/lightningnetwork/lnd/tlv"
|
||||
)
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"math"
|
||||
"net"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/lightningnetwork/lnd/chanbackup"
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/routing/route"
|
||||
|
@ -14,9 +14,9 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chanfunding"
|
||||
"github.com/urfave/cli"
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/jedib0t/go-pretty/v6/table"
|
||||
"github.com/jedib0t/go-pretty/v6/text"
|
||||
"github.com/lightninglabs/protobuf-hex-display/jsonpb"
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/lightningnetwork/lnd/lncfg"
|
||||
"github.com/urfave/cli"
|
||||
"gopkg.in/macaroon.v2"
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
"github.com/lightningnetwork/lnd/lncfg"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
|
@ -19,8 +19,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcutil"
|
||||
flags "github.com/jessevdk/go-flags"
|
||||
"github.com/lightninglabs/neutrino"
|
||||
"github.com/lightningnetwork/lnd/autopilot"
|
||||
|
@ -5,9 +5,9 @@ import (
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/sweep"
|
||||
|
@ -9,10 +9,10 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/btcsuite/btcd/blockchain"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
|
@ -19,11 +19,11 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/go-errors/errors"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
@ -432,7 +432,7 @@ func initBreachedOutputs() error {
|
||||
bo := &breachedOutputs[i]
|
||||
|
||||
// Parse the sign descriptor's pubkey.
|
||||
pubkey, err := btcec.ParsePubKey(breachKeys[i], btcec.S256())
|
||||
pubkey, err := btcec.ParsePubKey(breachKeys[i])
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to parse pubkey: %v",
|
||||
breachKeys[i])
|
||||
@ -1216,7 +1216,7 @@ func TestBreachCreateJusticeTx(t *testing.T) {
|
||||
// to the justice tx, not that we create a valid spend, so we just set
|
||||
// some params making the script generation succeed.
|
||||
aliceKeyPriv, _ := btcec.PrivKeyFromBytes(
|
||||
btcec.S256(), channels.AlicesPrivKey,
|
||||
channels.AlicesPrivKey,
|
||||
)
|
||||
alicePubKey := aliceKeyPriv.PubKey()
|
||||
|
||||
@ -2164,8 +2164,7 @@ func createTestArbiter(t *testing.T, contractBreaches chan *ContractBreachEvent,
|
||||
return NewRetributionStore(db)
|
||||
})
|
||||
|
||||
aliceKeyPriv, _ := btcec.PrivKeyFromBytes(btcec.S256(),
|
||||
channels.AlicesPrivKey)
|
||||
aliceKeyPriv, _ := btcec.PrivKeyFromBytes(channels.AlicesPrivKey)
|
||||
signer := &mock.SingleSigner{Privkey: aliceKeyPriv}
|
||||
|
||||
// Assemble our test arbiter.
|
||||
@ -2199,10 +2198,12 @@ func createTestArbiter(t *testing.T, contractBreaches chan *ContractBreachEvent,
|
||||
// initiator.
|
||||
func createInitChannels(revocationWindow int) (*lnwallet.LightningChannel, *lnwallet.LightningChannel, func(), error) {
|
||||
|
||||
aliceKeyPriv, aliceKeyPub := btcec.PrivKeyFromBytes(btcec.S256(),
|
||||
channels.AlicesPrivKey)
|
||||
bobKeyPriv, bobKeyPub := btcec.PrivKeyFromBytes(btcec.S256(),
|
||||
channels.BobsPrivKey)
|
||||
aliceKeyPriv, aliceKeyPub := btcec.PrivKeyFromBytes(
|
||||
channels.AlicesPrivKey,
|
||||
)
|
||||
bobKeyPriv, bobKeyPub := btcec.PrivKeyFromBytes(
|
||||
channels.BobsPrivKey,
|
||||
)
|
||||
|
||||
channelCapacity, err := btcutil.NewAmount(10)
|
||||
if err != nil {
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
@ -1209,7 +1209,7 @@ func decodeSignDetails(r io.Reader) (*input.SignDetails, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sig, err := btcec.ParseDERSignature(rawSig, btcec.S256())
|
||||
sig, err := ecdsa.ParseDERSignature(rawSig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user