diff options
author | Martin Holst Swende <martin@swende.se> | 2018-10-26 14:52:41 +0800 |
---|---|---|
committer | Martin Holst Swende <martin@swende.se> | 2018-10-26 14:56:37 +0800 |
commit | 1b6fd032e3def058133161a45a000dae4d0db729 (patch) | |
tree | 8152673b782b1d997b385365351c9680edb90ba4 /core | |
parent | 8ed4739176f435d09dfa36d8b2e2a3c8c6f407dd (diff) | |
download | dexon-1b6fd032e3def058133161a45a000dae4d0db729.tar dexon-1b6fd032e3def058133161a45a000dae4d0db729.tar.gz dexon-1b6fd032e3def058133161a45a000dae4d0db729.tar.bz2 dexon-1b6fd032e3def058133161a45a000dae4d0db729.tar.lz dexon-1b6fd032e3def058133161a45a000dae4d0db729.tar.xz dexon-1b6fd032e3def058133161a45a000dae4d0db729.tar.zst dexon-1b6fd032e3def058133161a45a000dae4d0db729.zip |
core/vm: check empty in extcodehash
Diffstat (limited to 'core')
-rw-r--r-- | core/vm/instructions.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/vm/instructions.go b/core/vm/instructions.go index b7c3ca532..6696c6e3d 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -544,7 +544,12 @@ func opExtCodeCopy(pc *uint64, interpreter *EVMInterpreter, contract *Contract, // this account should be regarded as a non-existent account and zero should be returned. func opExtCodeHash(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) { slot := stack.peek() - slot.SetBytes(interpreter.evm.StateDB.GetCodeHash(common.BigToAddress(slot)).Bytes()) + address := common.BigToAddress(slot) + if interpreter.evm.StateDB.Empty(address) { + slot.SetUint64(0) + } else { + slot.SetBytes(interpreter.evm.StateDB.GetCodeHash(address).Bytes()) + } return nil, nil } |