diff --git a/core/src/epoch_slots.rs b/core/src/epoch_slots.rs index e333bb7ad1..c0e89f1543 100644 --- a/core/src/epoch_slots.rs +++ b/core/src/epoch_slots.rs @@ -171,13 +171,30 @@ impl CompressedSlots { } } -#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] +#[derive(Serialize, Deserialize, Clone, Default, PartialEq)] pub struct EpochSlots { pub from: Pubkey, pub slots: Vec, pub wallclock: u64, } +use std::fmt; +impl fmt::Debug for EpochSlots { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let num_slots: usize = self.slots.iter().map(|s| s.num_slots()).sum(); + let lowest_slot = self + .slots + .iter() + .map(|s| s.first_slot()) + .fold(0, std::cmp::min); + write!( + f, + "EpochSlots {{ from: {} num_slots: {} lowest_slot: {} wallclock: {} }}", + self.from, num_slots, lowest_slot, self.wallclock + ) + } +} + impl EpochSlots { pub fn new(from: Pubkey, now: u64) -> Self { Self {