Expose executable and rent_epoch in AccountInfo (#8619) (#8631)

automerge
This commit is contained in:
Grimes
2020-03-04 12:09:14 -08:00
committed by GitHub
parent 27e5203078
commit 74cbc6953f
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()
}