forked from cerc-io/plugeth
core/state: fixed (self)destructed objects
Add the object to the list of destructed objects during a selfdestruct / suicide operation and also remove it from the list once the journal reverts.
This commit is contained in:
parent
a5f6a1cb7c
commit
e7119ce12d
@ -71,8 +71,8 @@ type (
|
|||||||
hash common.Hash
|
hash common.Hash
|
||||||
}
|
}
|
||||||
touchChange struct {
|
touchChange struct {
|
||||||
account *common.Address
|
account *common.Address
|
||||||
prev bool
|
prev bool
|
||||||
prevDirty bool
|
prevDirty bool
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -91,6 +91,11 @@ func (ch suicideChange) undo(s *StateDB) {
|
|||||||
if obj != nil {
|
if obj != nil {
|
||||||
obj.suicided = ch.prev
|
obj.suicided = ch.prev
|
||||||
obj.setBalance(ch.prevbalance)
|
obj.setBalance(ch.prevbalance)
|
||||||
|
// if the object wasn't suicided before, remove
|
||||||
|
// it from the list of destructed objects as well.
|
||||||
|
if !obj.suicided {
|
||||||
|
delete(s.stateObjectsDestructed, *ch.account)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,6 +378,8 @@ func (self *StateDB) Suicide(addr common.Address) bool {
|
|||||||
})
|
})
|
||||||
stateObject.markSuicided()
|
stateObject.markSuicided()
|
||||||
stateObject.data.Balance = new(big.Int)
|
stateObject.data.Balance = new(big.Int)
|
||||||
|
self.stateObjectsDestructed[addr] = struct{}{}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user