diff --git a/consensus/reactor.go b/consensus/reactor.go index d1edfc481..a0291c137 100644 --- a/consensus/reactor.go +++ b/consensus/reactor.go @@ -178,10 +178,15 @@ func (conR *ConsensusReactor) Receive(chId byte, peer *p2p.Peer, msgBytes []byte switch msg := msg_.(type) { case *VoteMessage: vote := msg.Vote - // XXX if we're receiving a commit from the last block while... if rs.Height != vote.Height { + if rs.Height == vote.Height+1 { + if rs.Step == RoundStepNewHeight && vote.Type == types.VoteTypeCommit { + goto VOTE_PASS // *ducks* + } + } return // Wrong height. Not necessarily a bad peer. } + VOTE_PASS: validatorIndex := msg.ValidatorIndex address, _ := rs.Validators.GetByIndex(validatorIndex) added, index, err := conR.conS.AddVote(address, vote) diff --git a/consensus/state.go b/consensus/state.go index ceebdb702..53fe6498b 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -13,6 +13,11 @@ Consensus State Machine Overview: at least Delta duration *after* +2/3 Commits were found. The step stays at NewHeight until this timeout occurs before proceeding to Propose. +* The NewHeight is a transition period after the height is incremented, + where the node still receives late commits before potentially proposing. + The height should be incremented because a block had been + "committed by the network", and clients should see that + reflected as a new height. +-------------------------------------+ | | @@ -550,7 +555,6 @@ func (cs *ConsensusState) updateToState(state *sm.State, contiguous bool) { // After the call cs.Step becomes RoundStepNewRound. func (cs *ConsensusState) setupNewRound(round uint) { - // XXX Looks like this is just not called. // Sanity check if round == 0 { panic("setupNewRound() should never be called for round 0")