set_data_from_slice (#15854)
* data_ensure_equal_to_slice * rename and change to copy
This commit is contained in:
committed by
GitHub
parent
654449ce91
commit
806bfdd67b
@ -136,8 +136,7 @@ pub fn deserialize_parameters_unaligned(
|
||||
let end = start + keyed_account.data_len()?;
|
||||
keyed_account
|
||||
.try_account_ref_mut()?
|
||||
.data_as_mut_slice()
|
||||
.clone_from_slice(&buffer[start..end]);
|
||||
.set_data_from_slice(&buffer[start..end]);
|
||||
start += keyed_account.data_len()? // data
|
||||
+ size_of::<Pubkey>() // owner
|
||||
+ size_of::<u8>() // executable
|
||||
@ -263,12 +262,10 @@ pub fn deserialize_parameters_aligned(
|
||||
if post_len != pre_len
|
||||
&& (post_len.saturating_sub(pre_len)) <= MAX_PERMITTED_DATA_INCREASE
|
||||
{
|
||||
account.data.resize(post_len, 0);
|
||||
data_end = start + post_len;
|
||||
}
|
||||
account
|
||||
.data_as_mut_slice()
|
||||
.clone_from_slice(&buffer[start..data_end]);
|
||||
|
||||
account.set_data_from_slice(&buffer[start..data_end]);
|
||||
start += pre_len + MAX_PERMITTED_DATA_INCREASE; // data
|
||||
start += (start as *const u8).align_offset(align_of::<u128>());
|
||||
start += size_of::<u64>(); // rent_epoch
|
||||
|
Reference in New Issue
Block a user