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
+9 -5
View File
@@ -1,13 +1,15 @@
use brk_error::Result;
use brk_traversable::Traversable;
use brk_types::{BasisPoints16, Height, Indexes, PoolSlug, StoredU32};
use brk_types::{BasisPoints16, Height, Indexes, PoolSlug, StoredU32, StoredU64};
use vecdb::{
Database, Exit, ReadableVec, Rw, StorageMode, Version,
};
use crate::{
blocks, indexes,
internal::{ComputedPerBlockCumulative, PercentPerBlock, RatioU32Bp16},
internal::{
CachedWindowStarts, ComputedPerBlockCumulativeWithSums, PercentPerBlock, RatioU64Bp16,
},
};
#[derive(Traversable)]
@@ -15,7 +17,7 @@ pub struct Vecs<M: StorageMode = Rw> {
#[traversable(skip)]
slug: PoolSlug,
pub blocks_mined: ComputedPerBlockCumulative<StoredU32, M>,
pub blocks_mined: ComputedPerBlockCumulativeWithSums<StoredU32, StoredU64, M>,
pub dominance: PercentPerBlock<BasisPoints16, M>,
}
@@ -25,14 +27,16 @@ impl Vecs {
slug: PoolSlug,
version: Version,
indexes: &indexes::Vecs,
cached_starts: &CachedWindowStarts,
) -> Result<Self> {
let suffix = |s: &str| format!("{}_{s}", slug);
let blocks_mined = ComputedPerBlockCumulative::forced_import(
let blocks_mined = ComputedPerBlockCumulativeWithSums::forced_import(
db,
&suffix("blocks_mined"),
version,
indexes,
cached_starts,
)?;
let dominance =
@@ -73,7 +77,7 @@ impl Vecs {
})?;
self.dominance
.compute_binary::<StoredU32, StoredU32, RatioU32Bp16>(
.compute_binary::<StoredU64, StoredU64, RatioU64Bp16>(
starting_indexes.height,
&self.blocks_mined.cumulative.height,
&blocks.count.total.cumulative.height,