global: snapshot

This commit is contained in:
nym21
2026-03-04 17:10:15 +01:00
parent 891f0dad9e
commit 9e23de4ba1
313 changed files with 9087 additions and 4918 deletions
@@ -43,12 +43,14 @@ impl Vecs {
)?;
// Compute blocks before next adjustment
self.blocks_before_next_adjustment.height.compute_transform(
starting_indexes.height,
&indexes.height.identity,
|(h, ..)| (h, StoredU32::from(h.left_before_next_diff_adj())),
exit,
)?;
self.blocks_before_next_adjustment
.height
.compute_transform(
starting_indexes.height,
&indexes.height.identity,
|(h, ..)| (h, StoredU32::from(h.left_before_next_diff_adj())),
exit,
)?;
// Compute days before next adjustment
self.days_before_next_adjustment.height.compute_transform(
@@ -26,7 +26,12 @@ impl Vecs {
indexes,
),
as_hash: ComputedFromHeight::forced_import(db, "difficulty_as_hash", version, indexes)?,
adjustment: PercentFromHeight::forced_import(db, "difficulty_adjustment", version, indexes)?,
adjustment: PercentFromHeight::forced_import(
db,
"difficulty_adjustment",
version,
indexes,
)?,
epoch: ComputedFromHeight::forced_import(db, "difficulty_epoch", version, indexes)?,
blocks_before_next_adjustment: ComputedFromHeight::forced_import(
db,
@@ -3,8 +3,6 @@ use brk_types::{BasisPointsSigned32, DifficultyEpoch, StoredF32, StoredF64, Stor
use vecdb::{Rw, StorageMode};
use crate::internal::{ComputedFromHeight, ComputedHeightDerived, PercentFromHeight};
/// Difficulty metrics: raw difficulty, derived stats, adjustment, and countdown
#[derive(Traversable)]
pub struct Vecs<M: StorageMode = Rw> {
pub raw: ComputedHeightDerived<StoredF64>,