From: Chengcheng Zhang <943420582@qq.com> Date: Wed, 5 Jun 2019 07:41:09 +0000 (+0800) Subject: update X-Git-Url: http://git.osdn.net/view?p=bytom%2Fvapor.git;a=commitdiff_plain;h=837305dba295eda4dd4d6de7b049bc5f80e531e0 update --- diff --git a/protocol/validation/block.go b/protocol/validation/block.go index c073a01e..ef639473 100644 --- a/protocol/validation/block.go +++ b/protocol/validation/block.go @@ -27,6 +27,12 @@ var ( func checkBlockTime(b *bc.Block, parent *state.BlockNode) error { now := uint64(time.Now().UnixNano() / 1e6) + if parent.Timestamp >= b.Timestamp { + return errBadTimestamp + } + if b.Timestamp%consensus.BlockTimeInterval != 0 { + return errBadTimestamp + } if b.Timestamp > (now + consensus.MaxTimeOffsetMs) { return errBadTimestamp }