bestBlockHash := bestBlockHeader.Hash()
now := uint64(time.Now().UnixNano() / 1e6)
- base := now
- if now < bestBlockHeader.Timestamp {
- base = bestBlockHeader.Timestamp
+ base := bestBlockHeader.Timestamp
+ if now > bestBlockHeader.Timestamp+consensus.ActiveNetParams.BlockTimeInterval+consensus.ActiveNetParams.BlockTimeInterval/10 {
+ base = now - consensus.ActiveNetParams.BlockTimeInterval
}
minTimeToNextBlock := consensus.ActiveNetParams.BlockTimeInterval - base%consensus.ActiveNetParams.BlockTimeInterval
nextBlockTime := base + minTimeToNextBlock
nextBlockTime += consensus.ActiveNetParams.BlockTimeInterval
}
+ if nextBlockTime > now {
+ continue
+ }
+
validator, err := b.chain.GetValidator(&bestBlockHash, nextBlockTime)
if err != nil {
log.WithFields(log.Fields{"module": logModule, "error": err, "pubKey": xpubStr}).Error("fail on check is next blocker")