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,7 +3,8 @@ package mock
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"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/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
@@ -82,7 +83,7 @@ func (s *SingleSigner) SignOutputRaw(tx *wire.MsgTx,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return btcec.ParseDERSignature(sig[:len(sig)-1], btcec.S256())
|
||||
return ecdsa.ParseDERSignature(sig[:len(sig)-1])
|
||||
}
|
||||
|
||||
// ComputeInputScript computes an input script with the stored private key
|
||||
@@ -116,7 +117,7 @@ func (s *SingleSigner) ComputeInputScript(tx *wire.MsgTx,
|
||||
// SignMessage takes a public key and a message and only signs the message
|
||||
// with the stored private key if the public key matches the private key.
|
||||
func (s *SingleSigner) SignMessage(keyLoc keychain.KeyLocator,
|
||||
msg []byte, doubleHash bool) (*btcec.Signature, error) {
|
||||
msg []byte, doubleHash bool) (*ecdsa.Signature, error) {
|
||||
|
||||
mockKeyLoc := s.KeyLoc
|
||||
if s.KeyLoc.IsEmpty() {
|
||||
@@ -133,10 +134,5 @@ func (s *SingleSigner) SignMessage(keyLoc keychain.KeyLocator,
|
||||
} else {
|
||||
digest = chainhash.HashB(msg)
|
||||
}
|
||||
sign, err := s.Privkey.Sign(digest)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("can't sign the message: %v", err)
|
||||
}
|
||||
|
||||
return sign, nil
|
||||
return ecdsa.Sign(s.Privkey, digest), nil
|
||||
}
|
||||
Reference in new issue
Block a user