aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-10-16 11:34:05 +0800
committerGitHub <noreply@github.com>2018-10-16 11:34:05 +0800
commit15be90c811e6fc6324033b482320da0e5fa694e5 (patch)
tree39fe00fffe1fe587b53a864d40439f79f6895524 /core
parent4ec958aad80f02086f87bf300ce7ba676618d5fc (diff)
downloadtangerine-consensus-15be90c811e6fc6324033b482320da0e5fa694e5.tar
tangerine-consensus-15be90c811e6fc6324033b482320da0e5fa694e5.tar.gz
tangerine-consensus-15be90c811e6fc6324033b482320da0e5fa694e5.tar.bz2
tangerine-consensus-15be90c811e6fc6324033b482320da0e5fa694e5.tar.lz
tangerine-consensus-15be90c811e6fc6324033b482320da0e5fa694e5.tar.xz
tangerine-consensus-15be90c811e6fc6324033b482320da0e5fa694e5.tar.zst
tangerine-consensus-15be90c811e6fc6324033b482320da0e5fa694e5.zip
core: Change First round dkg timing (#209)
Diffstat (limited to 'core')
-rw-r--r--core/consensus.go9
-rw-r--r--core/consensus_test.go1
2 files changed, 6 insertions, 4 deletions
diff --git a/core/consensus.go b/core/consensus.go
index 00d5bc7..e8d8b15 100644
--- a/core/consensus.go
+++ b/core/consensus.go
@@ -267,9 +267,6 @@ func NewConsensus(
network: network,
},
gov)
- // Register DKG for the initial round. This is a temporary function call for
- // simulation.
- cfgModule.registerDKG(round, int(config.DKGSetSize)/3+1)
// Construct Consensus instance.
con := &Consensus{
ID: ID,
@@ -319,7 +316,11 @@ func NewConsensus(
// Run starts running DEXON Consensus.
func (con *Consensus) Run() {
go con.processMsg(con.network.ReceiveChan())
- con.runDKGTSIG(con.round)
+ con.cfgModule.registerDKG(con.round, int(con.currentConfig.DKGSetSize)/3+1)
+ con.event.RegisterTime(con.dMoment.Add(con.currentConfig.RoundInterval/4),
+ func(time.Time) {
+ con.runDKGTSIG(con.round)
+ })
round1 := uint64(1)
con.lattice.AppendConfig(round1, con.gov.Configuration(round1))
con.initialRound(con.dMoment)
diff --git a/core/consensus_test.go b/core/consensus_test.go
index 73c13f2..e089fdf 100644
--- a/core/consensus_test.go
+++ b/core/consensus_test.go
@@ -463,6 +463,7 @@ func (s *ConsensusTestSuite) TestDKGCRS() {
nID := types.NewNodeID(key.PublicKey())
cons[nID] = con
go con.processMsg(con.network.ReceiveChan())
+ con.cfgModule.registerDKG(uint64(0), n/3+1)
}
for _, con := range cons {
con.runDKGTSIG(uint64(0))