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

@@ -1,8 +1,4 @@
use crate::{
hash::Hash,
instruction::InstructionError,
{clock::Epoch, pubkey::Pubkey},
};
use crate::{clock::Epoch, hash::Hash, instruction::InstructionError, pubkey::Pubkey};
use std::{
cell::{Ref, RefCell, RefMut},
cmp, fmt,
@@ -183,6 +179,10 @@ impl<'a> KeyedAccount<'a> {
Ok(self.try_borrow()?.executable)
}
pub fn rent_epoch(&self) -> Result<Epoch, InstructionError> {
Ok(self.try_borrow()?.rent_epoch)
}
pub fn try_account_ref(&'a self) -> Result<Ref<Account>, InstructionError> {
self.try_borrow()
}