AcctIdx: AccountInfo::stored_size private (#21821)
This commit is contained in:
parent
4bc5bfb2df
commit
c9e0bde407
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue