Custom epochslots debug (#9647)
This commit is contained in:
parent
2a935ec15f
commit
2e8349196e
|
@ -171,13 +171,30 @@ impl CompressedSlots {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
|
#[derive(Serialize, Deserialize, Clone, Default, PartialEq)]
|
||||||
pub struct EpochSlots {
|
pub struct EpochSlots {
|
||||||
pub from: Pubkey,
|
pub from: Pubkey,
|
||||||
pub slots: Vec<CompressedSlots>,
|
pub slots: Vec<CompressedSlots>,
|
||||||
pub wallclock: u64,
|
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 {
|
impl EpochSlots {
|
||||||
pub fn new(from: Pubkey, now: u64) -> Self {
|
pub fn new(from: Pubkey, now: u64) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|
Loading…
Reference in New Issue