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

@@ -74,9 +74,9 @@ fn initialize_account(vote_pubkey: &Pubkey, node_pubkey: &Pubkey, commission: u8
}
pub fn minimum_balance() -> u64 {
let rent = solana_sdk::rent::Rent::default();
let rent_calculator = solana_sdk::rent_calculator::RentCalculator::default();
rent.minimum_balance(VoteState::size_of())
rent_calculator.minimum_balance(VoteState::size_of())
}
pub fn create_account(
@@ -279,8 +279,8 @@ mod tests {
#[test]
fn test_minimum_balance() {
let rent = solana_sdk::rent::Rent::default();
let minimum_balance = rent.minimum_balance(VoteState::size_of());
let rent_calculator = solana_sdk::rent_calculator::RentCalculator::default();
let minimum_balance = rent_calculator.minimum_balance(VoteState::size_of());
// vote state cheaper than "my $0.02" ;)
assert!(minimum_balance as f64 / 2f64.powf(34.0) < 0.02)
}