aboutsummaryrefslogtreecommitdiffstats
path: root/core/state/statedb.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-08-21 00:22:50 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-08-21 00:22:50 +0800
commit36f7fe61c3697a3e99b95fe3f3c12fc16ed2d39f (patch)
tree66292b2e41ef06b6074051dafcd33fe57c0e7c2d /core/state/statedb.go
parent54088b0b8b76b9538cf10fa5a606a4170f571065 (diff)
downloaddexon-36f7fe61c3697a3e99b95fe3f3c12fc16ed2d39f.tar.gz
dexon-36f7fe61c3697a3e99b95fe3f3c12fc16ed2d39f.tar.zst
dexon-36f7fe61c3697a3e99b95fe3f3c12fc16ed2d39f.zip
core, tests: Double SUICIDE fix
Diffstat (limited to 'core/state/statedb.go')
-rw-r--r--core/state/statedb.go16
1 files changed, 9 insertions, 7 deletions
diff --git a/core/state/statedb.go b/core/state/statedb.go
index 45bdfc084..577f7162e 100644
--- a/core/state/statedb.go
+++ b/core/state/statedb.go
@@ -203,18 +203,20 @@ func (self *StateDB) UpdateStateObject(stateObject *StateObject) {
// Delete the given state object and delete it from the state trie
func (self *StateDB) DeleteStateObject(stateObject *StateObject) {
+ stateObject.deleted = true
+
addr := stateObject.Address()
self.trie.Delete(addr[:])
-
- //delete(self.stateObjects, addr.Str())
}
// Retrieve a state object given my the address. Nil if not found
-func (self *StateDB) GetStateObject(addr common.Address) *StateObject {
- //addr = common.Address(addr)
-
- stateObject := self.stateObjects[addr.Str()]
+func (self *StateDB) GetStateObject(addr common.Address) (stateObject *StateObject) {
+ stateObject = self.stateObjects[addr.Str()]
if stateObject != nil {
+ if stateObject.deleted {
+ stateObject = nil
+ }
+
return stateObject
}
@@ -236,7 +238,7 @@ func (self *StateDB) SetStateObject(object *StateObject) {
// Retrieve a state object or create a new state object if nil
func (self *StateDB) GetOrNewStateObject(addr common.Address) *StateObject {
stateObject := self.GetStateObject(addr)
- if stateObject == nil {
+ if stateObject == nil || stateObject.deleted {
stateObject = self.CreateAccount(addr)
}