Skip to content

Commit

Permalink
chore(perf): only recalc code hash if its the default (bluealloy#716)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evalir committed Sep 14, 2023
1 parent 7a19fb7 commit 7c7086f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/revm/src/db/in_memory_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ impl<ExtDB: DatabaseRef> CacheDB<ExtDB> {
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());
Expand Down

0 comments on commit 7c7086f

Please sign in to comment.