mut data refs as slice (#15782)

This commit is contained in:
Jeff Washington (jwash)
2021-03-10 15:28:03 -06:00
committed by GitHub
parent 56923c91bf
commit 1135ffd595
13 changed files with 125 additions and 68 deletions

View File

@@ -5052,7 +5052,7 @@ pub mod tests {
use assert_matches::assert_matches;
use rand::{thread_rng, Rng};
use solana_sdk::{
account::{AccountSharedData, ReadableAccount},
account::{AccountSharedData, ReadableAccount, WritableAccount},
hash::HASH_BYTES,
pubkey::PUBKEY_BYTES,
};
@@ -6784,7 +6784,7 @@ pub mod tests {
// Account data may not be modified
let mut account_modified = account.clone();
account_modified.data[0] = 42;
account_modified.data_as_mut_slice()[0] = 42;
assert_ne!(
hash,
AccountsDb::hash_frozen_account_data(&account_modified)
@@ -6888,7 +6888,7 @@ pub mod tests {
let ancestors = vec![(0, 0)].into_iter().collect();
db.freeze_accounts(&ancestors, &[frozen_pubkey]);
account.data[0] = 42;
account.data_as_mut_slice()[0] = 42;
db.store_uncached(0, &[(&frozen_pubkey, &account)]);
}