diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-10-01 11:55:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-01 11:55:53 +0800 |
commit | e223a62e70a0a874fcf85e4b9c010741414f100e (patch) | |
tree | 79896ff732feb0331f9b49aaee1e21d5ba7e9542 /simulation/governance.go | |
parent | f2c13bd773c9684356a8a992d783916d49e70b59 (diff) | |
download | tangerine-consensus-e223a62e70a0a874fcf85e4b9c010741414f100e.tar tangerine-consensus-e223a62e70a0a874fcf85e4b9c010741414f100e.tar.gz tangerine-consensus-e223a62e70a0a874fcf85e4b9c010741414f100e.tar.bz2 tangerine-consensus-e223a62e70a0a874fcf85e4b9c010741414f100e.tar.lz tangerine-consensus-e223a62e70a0a874fcf85e4b9c010741414f100e.tar.xz tangerine-consensus-e223a62e70a0a874fcf85e4b9c010741414f100e.tar.zst tangerine-consensus-e223a62e70a0a874fcf85e4b9c010741414f100e.zip |
core: use notarySet for BA module. (#153)
Diffstat (limited to 'simulation/governance.go')
-rw-r--r-- | simulation/governance.go | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/simulation/governance.go b/simulation/governance.go index 3351202..9e7cbaf 100644 --- a/simulation/governance.go +++ b/simulation/governance.go @@ -37,7 +37,7 @@ type simGovernance struct { k int phiRatio float32 chainNum uint32 - crs []byte + crs map[uint64][]byte tsig map[uint64]crypto.Signature dkgComplaint map[uint64][]*types.DKGComplaint dkgMasterPublicKey map[uint64][]*types.DKGMasterPublicKey @@ -52,19 +52,23 @@ func newSimGovernance( id types.NodeID, numNodes int, consensusConfig config.Consensus) *simGovernance { return &simGovernance{ - id: id, - nodeSet: make(map[types.NodeID]crypto.PublicKey), - expectedNumNodes: numNodes, - k: consensusConfig.K, - phiRatio: consensusConfig.PhiRatio, - chainNum: consensusConfig.ChainNum, - crs: []byte(consensusConfig.GenesisCRS), + id: id, + nodeSet: make(map[types.NodeID]crypto.PublicKey), + expectedNumNodes: numNodes, + k: consensusConfig.K, + phiRatio: consensusConfig.PhiRatio, + chainNum: consensusConfig.ChainNum, + crs: map[uint64][]byte{ + 0: []byte(consensusConfig.GenesisCRS)}, tsig: make(map[uint64]crypto.Signature), dkgComplaint: make(map[uint64][]*types.DKGComplaint), dkgMasterPublicKey: make(map[uint64][]*types.DKGMasterPublicKey), - lambdaBA: time.Duration(consensusConfig.LambdaBA) * time.Millisecond, - lambdaDKG: time.Duration(consensusConfig.LambdaDKG) * time.Millisecond, - roundInterval: time.Duration(consensusConfig.RoundInterval) * time.Millisecond, + lambdaBA: time.Duration(consensusConfig.LambdaBA) * + time.Millisecond, + lambdaDKG: time.Duration(consensusConfig.LambdaDKG) * + time.Millisecond, + roundInterval: time.Duration(consensusConfig.RoundInterval) * + time.Millisecond, } } @@ -102,7 +106,12 @@ func (g *simGovernance) GetConfiguration(round uint64) *types.Config { // GetCRS returns the CRS for a given round. func (g *simGovernance) GetCRS(round uint64) []byte { - return g.crs + return g.crs[round] +} + +// ProposeCRS proposes a CRS of round. +func (g *simGovernance) ProposeCRS(round uint64, crs []byte) { + g.crs[round] = crs } // addNode add a new node into the simulated governance contract. |