Browse Source

RoundActionCommit* bug fixes

pull/9/head
Jae Kwon 10 years ago
parent
commit
09c20ddea1
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      consensus/reactor.go

+ 8
- 1
consensus/reactor.go View File

@ -260,7 +260,7 @@ func (conR *ConsensusReactor) Receive(chId byte, peer *p2p.Peer, msgBytes []byte
// Maybe run RoundActionCommitWait. // Maybe run RoundActionCommitWait.
if vote.Type == VoteTypeCommit && if vote.Type == VoteTypeCommit &&
rs.Commits.HasTwoThirdsMajority() && rs.Commits.HasTwoThirdsMajority() &&
rs.Step < RoundStepCommit {
rs.Step < RoundStepCommitWait {
// NOTE: Do not call RunAction*() methods here directly. // NOTE: Do not call RunAction*() methods here directly.
conR.doActionCh <- RoundAction{rs.Height, rs.Round, RoundActionCommitWait} conR.doActionCh <- RoundAction{rs.Height, rs.Round, RoundActionCommitWait}
} }
@ -422,6 +422,13 @@ ACTION_LOOP:
broadcastNewRoundStep(RoundStepCommit) broadcastNewRoundStep(RoundStepCommit)
if vote != nil { if vote != nil {
conR.broadcastVote(rs, vote) conR.broadcastVote(rs, vote)
// If we have +2/3 commits, queue an action to RoundActionCommitWait.
// Likely this is a duplicate action being pushed.
// See also Receive() where RoundActionCommitWait can be pushed in
// response to a vote from the network.
if rs.Commits.HasTwoThirdsMajority() {
conR.doActionCh <- RoundAction{rs.Height, rs.Round, RoundActionCommitWait}
}
} }
// do not schedule next action. // do not schedule next action.
continue ACTION_LOOP continue ACTION_LOOP


Loading…
Cancel
Save