Skip to content

Commit

Permalink
pr feedback: avoid taking lock if ff is already found
Browse files Browse the repository at this point in the history
  • Loading branch information
AshwinSekar committed Jan 25, 2024
1 parent 5a8c44e commit 11e2ef5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions gossip/src/duplicate_shred_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,15 @@ impl DuplicateShredHandler {
return;
}
self.last_root = last_root;
self.enable_gossip_duplicate_proof_ingestion_epoch = {
let root_bank = self.bank_forks.read().unwrap().root_bank();
root_bank
.feature_set
.activated_slot(&feature_set::enable_gossip_duplicate_proof_ingestion::id())
.map(|slot| self.epoch_schedule.get_epoch(slot))
};
if self.enable_gossip_duplicate_proof_ingestion_epoch.is_none() {
self.enable_gossip_duplicate_proof_ingestion_epoch = {
let root_bank = self.bank_forks.read().unwrap().root_bank();
root_bank
.feature_set
.activated_slot(&feature_set::enable_gossip_duplicate_proof_ingestion::id())
.map(|slot| self.epoch_schedule.get_epoch(slot))
};
}
if let Ok(bank_fork) = self.bank_forks.try_read() {
let root_bank = bank_fork.root_bank();
let epoch_info = root_bank.get_epoch_info();
Expand Down

0 comments on commit 11e2ef5

Please sign in to comment.