aboutsummaryrefslogtreecommitdiffstats
path: root/core/block_processor.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-02-18 20:14:21 +0800
committerobscuren <geffobscura@gmail.com>2015-02-18 20:14:21 +0800
commit655e94259765b02454df93205a30a271103de5a0 (patch)
tree818cd1e9156dda16d78257b2ad656edeb0058759 /core/block_processor.go
parentbe90ad89a89502ef3d2c0375d267b667618f5e7c (diff)
downloadgo-tangerine-655e94259765b02454df93205a30a271103de5a0.tar
go-tangerine-655e94259765b02454df93205a30a271103de5a0.tar.gz
go-tangerine-655e94259765b02454df93205a30a271103de5a0.tar.bz2
go-tangerine-655e94259765b02454df93205a30a271103de5a0.tar.lz
go-tangerine-655e94259765b02454df93205a30a271103de5a0.tar.xz
go-tangerine-655e94259765b02454df93205a30a271103de5a0.tar.zst
go-tangerine-655e94259765b02454df93205a30a271103de5a0.zip
Added GetBlock GetUncle with OOB guard
Diffstat (limited to 'core/block_processor.go')
-rw-r--r--core/block_processor.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/block_processor.go b/core/block_processor.go
index 893c586dd..b4449100f 100644
--- a/core/block_processor.go
+++ b/core/block_processor.go
@@ -250,7 +250,11 @@ func (sm *BlockProcessor) ValidateBlock(block, parent *types.Block) error {
}
if block.Time() > time.Now().Unix() {
- return fmt.Errorf("block time is in the future")
+ return BlockFutureErr
+ }
+
+ if new(big.Int).Sub(block.Number(), parent.Number()).Cmp(big.NewInt(1)) != 0 {
+ return BlockNumberErr
}
// Verify the nonce of the block. Return an error if it's not valid