core/state: unexport removedAccountWithBalance

This commit is contained in:
Gary Rong 2026-03-23 21:21:08 +08:00
parent 3f09619dbc
commit cac38e56f5

View file

@ -743,12 +743,12 @@ func (s *StateDB) GetRefund() uint64 {
return s.refund return s.refund
} }
type RemovedAccountWithBalance struct { type removedAccountWithBalance struct {
Address common.Address address common.Address
Balance *uint256.Int balance *uint256.Int
} }
// EmitLogsForBurnAccounts emits the eth transfer logs for accounts scheduled for // EmitLogsForBurnAccounts emits the eth burn logs for accounts scheduled for
// removal which still have positive balance. The purpose of this function is // removal which still have positive balance. The purpose of this function is
// to handle a corner case of EIP-7708 where a self-destructed account might // to handle a corner case of EIP-7708 where a self-destructed account might
// still receive funds between sending/burning its previous balance and actual // still receive funds between sending/burning its previous balance and actual
@ -759,22 +759,22 @@ type RemovedAccountWithBalance struct {
// This function should only be invoked at the transaction boundary, specifically // This function should only be invoked at the transaction boundary, specifically
// before the Finalise. // before the Finalise.
func (s *StateDB) EmitLogsForBurnAccounts() { func (s *StateDB) EmitLogsForBurnAccounts() {
var list []RemovedAccountWithBalance var list []removedAccountWithBalance
for addr := range s.journal.dirties { for addr := range s.journal.dirties {
if obj, exist := s.stateObjects[addr]; exist && obj.selfDestructed && !obj.Balance().IsZero() { if obj, exist := s.stateObjects[addr]; exist && obj.selfDestructed && !obj.Balance().IsZero() {
list = append(list, RemovedAccountWithBalance{ list = append(list, removedAccountWithBalance{
Address: obj.address, address: obj.address,
Balance: obj.Balance(), balance: obj.Balance(),
}) })
} }
} }
if list != nil { if list != nil {
sort.Slice(list, func(i, j int) bool { sort.Slice(list, func(i, j int) bool {
return list[i].Address.Cmp(list[j].Address) < 0 return list[i].address.Cmp(list[j].address) < 0
}) })
} }
for _, acct := range list { for _, acct := range list {
s.AddLog(types.EthBurnLog(acct.Address, acct.Balance)) s.AddLog(types.EthBurnLog(acct.address, acct.balance))
} }
} }