Skip to content

Commit

Permalink
Use code from AccountInfo if it is Some (#185)
Browse files Browse the repository at this point in the history
If the `code` in an `AccountInfo` is already `Some`, it is unnecessary
to fetch the code again using `code_by_hash_ref`.
  • Loading branch information
JamesHinshelwood authored Aug 29, 2024
1 parent 2c49c7c commit 0de6442
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/tracing/builder/parity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,14 @@ where

let db_acc = db.basic_ref(addr)?.unwrap_or_default();

let code_hash = if db_acc.code_hash != KECCAK_EMPTY { db_acc.code_hash } else { continue };
curr_ref.code = if let Some(code) = db_acc.code {
code.original_bytes()
} else {
let code_hash =
if db_acc.code_hash != KECCAK_EMPTY { db_acc.code_hash } else { continue };

curr_ref.code = db.code_by_hash_ref(code_hash)?.original_bytes();
db.code_by_hash_ref(code_hash)?.original_bytes()
};
}

Ok(())
Expand Down

0 comments on commit 0de6442

Please sign in to comment.