From d4b4c8a05e94f66c85e7b4238ae5947b26f13c40 Mon Sep 17 00:00:00 2001 From: Jimmy Hu Date: Mon, 4 Mar 2019 18:30:03 +0800 Subject: core: first few round will not have DKG (#455) * core: Add DKGDelayRound constant * core: use constant value * core, utils: set DKGDelayRound for utils. * test: add dkgDelayRound to state * core: do not run dkg and crs for round < DKGDelayRound * fix test --- core/test/state.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'core/test/state.go') diff --git a/core/test/state.go b/core/test/state.go index f1cf365..fbf4505 100644 --- a/core/test/state.go +++ b/core/test/state.go @@ -117,6 +117,7 @@ type State struct { // - node set // - crs func NewState( + dkgDelayRound uint64, nodePubKeys []crypto.PublicKey, lambda time.Duration, logger common.Logger, @@ -126,6 +127,11 @@ func NewState( nodes[types.NewNodeID(key)] = key } genesisCRS := crypto.Keccak256Hash([]byte("__ DEXON")) + crs := make([]common.Hash, dkgDelayRound+1) + for i := range crs { + crs[i] = genesisCRS + genesisCRS = crypto.Keccak256Hash(genesisCRS[:]) + } return &State{ local: local, logger: logger, @@ -133,7 +139,7 @@ func NewState( lambdaDKG: lambda * 10, roundInterval: 1000, minBlockInterval: 4 * lambda, - crs: []common.Hash{genesisCRS}, + crs: crs, nodes: nodes, notarySetSize: uint32(len(nodes)), dkgSetSize: uint32(len(nodes)), -- cgit v1.2.3