Expose executable and rent_epoch in AccountInfo (#8619)

This commit is contained in:
Jack May
2020-03-04 10:52:09 -08:00
committed by GitHub
parent b85d7c1f70
commit 25df95be6f
5 changed files with 68 additions and 26 deletions

View File

@@ -67,18 +67,12 @@ pub unsafe fn deserialize<'a>(input: *mut u8) -> (&'a Pubkey, Vec<AccountInfo<'a
let dup_info = *(input.add(offset) as *const u8);
offset += size_of::<u8>();
if dup_info == std::u8::MAX {
let is_signer = {
#[allow(clippy::cast_ptr_alignment)]
let is_signer = *(input.add(offset) as *const u8);
is_signer != 0
};
#[allow(clippy::cast_ptr_alignment)]
let is_signer = *(input.add(offset) as *const u8) != 0;
offset += size_of::<u8>();
let is_writable = {
#[allow(clippy::cast_ptr_alignment)]
let is_writable = *(input.add(offset) as *const u8);
is_writable != 0
};
#[allow(clippy::cast_ptr_alignment)]
let is_writable = *(input.add(offset) as *const u8) != 0;
offset += size_of::<u8>();
let key: &Pubkey = &*(input.add(offset) as *const Pubkey);
@@ -100,6 +94,14 @@ pub unsafe fn deserialize<'a>(input: *mut u8) -> (&'a Pubkey, Vec<AccountInfo<'a
let owner: &Pubkey = &*(input.add(offset) as *const Pubkey);
offset += size_of::<Pubkey>();
#[allow(clippy::cast_ptr_alignment)]
let executable = *(input.add(offset) as *const u8) != 0;
offset += size_of::<u8>();
#[allow(clippy::cast_ptr_alignment)]
let rent_epoch = *(input.add(offset) as *const u64);
offset += size_of::<u64>();
accounts.push(AccountInfo {
is_signer,
is_writable,
@@ -107,6 +109,8 @@ pub unsafe fn deserialize<'a>(input: *mut u8) -> (&'a Pubkey, Vec<AccountInfo<'a
lamports,
data,
owner,
executable,
rent_epoch,
});
} else {
// Duplicate account, clone the original