computer: snapshot

This commit is contained in:
nym21
2026-03-09 11:16:50 +01:00
parent 0bff57fb43
commit 3e8cf4a975
92 changed files with 853 additions and 825 deletions

View File

@@ -22,7 +22,7 @@ impl Vecs {
starting_indexes: &Indexes,
exit: &Exit,
) -> Result<()> {
let window_starts = blocks.count.window_starts();
let window_starts = blocks.lookback.window_starts();
self.sent_sum.compute(
starting_indexes.height,
@@ -60,7 +60,7 @@ impl Vecs {
// Annualized volume: rolling 1y sum of per-block sent volume
self.annualized_volume.sats.height.compute_rolling_sum(
starting_indexes.height,
&blocks.count.height_1y_ago,
&blocks.lookback.height_1y_ago,
&self.sent_sum.sats,
exit,
)?;

View File

@@ -5,7 +5,7 @@ use vecdb::Database;
use super::Vecs;
use crate::{
indexes,
internal::{ComputedFromHeight, ValueFromHeight, ValueFromHeightRolling},
internal::{AmountFromHeight, AmountFromHeightRolling, ComputedFromHeight},
};
impl Vecs {
@@ -16,14 +16,14 @@ impl Vecs {
) -> Result<Self> {
let v2 = Version::TWO;
Ok(Self {
sent_sum: ValueFromHeightRolling::forced_import(db, "sent_sum", version, indexes)?,
received_sum: ValueFromHeightRolling::forced_import(
sent_sum: AmountFromHeightRolling::forced_import(db, "sent_sum", version, indexes)?,
received_sum: AmountFromHeightRolling::forced_import(
db,
"received_sum",
version,
indexes,
)?,
annualized_volume: ValueFromHeight::forced_import(
annualized_volume: AmountFromHeight::forced_import(
db,
"annualized_volume",
version,

View File

@@ -2,13 +2,13 @@ use brk_traversable::Traversable;
use brk_types::StoredF32;
use vecdb::{Rw, StorageMode};
use crate::internal::{ComputedFromHeight, ValueFromHeight, ValueFromHeightRolling};
use crate::internal::{AmountFromHeight, AmountFromHeightRolling, ComputedFromHeight};
#[derive(Traversable)]
pub struct Vecs<M: StorageMode = Rw> {
pub sent_sum: ValueFromHeightRolling<M>,
pub received_sum: ValueFromHeightRolling<M>,
pub annualized_volume: ValueFromHeight<M>,
pub sent_sum: AmountFromHeightRolling<M>,
pub received_sum: AmountFromHeightRolling<M>,
pub annualized_volume: AmountFromHeight<M>,
pub tx_per_sec: ComputedFromHeight<StoredF32, M>,
pub outputs_per_sec: ComputedFromHeight<StoredF32, M>,
pub inputs_per_sec: ComputedFromHeight<StoredF32, M>,