mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-16 21:16:37 +00:00
apply same changes to hook invocation regarding nonce/code update for legacy selfdestruct
This commit is contained in:
parent
6610c2b3cc
commit
0de169fd31
1 changed files with 0 additions and 16 deletions
|
|
@ -248,28 +248,12 @@ func (s *hookedStateDB) SetState(address common.Address, key common.Hash, value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *hookedStateDB) SelfDestruct(address common.Address) uint256.Int {
|
func (s *hookedStateDB) SelfDestruct(address common.Address) uint256.Int {
|
||||||
var prevCode []byte
|
|
||||||
var prevCodeHash common.Hash
|
|
||||||
|
|
||||||
if s.hooks.OnCodeChange != nil {
|
|
||||||
prevCode = s.inner.GetCode(address)
|
|
||||||
prevCodeHash = s.inner.GetCodeHash(address)
|
|
||||||
}
|
|
||||||
|
|
||||||
prev := s.inner.SelfDestruct(address)
|
prev := s.inner.SelfDestruct(address)
|
||||||
|
|
||||||
if s.hooks.OnBalanceChange != nil && !prev.IsZero() {
|
if s.hooks.OnBalanceChange != nil && !prev.IsZero() {
|
||||||
s.hooks.OnBalanceChange(address, prev.ToBig(), new(big.Int), tracing.BalanceDecreaseSelfdestruct)
|
s.hooks.OnBalanceChange(address, prev.ToBig(), new(big.Int), tracing.BalanceDecreaseSelfdestruct)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(prevCode) > 0 {
|
|
||||||
if s.hooks.OnCodeChangeV2 != nil {
|
|
||||||
s.hooks.OnCodeChangeV2(address, prevCodeHash, prevCode, types.EmptyCodeHash, nil, tracing.CodeChangeSelfDestruct)
|
|
||||||
} else if s.hooks.OnCodeChange != nil {
|
|
||||||
s.hooks.OnCodeChange(address, prevCodeHash, prevCode, types.EmptyCodeHash, nil)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return prev
|
return prev
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue