computer: simplified a bunch of things

This commit is contained in:
nym21
2026-02-26 19:37:22 +01:00
parent 9e4fe62de2
commit cccaf6b206
252 changed files with 3788 additions and 7279 deletions

View File

@@ -1,6 +1,6 @@
use brk_error::Result;
use brk_types::{Day1, DifficultyEntry, HashrateEntry, HashrateSummary, Height, TimePeriod};
use vecdb::{ReadableVec, VecIndex};
use vecdb::{ReadableOptionVec, ReadableVec, VecIndex};
use super::epochs::iter_difficulty_epochs;
use crate::Query;
@@ -27,8 +27,8 @@ impl Query {
.hashrate
.hash_rate
.day1
.collect_one(current_day1)
.unwrap() as u128;
.collect_one_flat(current_day1)
.unwrap_or_default() as u128;
// Calculate start height based on time period
let end = current_height.to_usize();
@@ -61,11 +61,11 @@ impl Query {
while di <= end_day1.to_usize() {
let day1 = Day1::from(di);
if let (Some(hr), Some(timestamp)) =
(hashrate_vec.collect_one(day1), timestamp_vec.collect_one(day1))
(hashrate_vec.collect_one_flat(day1), timestamp_vec.collect_one(day1))
{
hashrates.push(HashrateEntry {
timestamp,
avg_hashrate: (*hr) as u128,
avg_hashrate: *hr as u128,
});
}
di += step;