Browse Source

allow commit votes for the last height when we're in

RoundStepNewHeight
pull/67/head
Jae Kwon 10 years ago
parent
commit
ef42d41636
2 changed files with 11 additions and 2 deletions
  1. +6
    -1
      consensus/reactor.go
  2. +5
    -1
      consensus/state.go

+ 6
- 1
consensus/reactor.go View File

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


+ 5
- 1
consensus/state.go View File

@ -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")


Loading…
Cancel
Save