Merge pull request #3650 from filecoin-project/fix/chain-nearsync-check
fix isChainNearSync check in block validator
This commit is contained in:
commit
a4fc5c6975
@ -369,9 +369,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()
|
timestampTime := time.Unix(int64(timestamp), 0)
|
||||||
cutoff := uint64(now) - uint64(6*time.Hour)
|
return build.Clock.Since(timestampTime) < 6*time.Hour
|
||||||
return timestamp > cutoff
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bv *BlockValidator) validateMsgMeta(ctx context.Context, msg *types.BlockMsg) error {
|
func (bv *BlockValidator) validateMsgMeta(ctx context.Context, msg *types.BlockMsg) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user