Make test_hash_stored_account pass in release mode

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.
This commit is contained in:
Ruud van Asseldonk
2021-04-26 13:02:27 +02:00
committed by Michael Vines
parent c17451ca73
commit d951916d40

View File

@ -8706,8 +8706,12 @@ pub mod tests {
hash: &hash, hash: &hash,
}; };
let account = stored_account.clone_account(); 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!( assert_eq!(
AccountsDb::hash_stored_account(slot, &stored_account), AccountsDb::hash_stored_account(slot, &stored_account),