aboutsummaryrefslogtreecommitdiffstats
path: root/core/test/state.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-03-04 18:30:03 +0800
committerGitHub <noreply@github.com>2019-03-04 18:30:03 +0800
commitd4b4c8a05e94f66c85e7b4238ae5947b26f13c40 (patch)
treec2a10260820ac3a152506000aa03c41cd244d84f /core/test/state.go
parent603f8d6d999c1bb5b16c2f5dfc88f8bc9da7fc33 (diff)
downloaddexon-consensus-d4b4c8a05e94f66c85e7b4238ae5947b26f13c40.tar
dexon-consensus-d4b4c8a05e94f66c85e7b4238ae5947b26f13c40.tar.gz
dexon-consensus-d4b4c8a05e94f66c85e7b4238ae5947b26f13c40.tar.bz2
dexon-consensus-d4b4c8a05e94f66c85e7b4238ae5947b26f13c40.tar.lz
dexon-consensus-d4b4c8a05e94f66c85e7b4238ae5947b26f13c40.tar.xz
dexon-consensus-d4b4c8a05e94f66c85e7b4238ae5947b26f13c40.tar.zst
dexon-consensus-d4b4c8a05e94f66c85e7b4238ae5947b26f13c40.zip
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
Diffstat (limited to 'core/test/state.go')
-rw-r--r--core/test/state.go8
1 files changed, 7 insertions, 1 deletions
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)),