Removal of manual updating of state objects

* You'll only ever need to update the state by calling Update. Update
  will take care of the updating of it's child state objects.
This commit is contained in:
obscuren
2014-06-17 11:06:06 +02:00
parent 6656f99c54
commit 53e30f750d
6 changed files with 65 additions and 39 deletions

View File

@ -181,7 +181,6 @@ func (sm *StateManager) ProcessBlock(state *State, parent, block *Block, dontRea
coinbase.SetGasPool(block.CalcGasLimit(parent))
// Process the transactions on to current block
//sm.ApplyTransactions(block.Coinbase, state, parent, block.Transactions())
sm.ProcessTransactions(coinbase, state, block, parent, block.Transactions())
// Block validation
@ -197,6 +196,9 @@ func (sm *StateManager) ProcessBlock(state *State, parent, block *Block, dontRea
return err
}
// Update the state with pending changes
state.Update()
if !block.State().Cmp(state) {
return fmt.Errorf("Invalid merkle root.\nrec: %x\nis: %x", block.State().trie.Root, state.trie.Root)
}