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:
350 files changed
+2421
-1289
No files matched your search
+12
-15
@@ -18,13 +18,14 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/blockchain"
|
||||
"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/psbt"
|
||||
"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/btcutil/psbt"
|
||||
"github.com/btcsuite/btcwallet/waddrmgr"
|
||||
"github.com/btcsuite/btcwallet/wallet/txauthor"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
@@ -1239,7 +1240,7 @@ func (r *rpcServer) SendCoins(ctx context.Context,
|
||||
// accidentally tried to send funds to a bare pubkey address. This check is
|
||||
// here to prevent unintended transfers.
|
||||
decodedAddr, _ := hex.DecodeString(in.Addr)
|
||||
_, err = btcec.ParsePubKey(decodedAddr, btcec.S256())
|
||||
_, err = btcec.ParsePubKey(decodedAddr)
|
||||
if err == nil {
|
||||
return nil, fmt.Errorf("cannot send coins to pubkeys")
|
||||
}
|
||||
@@ -1570,7 +1571,7 @@ func (r *rpcServer) VerifyMessage(ctx context.Context,
|
||||
digest := chainhash.DoubleHashB(in.Msg)
|
||||
|
||||
// RecoverCompact both recovers the pubkey and validates the signature.
|
||||
pubKey, _, err := btcec.RecoverCompact(btcec.S256(), sig, digest)
|
||||
pubKey, _, err := ecdsa.RecoverCompact(sig, digest)
|
||||
if err != nil {
|
||||
return &lnrpc.VerifyMessageResponse{Valid: false}, nil
|
||||
}
|
||||
@@ -1613,7 +1614,7 @@ func (r *rpcServer) ConnectPeer(ctx context.Context,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pubKey, err := btcec.ParsePubKey(pubkeyHex, btcec.S256())
|
||||
pubKey, err := btcec.ParsePubKey(pubkeyHex)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -1682,7 +1683,7 @@ func (r *rpcServer) DisconnectPeer(ctx context.Context,
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to decode pubkey bytes: %v", err)
|
||||
}
|
||||
peerPubKey, err := btcec.ParsePubKey(pubKeyBytes, btcec.S256())
|
||||
peerPubKey, err := btcec.ParsePubKey(pubKeyBytes)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to parse pubkey: %v", err)
|
||||
}
|
||||
@@ -1749,17 +1750,13 @@ func newFundingShimAssembler(chanPointShim *lnrpc.ChanPointShim, initiator bool,
|
||||
|
||||
// Next we'll parse out the remote party's funding key, as well as our
|
||||
// full key descriptor.
|
||||
remoteKey, err := btcec.ParsePubKey(
|
||||
chanPointShim.RemoteKey, btcec.S256(),
|
||||
)
|
||||
remoteKey, err := btcec.ParsePubKey(chanPointShim.RemoteKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
shimKeyDesc := chanPointShim.LocalKey
|
||||
localKey, err := btcec.ParsePubKey(
|
||||
shimKeyDesc.RawKeyBytes, btcec.S256(),
|
||||
)
|
||||
localKey, err := btcec.ParsePubKey(shimKeyDesc.RawKeyBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -1937,7 +1934,7 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
|
||||
// Parse the raw bytes of the node key into a pubkey object so we can
|
||||
// easily manipulate it.
|
||||
case len(in.NodePubkey) > 0:
|
||||
nodePubKey, err = btcec.ParsePubKey(in.NodePubkey, btcec.S256())
|
||||
nodePubKey, err = btcec.ParsePubKey(in.NodePubkey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -1951,7 +1948,7 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
nodePubKey, err = btcec.ParsePubKey(keyBytes, btcec.S256())
|
||||
nodePubKey, err = btcec.ParsePubKey(keyBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user