mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 18:02:24 +00:00
refactor(statedb_hooked.go): reorganize conditional statements for better readability and consistency
This commit is contained in:
parent
3facc19be3
commit
2eecac8636
1 changed files with 4 additions and 4 deletions
|
|
@ -208,11 +208,11 @@ func (s *hookedStateDB) SelfDestruct(address common.Address) uint256.Int {
|
|||
|
||||
prev := s.inner.SelfDestruct(address)
|
||||
|
||||
if !prev.IsZero() && s.hooks.OnBalanceChange != nil {
|
||||
if s.hooks.OnBalanceChange != nil && !prev.IsZero() {
|
||||
s.hooks.OnBalanceChange(address, prev.ToBig(), new(big.Int), tracing.BalanceDecreaseSelfdestruct)
|
||||
}
|
||||
|
||||
if len(prevCode) > 0 && s.hooks.OnCodeChange != nil {
|
||||
if s.hooks.OnCodeChange != nil && len(prevCode) > 0 {
|
||||
s.hooks.OnCodeChange(address, prevCodeHash, prevCode, types.EmptyCodeHash, nil)
|
||||
}
|
||||
|
||||
|
|
@ -230,11 +230,11 @@ func (s *hookedStateDB) SelfDestruct6780(address common.Address) (uint256.Int, b
|
|||
|
||||
prev, changed := s.inner.SelfDestruct6780(address)
|
||||
|
||||
if !prev.IsZero() && changed && s.hooks.OnBalanceChange != nil {
|
||||
if s.hooks.OnBalanceChange != nil && changed && !prev.IsZero() {
|
||||
s.hooks.OnBalanceChange(address, prev.ToBig(), new(big.Int), tracing.BalanceDecreaseSelfdestruct)
|
||||
}
|
||||
|
||||
if len(prevCode) > 0 && changed && s.hooks.OnCodeChange != nil {
|
||||
if s.hooks.OnCodeChange != nil && changed && len(prevCode) > 0 {
|
||||
s.hooks.OnCodeChange(address, prevCodeHash, prevCode, types.EmptyCodeHash, nil)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue