global: snapshot

This commit is contained in:
nym21
2026-03-10 23:24:18 +01:00
parent 6a728a3357
commit c5d63b3090
75 changed files with 873 additions and 791 deletions

View File

@@ -16,24 +16,24 @@ impl Vecs {
exit: &Exit,
) -> Result<()> {
// Block count raw + cumulative
self.block_count.raw.height.compute_range(
self.total.raw.height.compute_range(
starting_indexes.height,
&indexer.vecs.blocks.weight,
|h| (h, StoredU32::from(1_u32)),
exit,
)?;
self.block_count.cumulative.height.compute_cumulative(
self.total.cumulative.height.compute_cumulative(
starting_indexes.height,
&self.block_count.raw.height,
&self.total.raw.height,
exit,
)?;
// Rolling window block counts
let ws = lookback.window_starts();
self.block_count.sum.compute_rolling_sum(
self.total.sum.compute_rolling_sum(
starting_indexes.height,
&ws,
&self.block_count.raw.height,
&self.total.raw.height,
exit,
)?;

View File

@@ -15,12 +15,12 @@ impl Vecs {
indexes: &indexes::Vecs,
) -> Result<Self> {
Ok(Self {
block_count_target: ConstantVecs::new::<BlockCountTarget>(
target: ConstantVecs::new::<BlockCountTarget>(
"block_count_target",
version,
indexes,
),
block_count: ComputedPerBlockCumulativeSum::forced_import(
total: ComputedPerBlockCumulativeSum::forced_import(
db,
"block_count",
version,

View File

@@ -6,6 +6,6 @@ use crate::internal::{ComputedPerBlockCumulativeSum, ConstantVecs};
#[derive(Traversable)]
pub struct Vecs<M: StorageMode = Rw> {
pub block_count_target: ConstantVecs<StoredU64>,
pub block_count: ComputedPerBlockCumulativeSum<StoredU32, M>,
pub target: ConstantVecs<StoredU64>,
pub total: ComputedPerBlockCumulativeSum<StoredU32, M>,
}

View File

@@ -31,7 +31,7 @@ impl Vecs {
self.size.compute(
starting_indexes.height,
&window_starts,
&indexer.vecs.blocks.total_size,
&indexer.vecs.blocks.total,
exit,
)?;