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:
Oliver Gugger committed 2021-10-08 12:06:51 +02:00
1 parent dd3719d5de
commit 02757f6735
9 files changed
+123 -86

No files matched your search

+2 -4
View File
@@ -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)
}