mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-20 11:46:44 +00:00
small cleanup
This commit is contained in:
parent
476b184651
commit
4f359dcd11
2 changed files with 6 additions and 7 deletions
|
|
@ -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
|
||||
Loading…
Reference in a new issue