aboutsummaryrefslogtreecommitdiffstats
path: root/core/consensus.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-12-16 14:44:15 +0800
committerGitHub <noreply@github.com>2018-12-16 14:44:15 +0800
commit99d72382687196fb15ea6ab0fcf297b9ab10ac46 (patch)
tree2fc321a32c9cb1d72933dbbdb0c259d6ae4f6aa3 /core/consensus.go
parent5f32dc8d27564e1f3a105fd1dacf02130b08621a (diff)
downloaddexon-consensus-99d72382687196fb15ea6ab0fcf297b9ab10ac46.tar
dexon-consensus-99d72382687196fb15ea6ab0fcf297b9ab10ac46.tar.gz
dexon-consensus-99d72382687196fb15ea6ab0fcf297b9ab10ac46.tar.bz2
dexon-consensus-99d72382687196fb15ea6ab0fcf297b9ab10ac46.tar.lz
dexon-consensus-99d72382687196fb15ea6ab0fcf297b9ab10ac46.tar.xz
dexon-consensus-99d72382687196fb15ea6ab0fcf297b9ab10ac46.tar.zst
dexon-consensus-99d72382687196fb15ea6ab0fcf297b9ab10ac46.zip
core: cache dkg's private key in db (#371)
Diffstat (limited to 'core/consensus.go')
-rw-r--r--core/consensus.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/consensus.go b/core/consensus.go
index a0336ed..5beaf54 100644
--- a/core/consensus.go
+++ b/core/consensus.go
@@ -424,6 +424,7 @@ func NewConsensus(
recv,
gov,
nodeSetCache,
+ db,
logger)
recv.cfgModule = cfgModule
// Construct Consensus instance.
@@ -490,6 +491,7 @@ func NewConsensusFromSyncer(
recv,
gov,
nodeSetCache,
+ db,
logger)
recv.cfgModule = cfgModule
// Setup Consensus instance.
@@ -576,7 +578,7 @@ func (con *Consensus) prepare(initBlock *types.Block) error {
}
if _, exist := dkgSet[con.ID]; exist {
con.logger.Info("Selected as DKG set", "round", initRound)
- con.cfgModule.registerDKG(initRound, int(initConfig.DKGSetSize)/3+1)
+ con.cfgModule.registerDKG(initRound, getDKGThreshold(initConfig))
con.event.RegisterTime(con.dMoment.Add(initConfig.RoundInterval/4),
func(time.Time) {
con.runDKG(initRound, initConfig)
@@ -742,8 +744,7 @@ func (con *Consensus) initialRound(
return
}
con.logger.Info("Selected as DKG set", "round", nextRound)
- con.cfgModule.registerDKG(
- nextRound, int(config.DKGSetSize/3)+1)
+ con.cfgModule.registerDKG(nextRound, getDKGThreshold(config))
con.event.RegisterTime(
startTime.Add(config.RoundInterval*2/3),
func(time.Time) {