Minor test cleanup and comments (#17283)

This commit is contained in:
Ryo Onodera 2021-05-18 07:22:43 +09:00 committed by GitHub
parent d461aba6a4
commit bcbe155575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -6004,7 +6004,7 @@ pub(crate) mod tests {
let sysvar_and_native_proram_delta = 1;
assert_eq!(
previous_capitalization - current_capitalization + sysvar_and_native_proram_delta,
previous_capitalization - (current_capitalization - sysvar_and_native_proram_delta),
burned_portion
);
@ -8480,6 +8480,7 @@ pub(crate) mod tests {
use sysvar::clock::Clock;
let dummy_clock_id = solana_sdk::pubkey::new_rand();
let dummy_rent_epoch = 44;
let (mut genesis_config, _mint_keypair) = create_genesis_config(500);
let expected_previous_slot = 3;
@ -8496,19 +8497,22 @@ pub(crate) mod tests {
bank1.update_sysvar_account(&dummy_clock_id, |optional_account| {
assert!(optional_account.is_none());
create_account(
let mut account = create_account(
&Clock {
slot: expected_previous_slot,
..Clock::default()
},
bank1.inherit_specially_retained_account_fields(optional_account),
)
);
account.set_rent_epoch(dummy_rent_epoch);
account
});
let current_account = bank1.get_account(&dummy_clock_id).unwrap();
assert_eq!(
expected_previous_slot,
from_account::<Clock, _>(&current_account).unwrap().slot
);
assert_eq!(dummy_rent_epoch, current_account.rent_epoch());
},
|old, new| {
assert_eq!(old + 1, new);
@ -8560,6 +8564,7 @@ pub(crate) mod tests {
expected_next_slot,
from_account::<Clock, _>(&current_account).unwrap().slot
);
assert_eq!(INITIAL_RENT_EPOCH, current_account.rent_epoch());
},
|old, new| {
// if existing, capitalization shouldn't change

View File

@ -61,7 +61,7 @@ impl RentCollector {
address: &Pubkey,
account: &mut AccountSharedData,
) -> u64 {
if account.executable()
if account.executable() // executable accounts must be rent-exempt balance
|| account.rent_epoch() > self.epoch
|| sysvar::check_id(account.owner())
|| *address == incinerator::id()