small cleanup

This commit is contained in:
Jared Wasinger 2026-01-05 16:21:34 +09:00 committed by lightclient
parent 476b184651
commit 4f359dcd11
No known key found for this signature in database
GPG key ID: 657913021EF45A6A
2 changed files with 6 additions and 7 deletions

View file

@ -898,19 +898,18 @@ func opSelfdestruct6780(pc *uint64, evm *EVM, scope *ScopeContext) ([]byte, erro
beneficiary := scope.Stack.pop()
balance := evm.StateDB.GetBalance(scope.Contract.Address())
createdInTx := !evm.StateDB.ContractExistedBeforeCurTx(scope.Contract.Address())
targetIsSelf := scope.Contract.Address() == common.BytesToAddress(beneficiary.Bytes())
if createdInTx {
// if the contract is not preexisting, the balance is immediately burned on selfdestruct-to-self
evm.StateDB.SubBalance(scope.Contract.Address(), balance, tracing.BalanceDecreaseSelfdestruct)
if scope.Contract.Address() != common.BytesToAddress(beneficiary.Bytes()) {
if !targetIsSelf {
evm.StateDB.AddBalance(beneficiary.Bytes20(), balance, tracing.BalanceIncreaseSelfdestruct)
}
} else {
} else if !targetIsSelf {
// if the contract is preexisting, the balance isn't burned on selfdestruct-to-self
if scope.Contract.Address() != common.BytesToAddress(beneficiary.Bytes()) {
evm.StateDB.SubBalance(scope.Contract.Address(), balance, tracing.BalanceDecreaseSelfdestruct)
evm.StateDB.AddBalance(beneficiary.Bytes20(), balance, tracing.BalanceIncreaseSelfdestruct)
}
evm.StateDB.SubBalance(scope.Contract.Address(), balance, tracing.BalanceDecreaseSelfdestruct)
evm.StateDB.AddBalance(beneficiary.Bytes20(), balance, tracing.BalanceIncreaseSelfdestruct)
}
evm.StateDB.SelfDestruct6780(scope.Contract.Address())
if tracer := evm.Config.Tracer; tracer != nil {

@ -1 +1 @@
Subproject commit 81862e4848585a438d64f911a19b3825f0f4cd95
Subproject commit faf33b471465d3c6cdc3d04fbd690895f78d33f2