aboutsummaryrefslogtreecommitdiffstats
path: root/core/blockchain.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/blockchain.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/blockchain.go')
-rw-r--r--core/blockchain.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/blockchain.go b/core/blockchain.go
index bc9616c..03c8561 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -188,7 +188,7 @@ func (bc *blockChain) extractBlocks() (ret []*types.Block) {
defer bc.lock.Unlock()
for len(bc.confirmedBlocks) > 0 {
c := bc.confirmedBlocks[0]
- if c.Position.Round > 0 && len(c.Finalization.Randomness) == 0 {
+ if c.Position.Round >= DKGDelayRound && len(c.Finalization.Randomness) == 0 {
break
}
c, bc.confirmedBlocks = bc.confirmedBlocks[0], bc.confirmedBlocks[1:]
@@ -502,7 +502,7 @@ func (bc *blockChain) purgeConfig() {
func (bc *blockChain) verifyRandomness(
blockHash common.Hash, round uint64, randomness []byte) (bool, error) {
- if round == 0 {
+ if round < DKGDelayRound {
return len(randomness) == 0, nil
}
v, ok, err := bc.vGetter.UpdateAndGet(round)