OSDN Git Service
(root)
/
bytom
/
vapor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b9c09be
)
update
author
Chengcheng Zhang
<943420582@qq.com>
Wed, 5 Jun 2019 07:41:09 +0000
(15:41 +0800)
committer
Chengcheng Zhang
<943420582@qq.com>
Wed, 5 Jun 2019 07:41:09 +0000
(15:41 +0800)
protocol/validation/block.go
patch
|
blob
|
history
diff --git
a/protocol/validation/block.go
b/protocol/validation/block.go
index
c073a01
..
ef63947
100644
(file)
--- 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
}