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
@@ -3,15 +3,15 @@ package btcwallet
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"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/hdkeychain"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcutil/hdkeychain"
|
||||
"github.com/btcsuite/btcwallet/waddrmgr"
|
||||
"github.com/btcsuite/btcwallet/walletdb"
|
||||
"github.com/go-errors/errors"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
@@ -367,7 +367,7 @@ func (b *BtcWallet) SignOutputRaw(tx *wire.MsgTx,
|
||||
}
|
||||
|
||||
// Chop off the sighash flag at the end of the signature.
|
||||
return btcec.ParseDERSignature(sig[:len(sig)-1], btcec.S256())
|
||||
return ecdsa.ParseDERSignature(sig[:len(sig)-1])
|
||||
}
|
||||
|
||||
// ComputeInputScript generates a complete InputScript for the passed
|
||||
@@ -412,7 +412,7 @@ var _ input.Signer = (*BtcWallet)(nil)
|
||||
//
|
||||
// NOTE: This is a part of the MessageSigner interface.
|
||||
func (b *BtcWallet) SignMessage(keyLoc keychain.KeyLocator,
|
||||
msg []byte, doubleHash bool) (*btcec.Signature, error) {
|
||||
msg []byte, doubleHash bool) (*ecdsa.Signature, error) {
|
||||
|
||||
// First attempt to fetch the private key which corresponds to the
|
||||
// specified public key.
|
||||
@@ -430,12 +430,7 @@ func (b *BtcWallet) SignMessage(keyLoc keychain.KeyLocator,
|
||||
} else {
|
||||
msgDigest = chainhash.HashB(msg)
|
||||
}
|
||||
sign, err := privKey.Sign(msgDigest)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("unable sign the message: %v", err)
|
||||
}
|
||||
|
||||
return sign, nil
|
||||
return ecdsa.Sign(privKey, msgDigest), nil
|
||||
}
|
||||
|
||||
// A compile time check to ensure that BtcWallet implements the MessageSigner
|
||||
|
||||
Reference in new issue
Block a user