aboutsummaryrefslogtreecommitdiffstats
path: root/core/block_processor.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-10-13 17:04:25 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-10-21 21:49:55 +0800
commit5b0ee8ec304663898073b7a4c659e1def23716df (patch)
tree8f2f49a8d26dc1c29e1d360fb787ab420d90a2ae /core/block_processor.go
parentaa0538db0b5de2bb2c609d629b65d083649f9171 (diff)
downloadgo-tangerine-5b0ee8ec304663898073b7a4c659e1def23716df.tar
go-tangerine-5b0ee8ec304663898073b7a4c659e1def23716df.tar.gz
go-tangerine-5b0ee8ec304663898073b7a4c659e1def23716df.tar.bz2
go-tangerine-5b0ee8ec304663898073b7a4c659e1def23716df.tar.lz
go-tangerine-5b0ee8ec304663898073b7a4c659e1def23716df.tar.xz
go-tangerine-5b0ee8ec304663898073b7a4c659e1def23716df.tar.zst
go-tangerine-5b0ee8ec304663898073b7a4c659e1def23716df.zip
core, eth, trie: fix data races and merge/review issues
Diffstat (limited to 'core/block_processor.go')
-rw-r--r--core/block_processor.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/core/block_processor.go b/core/block_processor.go
index 60f0258c4..5172636dd 100644
--- a/core/block_processor.go
+++ b/core/block_processor.go
@@ -195,14 +195,16 @@ func (sm *BlockProcessor) Process(block *types.Block) (logs vm.Logs, receipts ty
defer sm.mutex.Unlock()
if sm.bc.HasBlock(block.Hash()) {
- return nil, nil, &KnownBlockError{block.Number(), block.Hash()}
+ if _, err := state.New(block.Root(), sm.chainDb); err == nil {
+ return nil, nil, &KnownBlockError{block.Number(), block.Hash()}
+ }
}
-
- if !sm.bc.HasBlock(block.ParentHash()) {
- return nil, nil, ParentError(block.ParentHash())
+ if parent := sm.bc.GetBlock(block.ParentHash()); parent != nil {
+ if _, err := state.New(parent.Root(), sm.chainDb); err == nil {
+ return sm.processWithParent(block, parent)
+ }
}
- parent := sm.bc.GetBlock(block.ParentHash())
- return sm.processWithParent(block, parent)
+ return nil, nil, ParentError(block.ParentHash())
}
func (sm *BlockProcessor) processWithParent(block, parent *types.Block) (logs vm.Logs, receipts types.Receipts, err error) {