OSDN Git Service

modify general config (#257)
[bytom/vapor.git] / protocol / consensus_node_manager.go
index 930e42d..d55e7cc 100644 (file)
@@ -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
 
 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
        // 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) {
 }
 
 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
        }
 
                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
                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
        }
 
                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 {
        order := getBlockerOrder(startTimestamp, timeStamp, uint64(len(consensusNodeMap)))
        for xPub, consensusNode := range consensusNodeMap {
                if consensusNode.Order == order {