miner: Handle stop signal when sleeping

This commit is contained in:
Łukasz Magiera 2020-01-23 11:10:42 +01:00
parent e67ee227a3
commit 11a6bff416

View File

@ -227,7 +227,16 @@ eventLoop:
}
} else {
nextRound := time.Unix(int64(base.ts.MinTimestamp()+uint64(build.BlockDelay*base.nullRounds)), 0)
time.Sleep(time.Until(nextRound))
select {
case <-time.After(time.Until(nextRound)):
case <-m.stop:
stopping := m.stopping
m.stop = nil
m.stopping = nil
close(stopping)
return
}
}
}
}