mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Make sure contract suicides successfully before add balance to other address.
This commit is contained in:
parent
dbb03fe989
commit
bcafff9bcf
1 changed files with 4 additions and 2 deletions
|
|
@ -878,9 +878,11 @@ func opStop(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory
|
||||||
|
|
||||||
func opSuicide(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
|
func opSuicide(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
|
||||||
balance := interpreter.evm.StateDB.GetBalance(contract.Address())
|
balance := interpreter.evm.StateDB.GetBalance(contract.Address())
|
||||||
interpreter.evm.StateDB.AddBalance(common.BigToAddress(stack.pop()), balance)
|
|
||||||
|
|
||||||
interpreter.evm.StateDB.Suicide(contract.Address())
|
suicided := interpreter.evm.StateDB.Suicide(contract.Address())
|
||||||
|
if suicided {
|
||||||
|
interpreter.evm.StateDB.AddBalance(common.BigToAddress(stack.pop()), balance)
|
||||||
|
}
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue