rpcserver: Copy btcwallet fix for verifymessage.

This commit is contained in:
Josh Rickmar 2015-10-16 14:11:05 -04:00
parent 80fa803875
commit 07406791c9

View file

@ -3372,8 +3372,12 @@ func handleVerifyMessage(s *rpcServer, cmd interface{}, closeChan <-chan struct{
// Validate the signature - this just shows that it was valid at all.
// we will compare it with the key next.
var buf bytes.Buffer
wire.WriteVarString(&buf, 0, "Bitcoin Signed Message:\n")
wire.WriteVarString(&buf, 0, c.Message)
expectedMessageHash := wire.DoubleSha256(buf.Bytes())
pk, wasCompressed, err := btcec.RecoverCompact(btcec.S256(), sig,
wire.DoubleSha256([]byte("Bitcoin Signed Message:\n"+c.Message)))
expectedMessageHash)
if err != nil {
// Mirror Bitcoin Core behavior, which treats error in
// RecoverCompact as invalid signature.