Merge pull request #3650 from filecoin-project/fix/chain-nearsync-check

fix isChainNearSync check in block validator
This commit is contained in:
Łukasz Magiera 2020-09-08 14:52:36 +02:00 committed by GitHub
commit a4fc5c6975
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -369,9 +369,8 @@ func (bv *BlockValidator) decodeAndCheckBlock(msg *pubsub.Message) (*types.Block
func (bv *BlockValidator) isChainNearSynced() bool {
ts := bv.chain.GetHeaviestTipSet()
timestamp := ts.MinTimestamp()
now := build.Clock.Now().UnixNano()
cutoff := uint64(now) - uint64(6*time.Hour)
return timestamp > cutoff
timestampTime := time.Unix(int64(timestamp), 0)
return build.Clock.Since(timestampTime) < 6*time.Hour
}
func (bv *BlockValidator) validateMsgMeta(ctx context.Context, msg *types.BlockMsg) error {