diff options
author | zelig <viktor.tron@gmail.com> | 2014-07-21 20:31:26 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2014-07-21 20:31:26 +0800 |
commit | 13cc220c0d7f9b31478b49a1109d44aeab66b372 (patch) | |
tree | 7f103997d746e2b5da20eed3ce20cb2521b12852 /ethchain/state_manager.go | |
parent | 1e4af85a380977233a3bceaf5e2a020a281aa19a (diff) | |
parent | 8f91d47bf3c26b850f0f40f79856141087e6ef82 (diff) | |
download | dexon-13cc220c0d7f9b31478b49a1109d44aeab66b372.tar.gz dexon-13cc220c0d7f9b31478b49a1109d44aeab66b372.tar.zst dexon-13cc220c0d7f9b31478b49a1109d44aeab66b372.zip |
Merge branch 'develop' of github.com:ethereum/eth-go into feature/ethutil-refactor
Diffstat (limited to 'ethchain/state_manager.go')
-rw-r--r-- | ethchain/state_manager.go | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/ethchain/state_manager.go b/ethchain/state_manager.go index 6bd3edd0d..f65bf683a 100644 --- a/ethchain/state_manager.go +++ b/ethchain/state_manager.go @@ -201,11 +201,16 @@ func (sm *StateManager) Process(block *Block, dontReact bool) (err error) { fmt.Printf("## %x %x ##\n", block.Hash(), block.Number) } - _, err = sm.ApplyDiff(state, parent, block) + receipts, err := sm.ApplyDiff(state, parent, block) if err != nil { return err } + txSha := CreateTxSha(receipts) + if bytes.Compare(txSha, block.TxSha) != 0 { + return fmt.Errorf("Error validating tx sha. Received %x, got %x", block.TxSha, txSha) + } + // Block validation if err = sm.ValidateBlock(block); err != nil { statelogger.Errorln("Error validating block:", err) @@ -219,17 +224,7 @@ 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 corruption") - } - } - */ - if !block.State().Cmp(state) { - err = fmt.Errorf("Invalid merkle root.\nrec: %x\nis: %x", block.State().trie.Root, state.trie.Root) return } @@ -312,9 +307,9 @@ func (sm *StateManager) ValidateBlock(block *Block) error { } } - diff := block.Time - sm.bc.CurrentBlock.Time + diff := block.Time - previousBlock.Time if diff < 0 { - return ValidationError("Block timestamp less then prev block %v", diff) + return ValidationError("Block timestamp less then prev block %v (%v - %v)", diff, block.Time, sm.bc.CurrentBlock.Time) } /* XXX |