consensus: dont allow peer round states to decrease
This commit is contained in:
parent
94f3d201e1
commit
06a7bb531b
|
@ -797,8 +797,8 @@ func (ps *PeerState) ApplyNewRoundStepMessage(msg *NewRoundStepMessage) {
|
|||
ps.mtx.Lock()
|
||||
defer ps.mtx.Unlock()
|
||||
|
||||
// Ignore duplicate messages.
|
||||
if ps.Height == msg.Height && ps.Round == msg.Round && ps.Step == msg.Step {
|
||||
// Ignore duplicates or decreases
|
||||
if CompareHRS(msg.Height, msg.Round, msg.Step, ps.Height, ps.Round, ps.Step) <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -1134,7 +1134,7 @@ func (cs *ConsensusState) enterCommit(height int, commitRound int) {
|
|||
|
||||
defer func() {
|
||||
// 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.CommitRound = commitRound
|
||||
cs.newStep()
|
||||
|
|
Loading…
Reference in New Issue