Merge branch 'main' of github.com:harmony-one/harmony into main

pull/3447/head
Rongjian Lan 4 years ago
commit 70d7bf1904
  1. 5
      consensus/view_change.go

@ -125,6 +125,7 @@ func (consensus *Consensus) getNextViewID() (uint64, time.Duration) {
return consensus.fallbackNextViewID()
}
blockTimestamp := curHeader.Time().Int64()
lastBlockViewID := curHeader.ViewID().Uint64()
curTimestamp := time.Now().Unix()
// timestamp messed up in current validator node
@ -133,13 +134,13 @@ func (consensus *Consensus) getNextViewID() (uint64, time.Duration) {
}
// diff only increases
diff := uint64((curTimestamp - blockTimestamp) / viewChangeTimeout)
nextViewID := diff + consensus.GetCurBlockViewID()
nextViewID := diff + lastBlockViewID
consensus.getLogger().Info().
Int64("curTimestamp", curTimestamp).
Int64("blockTimestamp", blockTimestamp).
Uint64("nextViewID", nextViewID).
Uint64("curViewID", consensus.GetCurBlockViewID()).
Uint64("lastBlockViewID", lastBlockViewID).
Msg("[getNextViewID]")
// duration is always the fixed view change duration for synchronous view change

Loading…
Cancel
Save