Skip to content

Commit

Permalink
Merge pull request #36 from renproject/fix/notify-proposer
Browse files Browse the repository at this point in the history
Notify observer regarding sufficient nil prevotes only if we are the proposer
  • Loading branch information
jazg authored Nov 4, 2019
2 parents 7b39eea + dd872e9 commit 968183c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions process/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ func (inbox *Inbox) QueryByHeightRound(height block.Height, round block.Round) (
return
}

func (inbox *Inbox) F() int {
return inbox.f
}

Expand Down
5 changes: 4 additions & 1 deletion process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,10 @@ func (p *Process) handlePrevote(prevote *Prevote) {

// upon f+1 Prevote{currentHeight, currentRound, nil}
if n := p.state.Prevotes.QueryByHeightRoundBlockHash(p.state.CurrentHeight, p.state.CurrentRound, block.InvalidHash); n > p.state.Prevotes.F() {
p.observer.DidReceiveSufficientNilPrevotes(p.state.Prevotes.QueryMessagesByHeightRound(p.state.CurrentHeight, p.state.CurrentRound), p.state.Prevotes.F())
// if we are the proposer
if p.signatory.Equal(p.scheduler.Schedule(p.state.CurrentHeight, p.state.CurrentRound)) {
p.observer.DidReceiveSufficientNilPrevotes(p.state.Prevotes.QueryMessagesByHeightRound(p.state.CurrentHeight, p.state.CurrentRound), p.state.Prevotes.F())
}
}

// upon 2f+1 Prevote{currentHeight, currentRound, nil} while currentStep = StepPrevote
Expand Down

0 comments on commit 968183c

Please sign in to comment.