diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-09-27 14:27:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-27 14:27:18 +0800 |
commit | 506014f22faba150cd7197e7dd817e72a914dc84 (patch) | |
tree | 3f61287a4578c31c447cc8d9283fc3c728dd6cb7 /core/consensus.go | |
parent | 9c2f700be09c27e8a8d12fc5bc0ccd017d408a32 (diff) | |
download | dexon-consensus-506014f22faba150cd7197e7dd817e72a914dc84.tar dexon-consensus-506014f22faba150cd7197e7dd817e72a914dc84.tar.gz dexon-consensus-506014f22faba150cd7197e7dd817e72a914dc84.tar.bz2 dexon-consensus-506014f22faba150cd7197e7dd817e72a914dc84.tar.lz dexon-consensus-506014f22faba150cd7197e7dd817e72a914dc84.tar.xz dexon-consensus-506014f22faba150cd7197e7dd817e72a914dc84.tar.zst dexon-consensus-506014f22faba150cd7197e7dd817e72a914dc84.zip |
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.
Diffstat (limited to 'core/consensus.go')
-rw-r--r-- | core/consensus.go | 17 |
1 files changed, 11 insertions, 6 deletions
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) |