get rid of data copy (#16210)

* get rid of data copy

* format
This commit is contained in:
Jeff Washington (jwash) 2021-03-30 10:33:46 -05:00 committed by GitHub
parent 28a6424f38
commit f4f2e781ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -1,11 +1,7 @@
use byteorder::{ByteOrder, LittleEndian, WriteBytesExt};
use solana_sdk::{
account::{ReadableAccount, WritableAccount},
bpf_loader_deprecated,
entrypoint::MAX_PERMITTED_DATA_INCREASE,
instruction::InstructionError,
keyed_account::KeyedAccount,
pubkey::Pubkey,
account::ReadableAccount, bpf_loader_deprecated, entrypoint::MAX_PERMITTED_DATA_INCREASE,
instruction::InstructionError, keyed_account::KeyedAccount, pubkey::Pubkey,
};
use std::{
io::prelude::*,
@ -258,7 +254,7 @@ pub fn deserialize_parameters_aligned(
start += size_of::<Pubkey>(); // owner
account.lamports = LittleEndian::read_u64(&buffer[start..]);
start += size_of::<u64>(); // lamports
let pre_len = account.data_as_mut_slice().len();
let pre_len = account.data().len();
let post_len = LittleEndian::read_u64(&buffer[start..]) as usize;
start += size_of::<u64>(); // data length
let mut data_end = start + pre_len;