aboutsummaryrefslogtreecommitdiffstats
path: root/state
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-09 18:28:35 +0800
committerobscuren <geffobscura@gmail.com>2015-03-09 18:28:35 +0800
commit19efebe91e354ad86c171e01c47f9c2f3ef5cf9f (patch)
treea35203550c3e6bec84ee47cebb94e5e93eecd3d8 /state
parent93cdffca3ad23eedae6f0591e1357c2429b31811 (diff)
downloadgo-tangerine-19efebe91e354ad86c171e01c47f9c2f3ef5cf9f.tar.gz
go-tangerine-19efebe91e354ad86c171e01c47f9c2f3ef5cf9f.tar.zst
go-tangerine-19efebe91e354ad86c171e01c47f9c2f3ef5cf9f.zip
Updated tests and fixed suicide
Diffstat (limited to 'state')
-rw-r--r--state/state_object.go2
-rw-r--r--state/statedb.go9
2 files changed, 10 insertions, 1 deletions
diff --git a/state/state_object.go b/state/state_object.go
index 51ec95efa..ccbfea391 100644
--- a/state/state_object.go
+++ b/state/state_object.go
@@ -111,7 +111,7 @@ func NewStateObjectFromBytes(address, data []byte, db ethutil.Database) *StateOb
func (self *StateObject) MarkForDeletion() {
self.remove = true
self.dirty = true
- statelogger.DebugDetailf("%x: #%d %v (deletion)\n", self.Address(), self.nonce, self.balance)
+ statelogger.Debugf("%x: #%d %v X\n", self.Address(), self.nonce, self.balance)
}
func (c *StateObject) getAddr(addr []byte) *ethutil.Value {
diff --git a/state/statedb.go b/state/statedb.go
index 1231b4c1d..0a4156461 100644
--- a/state/statedb.go
+++ b/state/statedb.go
@@ -121,6 +121,7 @@ func (self *StateDB) Delete(addr []byte) bool {
stateObject := self.GetOrNewStateObject(addr)
if stateObject != nil {
stateObject.MarkForDeletion()
+ stateObject.balance = new(big.Int)
return true
}
@@ -128,6 +129,14 @@ func (self *StateDB) Delete(addr []byte) bool {
return false
}
+func (self *StateDB) IsDeleted(addr []byte) bool {
+ stateObject := self.GetStateObject(addr)
+ if stateObject != nil {
+ return stateObject.remove
+ }
+ return false
+}
+
//
// Setting, updating & deleting state object methods
//