From 269e80b07ed8b8300372c44ebb5d7ac2328bf84c Mon Sep 17 00:00:00 2001 From: Halimao <1065621723@qq.com> Date: Thu, 27 Jun 2024 17:29:50 +0800 Subject: [PATCH] eth/tracers,trie: remove unnecessary check (#30071) --- eth/tracers/live/supply.go | 10 ++++------ eth/tracers/native/call_flat.go | 16 +++++++--------- trie/verkle.go | 6 ++---- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/eth/tracers/live/supply.go b/eth/tracers/live/supply.go index 936ffb9472..96f7059454 100644 --- a/eth/tracers/live/supply.go +++ b/eth/tracers/live/supply.go @@ -204,12 +204,10 @@ func (s *supply) internalTxsHandler(call *supplyTxCallstack) { s.delta.Burn.Misc.Add(s.delta.Burn.Misc, call.burn) } - if len(call.calls) > 0 { - // Recursively handle internal calls - for _, call := range call.calls { - callCopy := call - s.internalTxsHandler(&callCopy) - } + // Recursively handle internal calls + for _, call := range call.calls { + callCopy := call + s.internalTxsHandler(&callCopy) } } diff --git a/eth/tracers/native/call_flat.go b/eth/tracers/native/call_flat.go index ce0fb08114..a47b79f8df 100644 --- a/eth/tracers/native/call_flat.go +++ b/eth/tracers/native/call_flat.go @@ -274,16 +274,14 @@ func flatFromNested(input *callFrame, traceAddress []int, convertErrs bool, ctx } output = append(output, *frame) - if len(input.Calls) > 0 { - for i, childCall := range input.Calls { - childAddr := childTraceAddress(traceAddress, i) - childCallCopy := childCall - flat, err := flatFromNested(&childCallCopy, childAddr, convertErrs, ctx) - if err != nil { - return nil, err - } - output = append(output, flat...) + for i, childCall := range input.Calls { + childAddr := childTraceAddress(traceAddress, i) + childCallCopy := childCall + flat, err := flatFromNested(&childCallCopy, childAddr, convertErrs, ctx) + if err != nil { + return nil, err } + output = append(output, flat...) } return output, nil diff --git a/trie/verkle.go b/trie/verkle.go index 94a5ca9a2c..a457097e95 100644 --- a/trie/verkle.go +++ b/trie/verkle.go @@ -144,10 +144,8 @@ func (t *VerkleTrie) UpdateAccount(addr common.Address, acc *types.StateAccount) // Encode balance in little-endian bytes := acc.Balance.Bytes() - if len(bytes) > 0 { - for i, b := range bytes { - balance[len(bytes)-i-1] = b - } + for i, b := range bytes { + balance[len(bytes)-i-1] = b } values[utils.BalanceLeafKey] = balance[:]