diff options
Diffstat (limited to 'ethchain/state.go')
-rw-r--r-- | ethchain/state.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ethchain/state.go b/ethchain/state.go index 5d023df7b..6abf21c39 100644 --- a/ethchain/state.go +++ b/ethchain/state.go @@ -67,11 +67,19 @@ func (self *State) Empty() { func (self *State) Update() { for _, stateObject := range self.stateObjects { if stateObject.remove { - self.trie.Delete(string(stateObject.Address())) + self.DeleteStateObject(stateObject) } else { + println(ethutil.Bytes2Hex(stateObject.Address())) self.UpdateStateObject(stateObject) } } + + // FIXME trie delete is broken + valid, t2 := ethtrie.ParanoiaCheck(self.trie) + if !valid { + self.trie = t2 + } + } // Purges the current trie. @@ -100,6 +108,12 @@ func (self *State) UpdateStateObject(stateObject *StateObject) { self.manifest.AddObjectChange(stateObject) } +func (self *State) DeleteStateObject(stateObject *StateObject) { + self.trie.Delete(string(stateObject.Address())) + + delete(self.stateObjects, string(stateObject.Address())) +} + func (self *State) GetStateObject(addr []byte) *StateObject { stateObject := self.stateObjects[string(addr)] if stateObject != nil { |