ProposalPOLRound...

This commit is contained in:
Jae Kwon
2015-06-22 19:04:31 -07:00
parent 3db63477aa
commit 9b96e2e171
7 changed files with 212 additions and 154 deletions

View File

@ -126,6 +126,7 @@ var (
var (
ErrInvalidProposalSignature = errors.New("Error invalid proposal signature")
ErrInvalidProposalPOLRound = errors.New("Error invalid proposal POL round")
)
//-----------------------------------------------------------------------------
@ -900,6 +901,12 @@ func (cs *ConsensusState) SetProposal(proposal *Proposal) error {
return nil
}
// Verify POLRound, which must be -1 or between 0 and proposal.Round exclusive.
if proposal.POLRound != -1 &&
(proposal.POLRound < 0 || proposal.Round <= proposal.POLRound) {
return ErrInvalidProposalPOLRound
}
// Verify signature
if !cs.Validators.Proposer().PubKey.VerifyBytes(account.SignBytes(cs.state.ChainID, proposal), proposal.Signature) {
return ErrInvalidProposalSignature