mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
fix(cli): handle case when first transaction range is None on reth db stats (#11107)
This commit is contained in:
@ -263,10 +263,18 @@ impl Command {
|
|||||||
|
|
||||||
let block_range =
|
let block_range =
|
||||||
SegmentRangeInclusive::new(first_ranges.0.start(), last_ranges.0.end());
|
SegmentRangeInclusive::new(first_ranges.0.start(), last_ranges.0.end());
|
||||||
let tx_range = first_ranges
|
|
||||||
.1
|
// Transaction ranges can be empty, so we need to find the first and last which are
|
||||||
.zip(last_ranges.1)
|
// not.
|
||||||
.map(|(first, last)| SegmentRangeInclusive::new(first.start(), last.end()));
|
let tx_range = {
|
||||||
|
let start = ranges
|
||||||
|
.iter()
|
||||||
|
.find_map(|(_, tx_range)| tx_range.map(|r| r.start()))
|
||||||
|
.unwrap_or_default();
|
||||||
|
let end =
|
||||||
|
ranges.iter().rev().find_map(|(_, tx_range)| tx_range.map(|r| r.end()));
|
||||||
|
end.map(|end| SegmentRangeInclusive::new(start, end))
|
||||||
|
};
|
||||||
|
|
||||||
let mut row = Row::new();
|
let mut row = Row::new();
|
||||||
row.add_cell(Cell::new(segment))
|
row.add_cell(Cell::new(segment))
|
||||||
|
|||||||
Reference in New Issue
Block a user