Browse Source

Merge pull request #2704 from tendermint/2702-proposal-pol-round-validation

if some process locks a block in round 0, then 0 is valid proposal.PO…
pull/2762/head
Ethan Buchman 6 years ago
committed by GitHub
parent
commit
071ebdd514
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions
  1. +3
    -3
      consensus/state.go
  2. +1
    -1
      types/vote_set.go

+ 3
- 3
consensus/state.go View File

@ -1408,9 +1408,9 @@ func (cs *ConsensusState) defaultSetProposal(proposal *types.Proposal) error {
return nil 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) {
// Verify POLRound, which must be -1 or in range [0, proposal.Round).
if proposal.POLRound < -1 ||
(proposal.POLRound >= 0 && proposal.POLRound >= proposal.Round) {
return ErrInvalidProposalPOLRound return ErrInvalidProposalPOLRound
} }


+ 1
- 1
types/vote_set.go View File

@ -158,7 +158,7 @@ func (voteSet *VoteSet) addVote(vote *Vote) (added bool, err error) {
if (vote.Height != voteSet.height) || if (vote.Height != voteSet.height) ||
(vote.Round != voteSet.round) || (vote.Round != voteSet.round) ||
(vote.Type != voteSet.type_) { (vote.Type != voteSet.type_) {
return false, errors.Wrapf(ErrVoteUnexpectedStep, "Got %d/%d/%d, expected %d/%d/%d",
return false, errors.Wrapf(ErrVoteUnexpectedStep, "Expected %d/%d/%d, but got %d/%d/%d",
voteSet.height, voteSet.round, voteSet.type_, voteSet.height, voteSet.round, voteSet.type_,
vote.Height, vote.Round, vote.Type) vote.Height, vote.Round, vote.Type)
} }


Loading…
Cancel
Save