Skip to content

Commit

Permalink
Merge pull request ethereum#17982 from holiman/polish_contantinople_e…
Browse files Browse the repository at this point in the history
…xtcodehash

core/vm: check empty in extcodehash
  • Loading branch information
karalabe authored Nov 8, 2018
2 parents bd519ab + 1b6fd03 commit d0675e9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/vm/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit d0675e9

Please sign in to comment.