|
|
|
@ -686,15 +686,7 @@ func setupConsensusAndNode(hc harmonyconfig.HarmonyConfig, nodeConfig *nodeconfi |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
nodeconfig.GetDefaultConfig().DBDir = nodeConfig.DBDir |
|
|
|
|
switch hc.General.NodeType { |
|
|
|
|
case nodeTypeExplorer: |
|
|
|
|
nodeconfig.SetDefaultRole(nodeconfig.ExplorerNode) |
|
|
|
|
currentNode.NodeConfig.SetRole(nodeconfig.ExplorerNode) |
|
|
|
|
|
|
|
|
|
case nodeTypeValidator: |
|
|
|
|
nodeconfig.SetDefaultRole(nodeconfig.Validator) |
|
|
|
|
currentNode.NodeConfig.SetRole(nodeconfig.Validator) |
|
|
|
|
} |
|
|
|
|
processNodeType(hc, currentNode, currentConsensus) |
|
|
|
|
currentNode.NodeConfig.SetShardGroupID(nodeconfig.NewGroupIDByShardID(nodeconfig.ShardID(nodeConfig.ShardID))) |
|
|
|
|
currentNode.NodeConfig.SetClientGroupID(nodeconfig.NewClientGroupIDByShardID(shard.BeaconChainShardID)) |
|
|
|
|
currentNode.NodeConfig.ConsensusPriKey = nodeConfig.ConsensusPriKey |
|
|
|
@ -723,6 +715,22 @@ func setupConsensusAndNode(hc harmonyconfig.HarmonyConfig, nodeConfig *nodeconfi |
|
|
|
|
return currentNode |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func processNodeType(hc harmonyconfig.HarmonyConfig, currentNode *node.Node, currentConsensus *consensus.Consensus) { |
|
|
|
|
switch hc.General.NodeType { |
|
|
|
|
case nodeTypeExplorer: |
|
|
|
|
nodeconfig.SetDefaultRole(nodeconfig.ExplorerNode) |
|
|
|
|
currentNode.NodeConfig.SetRole(nodeconfig.ExplorerNode) |
|
|
|
|
|
|
|
|
|
case nodeTypeValidator: |
|
|
|
|
nodeconfig.SetDefaultRole(nodeconfig.Validator) |
|
|
|
|
currentNode.NodeConfig.SetRole(nodeconfig.Validator) |
|
|
|
|
|
|
|
|
|
if hc.General.IsBackup { |
|
|
|
|
currentConsensus.SetIsBackup(true) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func setupPrometheusService(node *node.Node, hc harmonyconfig.HarmonyConfig, sid uint32) { |
|
|
|
|
prometheusConfig := prometheus.Config{ |
|
|
|
|
Enabled: hc.Prometheus.Enabled, |
|
|
|
|