diff --git a/gossip/src/duplicate_shred.rs b/gossip/src/duplicate_shred.rs index 940d0bf75e2fe5..320fb3c9d764bc 100644 --- a/gossip/src/duplicate_shred.rs +++ b/gossip/src/duplicate_shred.rs @@ -93,6 +93,33 @@ pub enum Error { UnknownSlotLeader(Slot), } +impl Error { + /// Errors indicating that the initial node submitted an invalid duplicate proof case + pub(crate) fn is_non_critical(&self) -> bool { + match self { + Self::SlotMismatch + | Self::InvalidShredVersion(_) + | Self::InvalidSignature + | Self::ShredTypeMismatch + | Self::InvalidDuplicateShreds + | Self::InvalidLastIndexConflict + | Self::InvalidErasureMetaConflict => true, + Self::BlockstoreInsertFailed(_) + | Self::DataChunkMismatch + | Self::DuplicateSlotSenderFailure + | Self::InvalidChunkIndex { .. } + | Self::InvalidDuplicateSlotProof + | Self::InvalidSizeLimit + | Self::InvalidShred(_) + | Self::NumChunksMismatch + | Self::MissingDataChunk + | Self::SerializationError(_) + | Self::TryFromIntError(_) + | Self::UnknownSlotLeader(_) => false, + } + } +} + /// Check that `shred1` and `shred2` indicate a valid duplicate proof /// - Must be for the same slot /// - Must match the expected shred version diff --git a/gossip/src/duplicate_shred_handler.rs b/gossip/src/duplicate_shred_handler.rs index edf62aaf4276fc..5c4c0c846fa83d 100644 --- a/gossip/src/duplicate_shred_handler.rs +++ b/gossip/src/duplicate_shred_handler.rs @@ -57,8 +57,14 @@ impl DuplicateShredHandlerTrait for DuplicateShredHandler { fn handle(&mut self, shred_data: DuplicateShred) { self.cache_root_info(); self.maybe_prune_buffer(); + let slot = shred_data.slot; + let pubkey = shred_data.from; if let Err(error) = self.handle_shred_data(shred_data) { - error!("handle packet: {error:?}") + if error.is_non_critical() { + info!("Received invalid duplicate shred proof from {pubkey} for slot {slot}: {error:?}"); + } else { + error!("Unable to process duplicate shred proof from {pubkey} for slot {slot}: {error:?}"); + } } } }