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

@ -3,7 +3,7 @@
use crate::ownable_instruction::OwnableError;
use bincode::serialize_into;
use solana_sdk::{
account::ReadableAccount,
account::{ReadableAccount, WritableAccount},
instruction::InstructionError,
keyed_account::{next_keyed_account, KeyedAccount},
process_instruction::InvokeContext,
@ -52,7 +52,7 @@ pub fn process_instruction(
}
let mut account = account_keyed_account.try_account_ref_mut()?;
serialize_into(&mut account.data[..], &account_owner_pubkey)
serialize_into(account.data_as_mut_slice(), &account_owner_pubkey)
.map_err(|_| InstructionError::AccountDataTooSmall)
}