From 16a6dceb6b246b42a88a323a29c6d84969a8efdd Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Thu, 9 Dec 2021 18:36:13 -0600 Subject: [PATCH] impl better debug for Ancestors (#21737) --- runtime/src/ancestors.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/runtime/src/ancestors.rs b/runtime/src/ancestors.rs index 7960018cdf..830076d0b0 100644 --- a/runtime/src/ancestors.rs +++ b/runtime/src/ancestors.rs @@ -1,12 +1,23 @@ -use {crate::accounts_index::RollingBitField, solana_sdk::clock::Slot, std::collections::HashMap}; +use { + crate::accounts_index::RollingBitField, + core::fmt::{Debug, Formatter}, + solana_sdk::clock::Slot, + std::collections::HashMap, +}; pub type AncestorsForSerialization = HashMap; -#[derive(Debug, Clone, PartialEq, AbiExample)] +#[derive(Clone, PartialEq, AbiExample)] pub struct Ancestors { ancestors: RollingBitField, } +impl Debug for Ancestors { + fn fmt(&self, f: &mut Formatter) -> std::fmt::Result { + write!(f, "{:?}", self.keys()) + } +} + // some tests produce ancestors ranges that are too large such // that we prefer to implement them in a sparse HashMap const ANCESTORS_HASH_MAP_SIZE: u64 = 8192;