Move KeyedAccount out of solana-program. Native programs are not supported by solana-program

This commit is contained in:
Michael Vines
2020-10-26 09:14:57 -07:00
parent 0475107654
commit 1b343665a1
35 changed files with 384 additions and 382 deletions

View File

@@ -2,11 +2,7 @@
//!
pub use crate::rent::Rent;
use crate::{
account::{Account, KeyedAccount},
instruction::InstructionError,
sysvar::Sysvar,
};
use crate::{account::Account, sysvar::Sysvar};
crate::declare_sysvar_id!("SysvarRent111111111111111111111111111111111", Rent);
@@ -16,18 +12,6 @@ pub fn create_account(lamports: u64, rent: &Rent) -> Account {
rent.create_account(lamports)
}
pub fn verify_rent_exemption(
keyed_account: &KeyedAccount,
rent_sysvar_account: &KeyedAccount,
) -> Result<(), InstructionError> {
let rent = Rent::from_keyed_account(rent_sysvar_account)?;
if !rent.is_exempt(keyed_account.lamports()?, keyed_account.data_len()?) {
Err(InstructionError::InsufficientFunds)
} else {
Ok(())
}
}
#[cfg(test)]
mod tests {
use super::*;