Simplifies adding uncleaned pubkeys during index generation (#34007)

This commit is contained in:
Brooks 2023-11-09 16:06:15 -05:00 committed by GitHub
parent a96be5d2f0
commit 9f25f67e60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 10 deletions

View File

@ -71,10 +71,7 @@ use {
},
blake3::traits::digest::Digest,
crossbeam_channel::{unbounded, Receiver, Sender},
dashmap::{
mapref::entry::Entry::{Occupied, Vacant},
DashMap, DashSet,
},
dashmap::{DashMap, DashSet},
log::*,
rand::{thread_rng, Rng},
rayon::{prelude::*, ThreadPool},
@ -9368,12 +9365,7 @@ impl AccountsDb {
let unique_keys =
HashSet::<Pubkey>::from_iter(slot_keys.iter().map(|(_, key)| *key));
for (slot, key) in slot_keys {
match self.uncleaned_pubkeys.entry(slot) {
Occupied(mut occupied) => occupied.get_mut().push(key),
Vacant(vacant) => {
vacant.insert(vec![key]);
}
}
self.uncleaned_pubkeys.entry(slot).or_default().push(key);
}
let unique_pubkeys_by_bin_inner =
unique_keys.into_iter().collect::<Vec<_>>();