refactored.

feature/refactor-consensus-view
frozen 9 months ago
parent f8071179ab
commit e0412ae06a
No known key found for this signature in database
GPG Key ID: 5391C63E79B03EDE
  1. 10
      cmd/harmony/main.go
  2. 5
      consensus/consensus.go

@ -812,7 +812,7 @@ func setupConsensusAndNode(hc harmonyconfig.HarmonyConfig, nodeConfig *nodeconfi
registry = setupChain(hc, nodeConfig, registry)
if registry.GetShardChainCollection() == nil {
panic("shard chain collection is nil1111111")
panic("shard chain collection is nil")
}
registry.SetWebHooks(nodeConfig.WebHooks.Hooks)
cxPool := core.NewCxPool(core.CxPoolSize)
@ -862,14 +862,6 @@ func setupConsensusAndNode(hc harmonyconfig.HarmonyConfig, nodeConfig *nodeconfi
currentNode.NodeConfig.SetClientGroupID(nodeconfig.NewClientGroupIDByShardID(shard.BeaconChainShardID))
currentNode.NodeConfig.ConsensusPriKey = nodeConfig.ConsensusPriKey
// This needs to be executed after consensus setup
if err := currentConsensus.InitConsensusWithValidators(); err != nil {
utils.Logger().Warn().
Int("shardID", hc.General.ShardID).
Err(err).
Msg("InitConsensusWithMembers failed")
}
// Set the consensus ID to be the current block number
viewID := currentNode.Blockchain().CurrentBlock().Header().ViewID().Uint64()
currentConsensus.SetViewIDs(viewID + 1)

@ -313,6 +313,11 @@ func New(
initMetrics()
consensus.AddPubkeyMetrics()
err := consensus.InitConsensusWithValidators()
if err != nil {
return nil, errors.WithMessage(err, "failed to init consensus with validators")
}
return &consensus, nil
}

Loading…
Cancel
Save