diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-01-07 15:27:37 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-01-07 15:27:37 +0800 |
commit | d3b9af1343376862a473715e8211005cfbb5bdd7 (patch) | |
tree | 73932251c55c3503895e5a39bd9655349f5fc641 /core | |
parent | 492417dd55f6aaf0436c316634b66bf4882420f8 (diff) | |
download | dexon-consensus-d3b9af1343376862a473715e8211005cfbb5bdd7.tar dexon-consensus-d3b9af1343376862a473715e8211005cfbb5bdd7.tar.gz dexon-consensus-d3b9af1343376862a473715e8211005cfbb5bdd7.tar.bz2 dexon-consensus-d3b9af1343376862a473715e8211005cfbb5bdd7.tar.lz dexon-consensus-d3b9af1343376862a473715e8211005cfbb5bdd7.tar.xz dexon-consensus-d3b9af1343376862a473715e8211005cfbb5bdd7.tar.zst dexon-consensus-d3b9af1343376862a473715e8211005cfbb5bdd7.zip |
core: Add check for vote type (#406)
Diffstat (limited to 'core')
-rw-r--r-- | core/agreement.go | 4 |
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 } |