mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 13:21:37 +00:00
core/state: moved event sorting into GetRemovedAccountsWithBalance
This commit is contained in:
parent
d74e319ad6
commit
b8939107a2
2 changed files with 7 additions and 9 deletions
|
|
@ -762,6 +762,11 @@ func (s *StateDB) GetRemovedAccountsWithBalance() (list []RemovedAccountWithBala
|
||||||
list = append(list, RemovedAccountWithBalance{Address: obj.address, Balance: obj.Balance()})
|
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
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
"sort"
|
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/consensus/misc"
|
"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) {
|
if evm.ChainConfig().IsAmsterdam(blockNumber, blockTime) {
|
||||||
// Emit burn logs where accounts with non-empty balances have been deleted
|
// Emit burn logs where accounts with non-empty balances have been deleted
|
||||||
removedWithBalance := statedb.GetRemovedAccountsWithBalance()
|
for _, sd := range statedb.GetRemovedAccountsWithBalance() {
|
||||||
if removedWithBalance != nil {
|
statedb.AddLog(types.EthBurnLog(blockNumber, sd.Address, sd.Balance))
|
||||||
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))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Update the state with pending changes.
|
// Update the state with pending changes.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue