verify evidence in block

This commit is contained in:
Ethan Buchman
2017-12-26 20:21:17 -05:00
parent 4661c98c17
commit 35587658cd
4 changed files with 33 additions and 5 deletions
+11
View File
@@ -101,3 +101,14 @@ func (vote *Vote) String() string {
cmn.Fingerprint(vote.BlockID.Hash), vote.Signature,
CanonicalTime(vote.Timestamp))
}
func (vote *Vote) Verify(chainID string, pubKey crypto.PubKey) error {
if !bytes.Equal(pubKey.Address(), v.ValidatorAddress) {
return ErrVoteInvalidValidatorAddress
}
if !pubKey.VerifyBytes(SignBytes(chainID, vote), vote.Signature) {
return ErrVoteInvalidSignature
}
return nil
}