From 850dc1ee2c972f6bcfa5497e39dd735e8ad59c00 Mon Sep 17 00:00:00 2001 From: Ashwin Sekar Date: Thu, 25 Jan 2024 17:30:35 +0000 Subject: [PATCH] pr feedback: use let else, remove epoch 0 hack --- gossip/src/duplicate_shred_handler.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gossip/src/duplicate_shred_handler.rs b/gossip/src/duplicate_shred_handler.rs index 8bcbee53cae875..e7b4cd0466fe75 100644 --- a/gossip/src/duplicate_shred_handler.rs +++ b/gossip/src/duplicate_shred_handler.rs @@ -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 {