diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-10-15 15:58:41 +0800 |
---|---|---|
committer | Wei-Ning Huang <aitjcize@gmail.com> | 2018-10-15 15:58:41 +0800 |
commit | 39cf951c427179e432861473fa4e2f67810dff22 (patch) | |
tree | 11d787e8d0e771b822f67cdd3b63865e0b91a42b | |
parent | 3c1b208090f4455344fade2a218d332300d76458 (diff) | |
download | dexon-consensus-39cf951c427179e432861473fa4e2f67810dff22.tar dexon-consensus-39cf951c427179e432861473fa4e2f67810dff22.tar.gz dexon-consensus-39cf951c427179e432861473fa4e2f67810dff22.tar.bz2 dexon-consensus-39cf951c427179e432861473fa4e2f67810dff22.tar.lz dexon-consensus-39cf951c427179e432861473fa4e2f67810dff22.tar.xz dexon-consensus-39cf951c427179e432861473fa4e2f67810dff22.tar.zst dexon-consensus-39cf951c427179e432861473fa4e2f67810dff22.zip |
Remove duplicated dMoment in Consensus.Run (#206)
-rw-r--r-- | core/consensus.go | 6 | ||||
-rw-r--r-- | simulation/node.go | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/core/consensus.go b/core/consensus.go index 526ced5..368970c 100644 --- a/core/consensus.go +++ b/core/consensus.go @@ -215,6 +215,7 @@ type Consensus struct { tickerObj Ticker // Misc. + dMoment time.Time nodeSetCache *NodeSetCache round uint64 lock sync.RWMutex @@ -282,6 +283,7 @@ func NewConsensus( tickerObj: newTicker(gov, round, TickerBA), dkgReady: sync.NewCond(&sync.Mutex{}), cfgModule: cfgModule, + dMoment: dMoment, nodeSetCache: nodeSetCache, ctx: ctx, ctxCancel: ctxCancel, @@ -315,12 +317,12 @@ func NewConsensus( } // Run starts running DEXON Consensus. -func (con *Consensus) Run(dMoment time.Time) { +func (con *Consensus) Run() { go con.processMsg(con.network.ReceiveChan()) con.runDKGTSIG(con.round) round1 := uint64(1) con.lattice.AppendConfig(round1, con.gov.Configuration(round1)) - con.initialRound(dMoment) + con.initialRound(con.dMoment) ticks := make([]chan struct{}, 0, con.currentConfig.NumChains) for i := uint32(0); i < con.currentConfig.NumChains; i++ { tick := make(chan struct{}) diff --git a/simulation/node.go b/simulation/node.go index 23a3075..b908d73 100644 --- a/simulation/node.go +++ b/simulation/node.go @@ -101,7 +101,7 @@ func (n *node) run(serverEndpoint interface{}, dMoment time.Time) { } n.consensus = core.NewConsensus( dMoment, n.app, n.gov, n.db, n.netModule, n.prvKey) - go n.consensus.Run(dMoment) + go n.consensus.Run() // Blocks forever. MainLoop: |