load_to_collect_rent_eagerly returns loaded_slot (#24506)

This commit is contained in:
Jeff Washington (jwash) 2022-04-20 09:14:03 -05:00 committed by GitHub
parent d0761d0ca4
commit 957849f4a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 4 deletions

View File

@ -810,6 +810,18 @@ impl Accounts {
} }
} }
fn load_with_slot(
collector: &mut Vec<PubkeyAccountSlot>,
some_account_tuple: Option<(&Pubkey, AccountSharedData, Slot)>,
) {
if let Some(mapped_account_tuple) = some_account_tuple
.filter(|(_, account, _)| Self::is_loadable(account.lamports()))
.map(|(pubkey, account, slot)| (*pubkey, account, slot))
{
collector.push(mapped_account_tuple)
}
}
pub fn load_by_program( pub fn load_by_program(
&self, &self,
ancestors: &Ancestors, ancestors: &Ancestors,
@ -964,14 +976,14 @@ impl Accounts {
&self, &self,
ancestors: &Ancestors, ancestors: &Ancestors,
range: R, range: R,
) -> Vec<TransactionAccount> { ) -> Vec<PubkeyAccountSlot> {
self.accounts_db.range_scan_accounts( self.accounts_db.range_scan_accounts(
"load_to_collect_rent_eagerly_scan_elapsed", "load_to_collect_rent_eagerly_scan_elapsed",
ancestors, ancestors,
range, range,
&ScanConfig::new(true), &ScanConfig::new(true),
|collector: &mut Vec<TransactionAccount>, option| { |collector: &mut Vec<PubkeyAccountSlot>, option| {
Self::load_while_filtering(collector, option, |_| true) Self::load_with_slot(collector, option)
}, },
) )
} }

View File

@ -4829,7 +4829,7 @@ impl Bank {
// parallelize? // parallelize?
let mut rent_debits = RentDebits::default(); let mut rent_debits = RentDebits::default();
let mut total_collected = CollectedInfo::default(); let mut total_collected = CollectedInfo::default();
for (pubkey, mut account) in accounts { for (pubkey, mut account, _loaded_slot) in accounts {
let collected = self.rent_collector.collect_from_existing_account( let collected = self.rent_collector.collect_from_existing_account(
&pubkey, &pubkey,
&mut account, &mut account,