rpcserver: Copy btcwallet fix for verifymessage.
This commit is contained in:
parent
80fa803875
commit
07406791c9
1 changed files with 5 additions and 1 deletions
|
@ -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.
|
// Validate the signature - this just shows that it was valid at all.
|
||||||
// we will compare it with the key next.
|
// 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,
|
pk, wasCompressed, err := btcec.RecoverCompact(btcec.S256(), sig,
|
||||||
wire.DoubleSha256([]byte("Bitcoin Signed Message:\n"+c.Message)))
|
expectedMessageHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Mirror Bitcoin Core behavior, which treats error in
|
// Mirror Bitcoin Core behavior, which treats error in
|
||||||
// RecoverCompact as invalid signature.
|
// RecoverCompact as invalid signature.
|
||||||
|
|
Loading…
Reference in a new issue