Skip to content

Commit

Permalink
pr feedback: don't hold epoch stakes write lock for eviction
Browse files Browse the repository at this point in the history
  • Loading branch information
AshwinSekar committed Oct 2, 2024
1 parent be60401 commit 3f1fcd6
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions core/src/banking_stage/latest_unprocessed_votes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,16 +362,19 @@ impl LatestUnprocessedVotes {
if bank.epoch() <= self.current_epoch.load(Ordering::Relaxed) {
return;
}
let mut epoch_stakes = self.cached_epoch_stakes.write().unwrap();
*epoch_stakes = bank.current_epoch_stakes().clone();
self.current_epoch.store(bank.epoch(), Ordering::Relaxed);
self.deprecate_legacy_vote_ixs.store(
bank.feature_set
.is_active(&feature_set::deprecate_legacy_vote_ixs::id()),
Ordering::Relaxed,
);
{
let mut epoch_stakes = self.cached_epoch_stakes.write().unwrap();
*epoch_stakes = bank.current_epoch_stakes().clone();
self.current_epoch.store(bank.epoch(), Ordering::Relaxed);
self.deprecate_legacy_vote_ixs.store(
bank.feature_set
.is_active(&feature_set::deprecate_legacy_vote_ixs::id()),
Ordering::Relaxed,
);
}

// Evict any now unstaked pubkeys
let epoch_stakes = self.cached_epoch_stakes.read().unwrap();
let mut latest_votes_per_pubkey = self.latest_votes_per_pubkey.write().unwrap();
let mut unstaked_votes = 0;
latest_votes_per_pubkey.retain(|vote_pubkey, vote| {
Expand Down

0 comments on commit 3f1fcd6

Please sign in to comment.