Fix view id calc

pull/3435/head
Rongjian Lan 4 years ago committed by Leo Chen
parent 0ee4db8dbf
commit fea096b0f9
  1. 5
      consensus/view_change.go

@ -131,9 +131,8 @@ func (consensus *Consensus) getNextViewID() (uint64, time.Duration) {
if curTimestamp <= blockTimestamp {
return consensus.fallbackNextViewID()
}
totalNode := consensus.Decider.ParticipantsCount()
// diff is at least 1, and it won't exceed the totalNode
diff := uint64(((curTimestamp - blockTimestamp) / viewChangeTimeout) % int64(totalNode))
// diff only increases
diff := uint64((curTimestamp - blockTimestamp) / viewChangeTimeout)
nextViewID := diff + consensus.GetCurBlockViewID()
consensus.getLogger().Info().

Loading…
Cancel
Save