multi: refactor SignDigest into SignMessage
To make it possible to use a remote signrpc server as a signer for our wallet, we need to change our main interface to sign the message instead of the message's digest. Otherwise we'd need to alter the signrpc.SignMessage RPC to accept a digest instead of only the message which has security implications.
This commit is contained in:
9 files changed
+123
-86
No files matched your search
@@ -36,10 +36,8 @@ func (n *NodeSigner) SignMessage(pubKey *btcec.PublicKey,
|
||||
return nil, fmt.Errorf("unknown public key")
|
||||
}
|
||||
|
||||
// Otherwise, we'll sign the dsha256 of the target message.
|
||||
var digest [32]byte
|
||||
copy(digest[:], chainhash.DoubleHashB(msg))
|
||||
sig, err := n.keySigner.SignDigest(digest)
|
||||
// Otherwise, we'll sign the double-sha256 of the target message.
|
||||
sig, err := n.keySigner.SignMessage(msg, true)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("can't sign the message: %v", err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user