aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-11-08 20:26:04 +0800
committerGitHub <noreply@github.com>2018-11-08 20:26:04 +0800
commitd0675e9d9cf847070c1e422faf15e66b6af74781 (patch)
treea2aea44d4022657297049b1ed9f4aaeab0d901ac /core
parentbd519ab8aec7c82b28fb2a7e7edc428d8a38e781 (diff)
parent1b6fd032e3def058133161a45a000dae4d0db729 (diff)
downloadgo-tangerine-d0675e9d9cf847070c1e422faf15e66b6af74781.tar
go-tangerine-d0675e9d9cf847070c1e422faf15e66b6af74781.tar.gz
go-tangerine-d0675e9d9cf847070c1e422faf15e66b6af74781.tar.bz2
go-tangerine-d0675e9d9cf847070c1e422faf15e66b6af74781.tar.lz
go-tangerine-d0675e9d9cf847070c1e422faf15e66b6af74781.tar.xz
go-tangerine-d0675e9d9cf847070c1e422faf15e66b6af74781.tar.zst
go-tangerine-d0675e9d9cf847070c1e422faf15e66b6af74781.zip
Merge pull request #17982 from holiman/polish_contantinople_extcodehash
core/vm: check empty in extcodehash
Diffstat (limited to 'core')
-rw-r--r--core/vm/instructions.go7
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
}