Browse Source

consensus: dont allow peer round states to decrease

pull/192/head
Ethan Buchman 8 years ago
parent
commit
06a7bb531b
2 changed files with 3 additions and 3 deletions
  1. +2
    -2
      consensus/reactor.go
  2. +1
    -1
      consensus/state.go

+ 2
- 2
consensus/reactor.go View File

@ -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
}


+ 1
- 1
consensus/state.go View File

@ -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…
Cancel
Save