From 2eecac863689b00a5ee01c41f73bcd29faeff187 Mon Sep 17 00:00:00 2001 From: kchojn Date: Thu, 31 Oct 2024 15:46:25 -0300 Subject: [PATCH] refactor(statedb_hooked.go): reorganize conditional statements for better readability and consistency --- core/state/statedb_hooked.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/state/statedb_hooked.go b/core/state/statedb_hooked.go index 3a924cec8e..6475cd1a69 100644 --- a/core/state/statedb_hooked.go +++ b/core/state/statedb_hooked.go @@ -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) }