Rent tangential stuff (#5910)

* rename rent.rs to rent_calculator.rs

* add rent sysvar

* integrate rent_calculator with bank

* rent_calculator integration with genesis

* add test for rent sysvar
This commit is contained in:
Parth
2019-09-17 17:12:55 +05:30
committed by GitHub
parent b31d334ef4
commit d63518a835
11 changed files with 157 additions and 30 deletions

View File

@@ -7,8 +7,9 @@ use solana_sdk::{
entrypoint,
entrypoint::SUCCESS,
pubkey::Pubkey,
rent_calculator,
sysvar::{
clock::Clock, fees::Fees, rewards::Rewards, slot_hashes::SlotHashes,
clock::Clock, fees::Fees, rent::Rent, rewards::Rewards, slot_hashes::SlotHashes,
stake_history::StakeHistory,
},
};
@@ -39,5 +40,16 @@ fn process_instruction(_program_id: &Pubkey, accounts: &mut [AccountInfo], _data
let stake_history = StakeHistory::from_account_info(&accounts[6]).unwrap();
assert_eq!(stake_history.len(), 1);
let rent = Rent::from_account_info(&accounts[7]).unwrap();
assert_eq!(
rent.rent_calculator.due(
rent_calculator::DEFAULT_LAMPORTS_PER_BYTE_YEAR
* rent_calculator::DEFAULT_EXEMPTION_THRESHOLD as u64,
1,
1.0
),
(0, true)
);
SUCCESS
}