mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-03 19:53:58 +00:00
types: update for new go-wire. WriteSignBytes -> SignBytes
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/tendermint/go-crypto"
|
||||
@@ -73,11 +72,15 @@ type Vote struct {
|
||||
Signature crypto.Signature `json:"signature"`
|
||||
}
|
||||
|
||||
func (vote *Vote) WriteSignBytes(chainID string, w io.Writer, n *int, err *error) {
|
||||
wire.WriteJSON(CanonicalJSONOnceVote{
|
||||
func (vote *Vote) SignBytes(chainID string) []byte {
|
||||
bz, err := wire.MarshalJSON(CanonicalJSONOnceVote{
|
||||
chainID,
|
||||
CanonicalVote(vote),
|
||||
}, w, n, err)
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return bz
|
||||
}
|
||||
|
||||
func (vote *Vote) Copy() *Vote {
|
||||
@@ -111,7 +114,7 @@ func (vote *Vote) Verify(chainID string, pubKey crypto.PubKey) error {
|
||||
return ErrVoteInvalidValidatorAddress
|
||||
}
|
||||
|
||||
if !pubKey.VerifyBytes(SignBytes(chainID, vote), vote.Signature) {
|
||||
if !pubKey.VerifyBytes(vote.SignBytes(chainID), vote.Signature) {
|
||||
return ErrVoteInvalidSignature
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user