aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2019-05-07 11:03:21 +0800
committerMission Liao <mission.liao@dexon.org>2019-05-07 15:09:40 +0800
commit15946542d1d573e5ffb8635c3b9ea04830fc1442 (patch)
tree17d8cefce712446b4cca95f4e897f8b2709aeb3a
parent154cd2206c067e9e05a64748537e6ee54e5297b6 (diff)
downloaddexon-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.go2
-rw-r--r--dex/consensus/core/consensus.go4
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 {