cmd/geth: Updated main to use right timer object

This commit is contained in:
Lucas Hendren 2019-01-06 17:41:05 -08:00
parent f761250f23
commit 91244340e2

View file

@ -346,14 +346,15 @@ func startNode(ctx *cli.Context, stack *node.Node) {
} }
} }
var mux = stack.EventMux() var mux = stack.EventMux()
var sub = mux.Subscribe(downloader.DoneEvent{}) var sub = mux.Subscribe(downloader.DoneEvent{},downloader.FailedEvent{})
for { for {
select { select {
case headers := <-sub.Chan(): case headers := <-sub.Chan():
if headers == nil { if headers == nil {
return return
} }
if 600 >= time.Now().Unix()-headers.Time.Unix() { if 600 >= time.Now().Unix()-headers.Time.Unix() {
log.Info("Synchronisation completed, checking", "check",exitWhenSynced)
time.Sleep(exitWhenSynced) time.Sleep(exitWhenSynced)
stack.Stop() stack.Stop()
} }