add block caches to web3rpcs serializer

This commit is contained in:
Bryan Stitt 2023-06-07 12:04:39 -07:00
parent 8249b0aefe
commit b50579ea3a

@ -1202,7 +1202,7 @@ impl Serialize for Web3Rpcs {
where
S: Serializer,
{
let mut state = serializer.serialize_struct("Web3Rpcs", 2)?;
let mut state = serializer.serialize_struct("Web3Rpcs", 4)?;
{
let by_name = self.by_name.load();
@ -1222,12 +1222,9 @@ impl Serialize for Web3Rpcs {
}
}
// self.blocks_by_hash.sync();
// self.blocks_by_number.sync();
// state.serialize_field("block_hashes_count", &self.blocks_by_hash.entry_count())?;
// state.serialize_field("block_hashes_size", &self.blocks_by_hash.weighted_size())?;
// state.serialize_field("block_numbers_count", &self.blocks_by_number.entry_count())?;
// state.serialize_field("block_numbers_size", &self.blocks_by_number.weighted_size())?;
state.serialize_field("blocks_by_hash", &self.blocks_by_hash)?;
state.serialize_field("blocks_by_number", &self.blocks_by_number)?;
state.end()
}
}