Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
prevent double copy
Browse files Browse the repository at this point in the history
  • Loading branch information
ChihChengLiang committed Jul 21, 2023
1 parent 745cadf commit 84bc322
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions testool/src/statetest/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@ fn check_post(
}

if let Some(expected_code) = &expected.code {
let actual_code = if actual.code_hash.is_zero() {
vec![]
} else {
builder
.code_db
.get(&actual.code_hash)
.cloned()
.expect("code exists")
};
if &actual_code as &[u8] != expected_code.0 {
let actual_code = (!actual.code_hash.is_zero())
.then(|| {
builder
.code_db
.get(&actual.code_hash)
.cloned()
.expect("code exists")
})
.unwrap_or_default();
if actual_code != expected_code.0 {
return Err(StateTestError::CodeMismatch {
expected: expected_code.clone(),
found: Bytes::from(actual_code.to_vec()),
found: Bytes::from(actual_code),
});
}
}
Expand Down

0 comments on commit 84bc322

Please sign in to comment.