global: big snapshot

This commit is contained in:
nym21
2026-03-13 12:47:01 +01:00
parent c83955eea7
commit 2b31c7f6b7
158 changed files with 4961 additions and 6939 deletions

View File

@@ -22,11 +22,8 @@ impl Vecs {
starting_indexes: &Indexes,
exit: &Exit,
) -> Result<()> {
let window_starts = blocks.lookback.window_starts();
self.sent_sum.compute(
starting_indexes.height,
&window_starts,
prices,
exit,
|sats_vec| {
@@ -43,7 +40,6 @@ impl Vecs {
self.received_sum.compute(
starting_indexes.height,
&window_starts,
prices,
exit,
|sats_vec| {
@@ -57,16 +53,6 @@ impl Vecs {
},
)?;
// Annualized volume: rolling 1y sum of per-block sent volume
self.annualized.sats.height.compute_rolling_sum(
starting_indexes.height,
&blocks.lookback._1y,
&self.sent_sum.sats,
exit,
)?;
self.annualized
.compute(prices, starting_indexes.height, exit)?;
self.tx_per_sec
.height
.compute_binary::<_, Timestamp, PerSec>(

View File

@@ -5,7 +5,7 @@ use vecdb::Database;
use super::Vecs;
use crate::{
indexes,
internal::{AmountPerBlock, AmountPerBlockRolling, ComputedPerBlock},
internal::{AmountPerBlockCumulativeWithSums, CachedWindowStarts, ComputedPerBlock},
};
impl Vecs {
@@ -13,21 +13,23 @@ impl Vecs {
db: &Database,
version: Version,
indexes: &indexes::Vecs,
cached_starts: &CachedWindowStarts,
) -> Result<Self> {
let v2 = Version::TWO;
Ok(Self {
sent_sum: AmountPerBlockRolling::forced_import(db, "sent_sum", version, indexes)?,
received_sum: AmountPerBlockRolling::forced_import(
sent_sum: AmountPerBlockCumulativeWithSums::forced_import(
db,
"sent_sum",
version,
indexes,
cached_starts,
)?,
received_sum: AmountPerBlockCumulativeWithSums::forced_import(
db,
"received_sum",
version,
indexes,
)?,
annualized: AmountPerBlock::forced_import(
db,
"annualized_volume",
version,
indexes,
cached_starts,
)?,
tx_per_sec: ComputedPerBlock::forced_import(db, "tx_per_sec", version + v2, indexes)?,
outputs_per_sec: ComputedPerBlock::forced_import(

View File

@@ -2,13 +2,12 @@ use brk_traversable::Traversable;
use brk_types::StoredF32;
use vecdb::{Rw, StorageMode};
use crate::internal::{AmountPerBlock, AmountPerBlockRolling, ComputedPerBlock};
use crate::internal::{AmountPerBlockCumulativeWithSums, ComputedPerBlock};
#[derive(Traversable)]
pub struct Vecs<M: StorageMode = Rw> {
pub sent_sum: AmountPerBlockRolling<M>,
pub received_sum: AmountPerBlockRolling<M>,
pub annualized: AmountPerBlock<M>,
pub sent_sum: AmountPerBlockCumulativeWithSums<M>,
pub received_sum: AmountPerBlockCumulativeWithSums<M>,
pub tx_per_sec: ComputedPerBlock<StoredF32, M>,
pub outputs_per_sec: ComputedPerBlock<StoredF32, M>,
pub inputs_per_sec: ComputedPerBlock<StoredF32, M>,