Skip to content

Commit

Permalink
Make test_hash_stored_account pass in release mode
Browse files Browse the repository at this point in the history
The hash differs between debug and release mode, which makes the test
fail when running under "cargo test --release". Use cfg! to include a
different expected hash in release mode.
  • Loading branch information
ruuda authored and mvines committed Jul 2, 2021
1 parent c17451c commit d951916
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions runtime/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8706,8 +8706,12 @@ pub mod tests {
hash: &hash,
};
let account = stored_account.clone_account();
let expected_account_hash =
Hash::from_str("4StuvYHFd7xuShVXB94uHHvpqGMCaacdZnYB74QQkPA1").unwrap();

let expected_account_hash = if cfg!(debug_assertions) {
Hash::from_str("4StuvYHFd7xuShVXB94uHHvpqGMCaacdZnYB74QQkPA1").unwrap()
} else {
Hash::from_str("33ruy7m3Xto7irYfsBSN74aAzQwCQxsfoZxXuZy2Rra3").unwrap()
};

assert_eq!(
AccountsDb::hash_stored_account(slot, &stored_account),
Expand Down

0 comments on commit d951916

Please sign in to comment.