fix isChainNearSync check in block validator

This commit is contained in:
vyzo 2020-09-08 10:21:40 +03:00
parent 4045ffea3c
commit 27fa9969f3

View File

@ -6,7 +6,6 @@ import (
"errors" "errors"
"fmt" "fmt"
"sync" "sync"
"time"
"golang.org/x/xerrors" "golang.org/x/xerrors"
@ -369,8 +368,8 @@ func (bv *BlockValidator) decodeAndCheckBlock(msg *pubsub.Message) (*types.Block
func (bv *BlockValidator) isChainNearSynced() bool { func (bv *BlockValidator) isChainNearSynced() bool {
ts := bv.chain.GetHeaviestTipSet() ts := bv.chain.GetHeaviestTipSet()
timestamp := ts.MinTimestamp() timestamp := ts.MinTimestamp()
now := build.Clock.Now().UnixNano() now := build.Clock.Now().Unix()
cutoff := uint64(now) - uint64(6*time.Hour) cutoff := uint64(now) - uint64(6*3600) // 6 hours
return timestamp > cutoff return timestamp > cutoff
} }