diff options
author | Felix Lange <fjl@twurst.com> | 2016-10-06 04:22:31 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2016-10-06 21:32:17 +0800 |
commit | 90fce8bfa621f8c3be6663d62740783949111ff1 (patch) | |
tree | ae93f2f9f637f0530eb0cedc354871ca377717ad /core/vm | |
parent | 1f1ea18b5414bea22332bb4fce53cc95b5c6a07d (diff) | |
download | dexon-90fce8bfa621f8c3be6663d62740783949111ff1.tar dexon-90fce8bfa621f8c3be6663d62740783949111ff1.tar.gz dexon-90fce8bfa621f8c3be6663d62740783949111ff1.tar.bz2 dexon-90fce8bfa621f8c3be6663d62740783949111ff1.tar.lz dexon-90fce8bfa621f8c3be6663d62740783949111ff1.tar.xz dexon-90fce8bfa621f8c3be6663d62740783949111ff1.tar.zst dexon-90fce8bfa621f8c3be6663d62740783949111ff1.zip |
core/state: rename Delete/IsDeleted to Suicide/HasSuicided
The delete/remove naming has caused endless confusion in the past.
Diffstat (limited to 'core/vm')
-rw-r--r-- | core/vm/environment.go | 7 | ||||
-rw-r--r-- | core/vm/instructions.go | 2 | ||||
-rw-r--r-- | core/vm/jit.go | 2 | ||||
-rw-r--r-- | core/vm/vm.go | 2 |
4 files changed, 8 insertions, 5 deletions
diff --git a/core/vm/environment.go b/core/vm/environment.go index 1038e69d5..a4b2ac196 100644 --- a/core/vm/environment.go +++ b/core/vm/environment.go @@ -105,9 +105,12 @@ type Database interface { GetState(common.Address, common.Hash) common.Hash SetState(common.Address, common.Hash, common.Hash) - Delete(common.Address) bool + Suicide(common.Address) bool + HasSuicided(common.Address) bool + + // Exist reports whether the given account exists in state. + // Notably this should also return true for suicided accounts. Exist(common.Address) bool - IsDeleted(common.Address) bool } // Account represents a contract or basic ethereum account. diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 849a8463c..79aee60d2 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -614,7 +614,7 @@ func opSuicide(instr instruction, pc *uint64, env Environment, contract *Contrac balance := env.Db().GetBalance(contract.Address()) env.Db().AddBalance(common.BigToAddress(stack.pop()), balance) - env.Db().Delete(contract.Address()) + env.Db().Suicide(contract.Address()) } // following functions are used by the instruction jump table diff --git a/core/vm/jit.go b/core/vm/jit.go index 460a68ddd..55d2e0477 100644 --- a/core/vm/jit.go +++ b/core/vm/jit.go @@ -425,7 +425,7 @@ func jitCalculateGasAndSize(env Environment, contract *Contract, instr instructi } gas.Set(g) case SUICIDE: - if !statedb.IsDeleted(contract.Address()) { + if !statedb.HasSuicided(contract.Address()) { statedb.AddRefund(params.SuicideRefundGas) } case MLOAD: diff --git a/core/vm/vm.go b/core/vm/vm.go index 5d78b4a2a..033ada21c 100644 --- a/core/vm/vm.go +++ b/core/vm/vm.go @@ -303,7 +303,7 @@ func calculateGasAndSize(env Environment, contract *Contract, caller ContractRef } gas.Set(g) case SUICIDE: - if !statedb.IsDeleted(contract.Address()) { + if !statedb.HasSuicided(contract.Address()) { statedb.AddRefund(params.SuicideRefundGas) } case MLOAD: |