From 2d6b5e5cd207e5f1dc9ce3e2fd428e61ac2ff8eb Mon Sep 17 00:00:00 2001 From: sprites0 <199826320+sprites0@users.noreply.github.com> Date: Fri, 1 Aug 2025 17:28:31 +0000 Subject: [PATCH] chore: Improve log --- src/pseudo_peer/sources/hl_node.rs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/pseudo_peer/sources/hl_node.rs b/src/pseudo_peer/sources/hl_node.rs index babf2fdbe..30bbe67c6 100644 --- a/src/pseudo_peer/sources/hl_node.rs +++ b/src/pseudo_peer/sources/hl_node.rs @@ -7,8 +7,8 @@ use std::{ }; use futures::future::BoxFuture; -use reth_network::cache::LruMap; use rangemap::RangeInclusiveMap; +use reth_network::cache::LruMap; use serde::Deserialize; use time::{macros::format_description, Date, Duration, OffsetDateTime, Time}; use tokio::sync::Mutex; @@ -33,10 +33,7 @@ impl LocalBlocksCache { const CACHE_SIZE: u32 = 8000; fn new() -> Self { - Self { - cache: LruMap::new(Self::CACHE_SIZE), - ranges: RangeInclusiveMap::new(), - } + Self { cache: LruMap::new(Self::CACHE_SIZE), ranges: RangeInclusiveMap::new() } } fn load_scan_result(&mut self, scan_result: ScanResult) { @@ -280,7 +277,19 @@ impl HlNodeBlockSource { scan_result.new_blocks.clear(); u_cache.load_scan_result(scan_result); } - info!("Backfilled {} blocks", u_cache.cache.len()); + + if u_cache.ranges.is_empty() { + warn!("No ranges found in {:?}", root); + } else { + let (min, _) = u_cache.ranges.first_range_value().unwrap(); + let (max, _) = u_cache.ranges.last_range_value().unwrap(); + info!( + "Populated {} ranges (min: {}, max: {})", + u_cache.ranges.len(), + min.start(), + max.end() + ); + } Ok(()) }