From 506014f22faba150cd7197e7dd817e72a914dc84 Mon Sep 17 00:00:00 2001 From: Wei-Ning Huang Date: Thu, 27 Sep 2018 14:27:18 +0800 Subject: core: update governance interface and config (#145) 1) Remove RoundHeight from config. 2) NotarySet is not from governance contract, we get Node set intead. Notary set is caculated from the NodeSet using CRS. 3) CRS is not in the governance interface. --- core/consensus.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'core/consensus.go') diff --git a/core/consensus.go b/core/consensus.go index f2b945b..d7dc3a4 100644 --- a/core/consensus.go +++ b/core/consensus.go @@ -211,10 +211,15 @@ func NewConsensus( network Network, prv crypto.PrivateKey) *Consensus { - // TODO(w): load latest blockHeight from DB, and use config at that height. - var blockHeight uint64 - config := gov.GetConfiguration(blockHeight) - notarySet := gov.GetNotarySet(blockHeight) + // TODO(w): load latest round from DB. + var round uint64 + config := gov.GetConfiguration(round) + + // TODO(w): notarySet is different for each chain, need to write a + // GetNotarySetForChain(nodeSet, shardID, chainID, crs) function to get the + // correct notary set for a given chain. + notarySet := gov.GetNodeSet(round) + crs := gov.GetCRS(round) ID := types.NewNodeID(prv.PublicKey()) @@ -290,7 +295,7 @@ func NewConsensus( con.ID, con.receivers[chainID], nodes, - newGenesisLeaderSelector(config.CRS), + newGenesisLeaderSelector(crs), blockProposer, ) } @@ -386,7 +391,7 @@ func (con *Consensus) runDKGTSIG() { panic(err) } hash := HashConfigurationBlock( - con.gov.GetNotarySet(0), + con.gov.GetNodeSet(0), con.gov.GetConfiguration(0), common.Hash{}, con.cfgModule.prevHash) -- cgit v1.2.3