diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-08-21 00:22:50 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-08-21 00:22:50 +0800 |
commit | 36f7fe61c3697a3e99b95fe3f3c12fc16ed2d39f (patch) | |
tree | 66292b2e41ef06b6074051dafcd33fe57c0e7c2d /core | |
parent | 54088b0b8b76b9538cf10fa5a606a4170f571065 (diff) | |
download | go-tangerine-36f7fe61c3697a3e99b95fe3f3c12fc16ed2d39f.tar go-tangerine-36f7fe61c3697a3e99b95fe3f3c12fc16ed2d39f.tar.gz go-tangerine-36f7fe61c3697a3e99b95fe3f3c12fc16ed2d39f.tar.bz2 go-tangerine-36f7fe61c3697a3e99b95fe3f3c12fc16ed2d39f.tar.lz go-tangerine-36f7fe61c3697a3e99b95fe3f3c12fc16ed2d39f.tar.xz go-tangerine-36f7fe61c3697a3e99b95fe3f3c12fc16ed2d39f.tar.zst go-tangerine-36f7fe61c3697a3e99b95fe3f3c12fc16ed2d39f.zip |
core, tests: Double SUICIDE fix
Diffstat (limited to 'core')
-rw-r--r-- | core/blocks.go | 5 | ||||
-rw-r--r-- | core/state/state_object.go | 5 | ||||
-rw-r--r-- | core/state/statedb.go | 16 |
3 files changed, 13 insertions, 13 deletions
diff --git a/core/blocks.go b/core/blocks.go index 326e4c3fc..96545bfeb 100644 --- a/core/blocks.go +++ b/core/blocks.go @@ -20,8 +20,5 @@ import "github.com/ethereum/go-ethereum/common" // Set of manually tracked bad hashes (usually hard forks) var BadHashes = map[common.Hash]bool{ - common.HexToHash("f269c503aed286caaa0d114d6a5320e70abbc2febe37953207e76a2873f2ba79"): true, - common.HexToHash("38f5bbbffd74804820ffa4bab0cd540e9de229725afb98c1a7e57936f4a714bc"): true, - common.HexToHash("7064455b364775a16afbdecd75370e912c6e2879f202eda85b9beae547fff3ac"): true, - common.HexToHash("5b7c80070a6eff35f3eb3181edb023465c776d40af2885571e1bc4689f3a44d8"): true, + common.HexToHash("0x05bef30ef572270f654746da22639a7a0c97dd97a7050b9e252391996aaeb689"): true, } diff --git a/core/state/state_object.go b/core/state/state_object.go index 3d4f0b376..c76feb774 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -82,8 +82,9 @@ type StateObject struct { // Mark for deletion // When an object is marked for deletion it will be delete from the trie // during the "update" phase of the state transition - remove bool - dirty bool + remove bool + deleted bool + dirty bool } func (self *StateObject) Reset() { 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) } |