diff options
author | Mission Liao <mission.liao@dexon.org> | 2019-05-07 11:03:21 +0800 |
---|---|---|
committer | Mission Liao <mission.liao@dexon.org> | 2019-05-07 15:09:40 +0800 |
commit | 15946542d1d573e5ffb8635c3b9ea04830fc1442 (patch) | |
tree | 17d8cefce712446b4cca95f4e897f8b2709aeb3a | |
parent | 154cd2206c067e9e05a64748537e6ee54e5297b6 (diff) | |
download | dexon-15946542d1d573e5ffb8635c3b9ea04830fc1442.tar.gz dexon-15946542d1d573e5ffb8635c3b9ea04830fc1442.tar.zst dexon-15946542d1d573e5ffb8635c3b9ea04830fc1442.zip |
Fix lint error: should use time.Until
-rw-r--r-- | dex/consensus/core/agreement-mgr.go | 2 | ||||
-rw-r--r-- | dex/consensus/core/consensus.go | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/dex/consensus/core/agreement-mgr.go b/dex/consensus/core/agreement-mgr.go index b951dd3f8..21651c2d3 100644 --- a/dex/consensus/core/agreement-mgr.go +++ b/dex/consensus/core/agreement-mgr.go @@ -600,7 +600,7 @@ func (mgr *agreementMgr) baRoutineForOneRound( if err != nil { return } - time.Sleep(nextTime.Sub(time.Now())) + time.Sleep(time.Until(nextTime)) setting.ticker.Restart() agr.restart(setting.dkgSet, setting.threshold, nextPos, leader, setting.crs) return diff --git a/dex/consensus/core/consensus.go b/dex/consensus/core/consensus.go index 7aac54e32..1fcc033eb 100644 --- a/dex/consensus/core/consensus.go +++ b/dex/consensus/core/consensus.go @@ -1043,7 +1043,7 @@ func (con *Consensus) Run() { } con.generateBlockRandomness(blocksWithoutRandomness) // Sleep until dMoment come. - time.Sleep(con.dMoment.Sub(time.Now().UTC())) + time.Sleep(time.Until(con.dMoment)) // Take some time to bootstrap. time.Sleep(3 * time.Second) con.waitGroup.Add(1) @@ -1446,7 +1446,7 @@ func (con *Consensus) deliveryGuard() { defer con.waitGroup.Done() select { case <-con.ctx.Done(): - case <-time.After(con.dMoment.Sub(time.Now())): + case <-time.After(time.Until(con.dMoment)): } // Node takes time to start. select { |