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