aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/state_manager.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-07-02 23:48:10 +0800
committerobscuren <geffobscura@gmail.com>2014-07-02 23:48:10 +0800
commit35ae9e3aa89dc0e3be1cabed313996a7d49f6628 (patch)
tree58cc607c27fbb068ba4f7c8750ddf8b9c699810c /ethchain/state_manager.go
parent2f9bc2ab754ff85235ebb0b0b41b9b36ef30253a (diff)
downloaddexon-35ae9e3aa89dc0e3be1cabed313996a7d49f6628.tar
dexon-35ae9e3aa89dc0e3be1cabed313996a7d49f6628.tar.gz
dexon-35ae9e3aa89dc0e3be1cabed313996a7d49f6628.tar.bz2
dexon-35ae9e3aa89dc0e3be1cabed313996a7d49f6628.tar.lz
dexon-35ae9e3aa89dc0e3be1cabed313996a7d49f6628.tar.xz
dexon-35ae9e3aa89dc0e3be1cabed313996a7d49f6628.tar.zst
dexon-35ae9e3aa89dc0e3be1cabed313996a7d49f6628.zip
Paranoia check
Diffstat (limited to 'ethchain/state_manager.go')
-rw-r--r--ethchain/state_manager.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/ethchain/state_manager.go b/ethchain/state_manager.go
index dea82cae3..c42238e5c 100644
--- a/ethchain/state_manager.go
+++ b/ethchain/state_manager.go
@@ -6,6 +6,7 @@ import (
"fmt"
"github.com/ethereum/eth-go/ethcrypto"
"github.com/ethereum/eth-go/ethlog"
+ "github.com/ethereum/eth-go/ethtrie"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
"math/big"
@@ -204,7 +205,15 @@ func (sm *StateManager) Process(block *Block, dontReact bool) (err error) {
return err
}
+ if ethutil.Config.Paranoia {
+ valid, _ := ethtrie.ParanoiaCheck(state.trie)
+ if !valid {
+ err = fmt.Errorf("PARANOIA: World state trie comparison failed")
+ }
+ }
+
if !block.State().Cmp(state) {
+
err = fmt.Errorf("Invalid merkle root.\nrec: %x\nis: %x", block.State().trie.Root, state.trie.Root)
return
}