AcctIdx: AccountInfo::stored_size private (#21821)

This commit is contained in:
Jeff Washington (jwash) 2021-12-13 10:10:06 -06:00 committed by GitHub
parent 4bc5bfb2df
commit c9e0bde407
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -10,7 +10,7 @@ pub struct AccountInfo {
/// needed to track shrink candidacy in bytes. Used to update the number
/// of alive bytes in an AppendVec as newer slots purge outdated entries
pub stored_size: usize,
stored_size: usize,
/// lamports in the account used when squashing kept for optimization
/// purposes to remove accounts with zero balance.
@ -32,4 +32,8 @@ impl AccountInfo {
lamports,
}
}
pub fn stored_size(&self) -> usize {
self.stored_size
}
}

View File

@ -6016,7 +6016,7 @@ impl AccountsDb {
"AccountDB::accounts_index corrupted. Storage pointed to: {}, expected: {}, should only point to one slot",
store.slot(), *slot
);
let count = store.remove_account(account_info.stored_size, reset_accounts);
let count = store.remove_account(account_info.stored_size(), reset_accounts);
if count == 0 {
self.dirty_stores
.insert((*slot, store.append_vec_id()), store.clone());
@ -11852,7 +11852,7 @@ pub mod tests {
locked_entry.slot_list()[0]
})
.unwrap();
let removed_data_size = account_info.1.stored_size;
let removed_data_size = account_info.1.stored_size();
// Fetching the account from storage should return the same
// stored size as in the index.
assert_eq!(removed_data_size, account.stored_size);