| layout | post |
|---|---|
| permalink | /how-to-select-the-proposer/ |
The proposer is selected based on block height and round.
Last confirmed block height.
Round is a variable used within one block generation cycle. When some nodes do not run normally, the round is needed to select a normal node for proposer.
- Sorting validators by valiator address alphabetically.
n= (block height + round number) mod len(validators)- The proposer is n'th validator
func CalculateProposer(blockHeight int, roundNumber int) string {
candidates := sort.StringSlice(nr.connectionManager.RoundCandidates())
candidates.Sort()
return candidates[(blockHeight + roundNumber)%len(candidates)]
}