consensus: dont allow peer round states to decrease

This commit is contained in:
Ethan Buchman
2016-03-05 01:18:14 -05:00
parent 94f3d201e1
commit 06a7bb531b
2 changed files with 3 additions and 3 deletions

View File

@ -797,8 +797,8 @@ func (ps *PeerState) ApplyNewRoundStepMessage(msg *NewRoundStepMessage) {
ps.mtx.Lock() ps.mtx.Lock()
defer ps.mtx.Unlock() defer ps.mtx.Unlock()
// Ignore duplicate messages. // Ignore duplicates or decreases
if ps.Height == msg.Height && ps.Round == msg.Round && ps.Step == msg.Step { if CompareHRS(msg.Height, msg.Round, msg.Step, ps.Height, ps.Round, ps.Step) <= 0 {
return return
} }

View File

@ -1134,7 +1134,7 @@ func (cs *ConsensusState) enterCommit(height int, commitRound int) {
defer func() { defer func() {
// Done enterCommit: // Done enterCommit:
// keep ca.Round the same, it points to the right Precommits set. // keep cs.Round the same, commitRound points to the right Precommits set.
cs.updateRoundStep(cs.Round, RoundStepCommit) cs.updateRoundStep(cs.Round, RoundStepCommit)
cs.CommitRound = commitRound cs.CommitRound = commitRound
cs.newStep() cs.newStep()