X-Git-Url: http://git.osdn.net/view?p=bytom%2Fvapor.git;a=blobdiff_plain;f=protocol%2Fconsensus_node_manager.go;h=d55e7ccf044c25c3c08f7de95f1adac80ebdafa9;hp=930e42db5ed9eb4899f4ef8b34afdcb7d0f3ce2d;hb=73164af54a2587ba479b8b133274e3ecd0559a68;hpb=f8b08ae822eec5e86e60863e5b00b6353490a6bd diff --git a/protocol/consensus_node_manager.go b/protocol/consensus_node_manager.go index 930e42db..d55e7ccf 100644 --- a/protocol/consensus_node_manager.go +++ b/protocol/consensus_node_manager.go @@ -21,11 +21,11 @@ func (c *Chain) getBestConsensusResult() (*state.ConsensusResult, error) { func getBlockerOrder(startTimestamp, blockTimestamp, numOfConsensusNode uint64) uint64 { // One round of product block time for all consensus nodes - roundBlockTime := consensus.BlockNumEachNode * numOfConsensusNode * consensus.BlockTimeInterval + roundBlockTime := consensus.ActiveNetParams.BlockNumEachNode * numOfConsensusNode * consensus.ActiveNetParams.BlockTimeInterval // The start time of the last round of product block lastRoundStartTime := startTimestamp + (blockTimestamp-startTimestamp)/roundBlockTime*roundBlockTime // Order of blocker - return (blockTimestamp - lastRoundStartTime) / (consensus.BlockNumEachNode * consensus.BlockTimeInterval) + return (blockTimestamp - lastRoundStartTime) / (consensus.ActiveNetParams.BlockNumEachNode * consensus.ActiveNetParams.BlockTimeInterval) } func (c *Chain) getConsensusNode(prevBlockHash *bc.Hash, pubkey string) (*state.ConsensusNode, error) { @@ -89,7 +89,7 @@ func (c *Chain) getPrevRoundLastBlock(prevBlockHash *bc.Hash) (*types.BlockHeade return nil, errNotFoundBlockNode } - for blockHeader.Height%consensus.RoundVoteBlockNums != 0 { + for blockHeader.Height%consensus.ActiveNetParams.RoundVoteBlockNums != 0 { blockHeader, err = c.store.GetBlockHeader(&blockHeader.PreviousBlockHash) if err != nil { return nil, err @@ -147,7 +147,7 @@ func (c *Chain) GetBlocker(prevBlockHash *bc.Hash, timeStamp uint64) (string, er return "", err } - startTimestamp := prevVoteRoundLastBlock.Timestamp + consensus.BlockTimeInterval + startTimestamp := prevVoteRoundLastBlock.Timestamp + consensus.ActiveNetParams.BlockTimeInterval order := getBlockerOrder(startTimestamp, timeStamp, uint64(len(consensusNodeMap))) for xPub, consensusNode := range consensusNodeMap { if consensusNode.Order == order {