cmd/geth: added in correct time field with type assertion

This commit is contained in:
Lucas Hendren 2019-01-10 20:13:48 -08:00
parent b939822a4c
commit eeaef14de9

View file

@ -32,6 +32,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/console" "github.com/ethereum/go-ethereum/console"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth/downloader" "github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/ethclient"
@ -353,7 +354,8 @@ func startNode(ctx *cli.Context, stack *node.Node) {
if headers == nil { if headers == nil {
return return
} }
if 600 >= time.Now().Unix()-headers.Time.Unix() { latest :=headers.Data.(*types.Header).Time
if 600 >= time.Now().Unix()-latest.Int64() {
log.Info("Synchronisation completed, checking", "check", exitWhenSynced) log.Info("Synchronisation completed, checking", "check", exitWhenSynced)
time.Sleep(exitWhenSynced) time.Sleep(exitWhenSynced)
stack.Stop() stack.Stop()