aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/state_manager.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-04-29 18:36:27 +0800
committerobscuren <geffobscura@gmail.com>2014-04-29 18:36:27 +0800
commit38d6b67b5cfbfb63620a244ea01b5b534917128f (patch)
tree42b4f55e4cd5c2f2a2c28f8551d8b92686abf567 /ethchain/state_manager.go
parent5516efdfa0494e028fc3649e4a38da81c56ed598 (diff)
downloadgo-tangerine-38d6b67b5cfbfb63620a244ea01b5b534917128f.tar
go-tangerine-38d6b67b5cfbfb63620a244ea01b5b534917128f.tar.gz
go-tangerine-38d6b67b5cfbfb63620a244ea01b5b534917128f.tar.bz2
go-tangerine-38d6b67b5cfbfb63620a244ea01b5b534917128f.tar.lz
go-tangerine-38d6b67b5cfbfb63620a244ea01b5b534917128f.tar.xz
go-tangerine-38d6b67b5cfbfb63620a244ea01b5b534917128f.tar.zst
go-tangerine-38d6b67b5cfbfb63620a244ea01b5b534917128f.zip
Fixed state problem
Diffstat (limited to 'ethchain/state_manager.go')
-rw-r--r--ethchain/state_manager.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/ethchain/state_manager.go b/ethchain/state_manager.go
index 628ab6a27..70d4155c3 100644
--- a/ethchain/state_manager.go
+++ b/ethchain/state_manager.go
@@ -158,18 +158,19 @@ func (sm *StateManager) ProcessBlock(block *Block, dontReact bool) error {
// Processing a blocks may never happen simultaneously
sm.mutex.Lock()
defer sm.mutex.Unlock()
- // Defer the Undo on the Trie. If the block processing happened
- // we don't want to undo but since undo only happens on dirty
- // nodes this won't happen because Commit would have been called
- // before that.
- defer sm.bc.CurrentBlock.Undo()
hash := block.Hash()
if sm.bc.HasBlock(hash) {
- fmt.Println("[SM] We already have this block, ignoring")
+ fmt.Println("[STATE] We already have this block, ignoring")
return nil
}
+ // Defer the Undo on the Trie. If the block processing happened
+ // we don't want to undo but since undo only happens on dirty
+ // nodes this won't happen because Commit would have been called
+ // before that.
+ defer sm.bc.CurrentBlock.Undo()
+
// Check if we have the parent hash, if it isn't known we discard it
// Reasons might be catching up or simply an invalid block
if !sm.bc.HasBlock(block.PrevHash) && sm.bc.CurrentBlock != nil {