- return false, err
- }
-
- startTimestamp := prevVoteRoundLastBlock.Timestamp + consensus.BlockTimeInterval
- begin := getLastBlockTimeInTimeRange(startTimestamp, timeStamp, consensusNode.Order, len(consensusNodeMap))
- end := begin + consensus.BlockNumEachNode*consensus.BlockTimeInterval
- return timeStamp >= begin && timeStamp < end, nil
-}
-
-func getLastBlockTimeInTimeRange(startTimestamp, endTimestamp, order uint64, numOfConsensusNode int) uint64 {
- // One round of product block time for all consensus nodes
- roundBlockTime := uint64(consensus.BlockNumEachNode * numOfConsensusNode * consensus.BlockTimeInterval)
- // The start time of the last round of product block
- lastRoundStartTime := startTimestamp + (endTimestamp-startTimestamp)/roundBlockTime*roundBlockTime
- // The time of product block of the consensus in last round
- return lastRoundStartTime + order*(consensus.BlockNumEachNode*consensus.BlockTimeInterval)
-}
-
-func (c *consensusNodeManager) getPrevRoundVoteLastBlock(prevBlockHash *bc.Hash) (*state.BlockNode, error) {
- prevBlockNode := c.blockIndex.GetNode(prevBlockHash)
- if prevBlockNode == nil {
- return nil, errNotFoundBlockNode