From 24851e7e6b5757b50c4b044c8f46eb94bdd5f218 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 25 Jun 2019 09:14:16 +0200 Subject: [PATCH] Treat empty account the same as non-exist accounts in EIP-1052 (#10775) --- ethcore/src/externalities.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ethcore/src/externalities.rs b/ethcore/src/externalities.rs index 23a4a83c3d1..41122afc1df 100644 --- a/ethcore/src/externalities.rs +++ b/ethcore/src/externalities.rs @@ -314,7 +314,11 @@ impl<'a, T: 'a, V: 'a, B: 'a> Ext for Externalities<'a, T, V, B> } fn extcodehash(&self, address: &Address) -> vm::Result> { - Ok(self.state.code_hash(address)?) + if self.state.exists_and_not_null(address)? { + Ok(self.state.code_hash(address)?) + } else { + Ok(None) + } } fn extcodesize(&self, address: &Address) -> vm::Result> {