From b8939107a2b9cf1c525818358c58c2f73e8098b7 Mon Sep 17 00:00:00 2001 From: zsfelfoldi Date: Fri, 20 Mar 2026 12:08:09 +0100 Subject: [PATCH] core/state: moved event sorting into GetRemovedAccountsWithBalance --- core/state/statedb.go | 5 +++++ core/state_processor.go | 11 ++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/core/state/statedb.go b/core/state/statedb.go index cf1709c2a9..e3ed0bbaec 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -762,6 +762,11 @@ func (s *StateDB) GetRemovedAccountsWithBalance() (list []RemovedAccountWithBala list = append(list, RemovedAccountWithBalance{Address: obj.address, Balance: obj.Balance()}) } } + if list != nil { + sort.Slice(list, func(i, j int) bool { + return list[i].Address.Cmp(list[j].Address) < 0 + }) + } return list } diff --git a/core/state_processor.go b/core/state_processor.go index 097d27b849..6fd4372fa7 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -20,7 +20,6 @@ import ( "context" "fmt" "math/big" - "sort" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus/misc" @@ -176,14 +175,8 @@ func ApplyTransactionWithEVM(msg *Message, gp *GasPool, statedb *state.StateDB, } if evm.ChainConfig().IsAmsterdam(blockNumber, blockTime) { // Emit burn logs where accounts with non-empty balances have been deleted - removedWithBalance := statedb.GetRemovedAccountsWithBalance() - if removedWithBalance != nil { - sort.Slice(removedWithBalance, func(i, j int) bool { - return removedWithBalance[i].Address.Cmp(removedWithBalance[j].Address) < 0 - }) - for _, sd := range removedWithBalance { - statedb.AddLog(types.EthBurnLog(blockNumber, sd.Address, sd.Balance)) - } + for _, sd := range statedb.GetRemovedAccountsWithBalance() { + statedb.AddLog(types.EthBurnLog(blockNumber, sd.Address, sd.Balance)) } } // Update the state with pending changes.