mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 13:21:37 +00:00
core/state: remove LogsForBurnAccounts per EIP-8246
This commit is contained in:
parent
16ee2ef1fc
commit
17fcefa1c4
1 changed files with 0 additions and 38 deletions
|
|
@ -764,44 +764,6 @@ func (s *StateDB) GetRefund() uint64 {
|
||||||
return s.refund
|
return s.refund
|
||||||
}
|
}
|
||||||
|
|
||||||
type removedAccountWithBalance struct {
|
|
||||||
address common.Address
|
|
||||||
balance *uint256.Int
|
|
||||||
}
|
|
||||||
|
|
||||||
// LogsForBurnAccounts returns the eth burn logs for accounts scheduled for
|
|
||||||
// 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
|
|
||||||
// still receive funds between sending/burning its previous balance and actual
|
|
||||||
// removal. In this case the burning of these remaining balances still need to
|
|
||||||
// be logged.
|
|
||||||
// Specification EIP-7708: https://eips.ethereum.org/EIPS/eip-7708
|
|
||||||
//
|
|
||||||
// This function should only be invoked at the transaction boundary, specifically
|
|
||||||
// before the Finalise.
|
|
||||||
func (s *StateDB) LogsForBurnAccounts() []*types.Log {
|
|
||||||
var list []removedAccountWithBalance
|
|
||||||
for addr := range s.journal.mutations {
|
|
||||||
if obj, exist := s.stateObjects[addr]; exist && obj.selfDestructed && !obj.Balance().IsZero() {
|
|
||||||
list = append(list, removedAccountWithBalance{
|
|
||||||
address: obj.address,
|
|
||||||
balance: obj.Balance(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if list == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
sort.Slice(list, func(i, j int) bool {
|
|
||||||
return list[i].address.Cmp(list[j].address) < 0
|
|
||||||
})
|
|
||||||
logs := make([]*types.Log, len(list))
|
|
||||||
for i, acct := range list {
|
|
||||||
logs[i] = types.EthBurnLog(acct.address, acct.balance)
|
|
||||||
}
|
|
||||||
return logs
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finalise finalises the state by removing the destructed objects and clears
|
// Finalise finalises the state by removing the destructed objects and clears
|
||||||
// the journal as well as the refunds. Finalise, however, will not push any updates
|
// the journal as well as the refunds. Finalise, however, will not push any updates
|
||||||
// into the tries just yet. Only IntermediateRoot or Commit will do that.
|
// into the tries just yet. Only IntermediateRoot or Commit will do that.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue