Simplify account.rent_epoch handling for sysvar rent (#16049)

* Add some code for special local testing

* Add comment to store_account_and_update_capitalization

* Simplify account.rent_epoch handling for sysvar rent

* Introduce *_for_test functions

* Add deprecation messages to existing api
This commit is contained in:
Ryo Onodera
2021-03-25 15:23:20 +09:00
committed by GitHub
parent 7f0ac6a67c
commit 6d5c6c17c5
16 changed files with 206 additions and 104 deletions

View File

@@ -490,17 +490,18 @@ mod tests {
RefCell::new(AccountSharedData::default())
}
fn create_default_recent_blockhashes_account() -> RefCell<AccountSharedData> {
RefCell::new(recent_blockhashes_account::create_account_with_data(
1,
vec![
IterItem(0u64, &Hash::default(), &FeeCalculator::default());
sysvar::recent_blockhashes::MAX_ENTRIES
]
.into_iter(),
))
RefCell::new(
recent_blockhashes_account::create_account_with_data_for_test(
vec![
IterItem(0u64, &Hash::default(), &FeeCalculator::default());
sysvar::recent_blockhashes::MAX_ENTRIES
]
.into_iter(),
),
)
}
fn create_default_rent_account() -> RefCell<AccountSharedData> {
RefCell::new(account::create_account_shared_data(&Rent::free(), 1))
RefCell::new(account::create_account_shared_data_for_test(&Rent::free()))
}
#[test]
@@ -1376,7 +1377,7 @@ mod tests {
RefCell::new(if sysvar::recent_blockhashes::check_id(&meta.pubkey) {
create_default_recent_blockhashes_account().into_inner()
} else if sysvar::rent::check_id(&meta.pubkey) {
account::create_account_shared_data(&Rent::free(), 1)
account::create_account_shared_data_for_test(&Rent::free())
} else {
AccountSharedData::default()
})
@@ -1470,8 +1471,7 @@ mod tests {
)
.unwrap();
let new_recent_blockhashes_account = RefCell::new(
solana_sdk::recent_blockhashes_account::create_account_with_data(
1,
solana_sdk::recent_blockhashes_account::create_account_with_data_for_test(
vec![
IterItem(
0u64,