aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/agreement.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/agreement.go b/core/agreement.go
index 80a09d2..262c5d5 100644
--- a/core/agreement.go
+++ b/core/agreement.go
@@ -31,6 +31,7 @@ import (
// Errors for agreement module.
var (
+ ErrInvalidVote = fmt.Errorf("invalid vote")
ErrNotInNotarySet = fmt.Errorf("not in notary set")
ErrIncorrectVoteSignature = fmt.Errorf("incorrect vote signature")
)
@@ -266,6 +267,9 @@ func (a *agreement) nextState() (err error) {
}
func (a *agreement) sanityCheck(vote *types.Vote) error {
+ if vote.Type >= types.MaxVoteType {
+ return ErrInvalidVote
+ }
if _, exist := a.notarySet[vote.ProposerID]; !exist {
return ErrNotInNotarySet
}