mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-25 23:29:58 -07:00
global: snapshot
This commit is contained in:
@@ -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,
|
||||
)?;
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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>,
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ impl Vecs {
|
||||
self.size.compute(
|
||||
starting_indexes.height,
|
||||
&window_starts,
|
||||
&indexer.vecs.blocks.total_size,
|
||||
&indexer.vecs.blocks.total,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user