impl better debug for Ancestors (#21737)

This commit is contained in:
Jeff Washington (jwash) 2021-12-09 18:36:13 -06:00 committed by GitHub
parent f32216588d
commit 16a6dceb6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 2 deletions

View File

@ -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<Slot, usize>;
#[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;