Adds AccountsDb::get_bank_hash_info() (#29908)
This commit is contained in:
parent
fa39bfef6b
commit
dde4b5d1ef
|
@ -2443,7 +2443,6 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_accounts_empty_bank_hash() {
|
||||
let accounts = Accounts::new_with_config_for_tests(
|
||||
Vec::new(),
|
||||
|
@ -2451,7 +2450,8 @@ mod tests {
|
|||
AccountSecondaryIndexes::default(),
|
||||
AccountShrinkThreshold::default(),
|
||||
);
|
||||
accounts.bank_hash_info_at(1);
|
||||
assert!(accounts.accounts_db.get_bank_hash_info(0).is_some());
|
||||
assert!(accounts.accounts_db.get_bank_hash_info(1).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -7547,6 +7547,11 @@ impl AccountsDb {
|
|||
accounts_delta_hash
|
||||
}
|
||||
|
||||
/// Get the bank hash info for `slot`
|
||||
pub fn get_bank_hash_info(&self, slot: Slot) -> Option<BankHashInfo> {
|
||||
self.bank_hashes.read().unwrap().get(&slot).cloned()
|
||||
}
|
||||
|
||||
fn update_index<'a, T: ReadableAccount + Sync>(
|
||||
&self,
|
||||
infos: Vec<AccountInfo>,
|
||||
|
|
Loading…
Reference in New Issue