Skip to content

Commit

Permalink
pr feedback: use let else, remove epoch 0 hack
Browse files Browse the repository at this point in the history
  • Loading branch information
AshwinSekar committed Jan 25, 2024
1 parent 70a206c commit 850dc1e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions gossip/src/duplicate_shred_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,14 @@ impl DuplicateShredHandler {

fn should_notify_state_machine(&self, slot: Slot) -> bool {
let root_bank = self.bank_forks.read().unwrap().root_bank();
let activated_slot = root_bank
let Some(activated_slot) = root_bank
.feature_set
.activated_slot(&feature_set::enable_gossip_duplicate_proof_ingestion::id())
.map(|slot| root_bank.epoch_schedule().get_epoch(slot));
activated_slot.is_some_and(|feature_epoch| {
root_bank.epoch_schedule().get_epoch(slot) > feature_epoch
// feature_epoch could only be 0 in tests and new cluster setup.
|| feature_epoch == 0
})
else {
return false;
};
root_bank.epoch_schedule().get_epoch(slot)
> root_bank.epoch_schedule().get_epoch(activated_slot)
}

fn should_consume_slot(&mut self, slot: Slot) -> bool {
Expand Down

0 comments on commit 850dc1e

Please sign in to comment.