diff options
author | Wei-Ning Huang <w@dexon.org> | 2019-01-02 18:58:59 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:20 +0800 |
commit | 9a4803642b4211e6f4f5414cda6ac2134709008a (patch) | |
tree | 91fc1ede7de5c3633000b041c6dea33a7f30e60f /vendor/github.com/dexon-foundation/dexon-consensus/core | |
parent | 1917fe9c42fb5cbdb1970827934672fa4bb805a7 (diff) | |
download | go-tangerine-9a4803642b4211e6f4f5414cda6ac2134709008a.tar.gz go-tangerine-9a4803642b4211e6f4f5414cda6ac2134709008a.tar.zst go-tangerine-9a4803642b4211e6f4f5414cda6ac2134709008a.zip |
vendor: sync to latest core (#121)
Diffstat (limited to 'vendor/github.com/dexon-foundation/dexon-consensus/core')
-rw-r--r-- | vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go index 3353d1d60..faadbe9bd 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go +++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go @@ -563,14 +563,17 @@ func (con *Consensus) prepare(initBlock *types.Block) error { if err != nil { return err } - // TODO(jimmy): registerDKG should be called after dmoment. if _, exist := dkgSet[con.ID]; exist { con.logger.Info("Selected as DKG set", "round", initRound) - con.cfgModule.registerDKG(initRound, getDKGThreshold(initConfig)) - con.event.RegisterTime(con.dMoment.Add(initConfig.RoundInterval/4), - func(time.Time) { - con.runDKG(initRound, initConfig) - }) + go func() { + // Sleep until dMoment come. + time.Sleep(con.dMoment.Sub(time.Now().UTC())) + con.cfgModule.registerDKG(initRound, getDKGThreshold(initConfig)) + con.event.RegisterTime(con.dMoment.Add(initConfig.RoundInterval/4), + func(time.Time) { + con.runDKG(initRound, initConfig) + }) + }() } con.initialRound(con.dMoment, initRound, initConfig) return nil |