diff --git a/crates/revm/src/db/in_memory_db.rs b/crates/revm/src/db/in_memory_db.rs index aab605b46e..d395d2aa44 100644 --- a/crates/revm/src/db/in_memory_db.rs +++ b/crates/revm/src/db/in_memory_db.rs @@ -62,7 +62,9 @@ impl CacheDB { pub fn insert_contract(&mut self, account: &mut AccountInfo) { if let Some(code) = &account.code { if !code.is_empty() { - account.code_hash = code.hash_slow(); + if account.code_hash == KECCAK_EMPTY { + account.code_hash = code.hash_slow(); + } self.contracts .entry(account.code_hash) .or_insert_with(|| code.clone());