mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-03 23:33:40 -07:00
global: snapshot
This commit is contained in:
@@ -6,7 +6,7 @@ use vecdb::{Database, ReadableCloneableVec};
|
||||
use super::Vecs;
|
||||
use crate::{
|
||||
indexes,
|
||||
internal::{ComputedFromHeightLast, ComputedHeightDerivedLast},
|
||||
internal::{ComputedFromHeight, ComputedHeightDerived},
|
||||
};
|
||||
|
||||
impl Vecs {
|
||||
@@ -19,22 +19,22 @@ impl Vecs {
|
||||
let v2 = Version::TWO;
|
||||
|
||||
Ok(Self {
|
||||
raw: ComputedHeightDerivedLast::forced_import(
|
||||
raw: ComputedHeightDerived::forced_import(
|
||||
"difficulty",
|
||||
indexer.vecs.blocks.difficulty.read_only_boxed_clone(),
|
||||
version,
|
||||
indexes,
|
||||
),
|
||||
as_hash: ComputedFromHeightLast::forced_import(db, "difficulty_as_hash", version, indexes)?,
|
||||
adjustment: ComputedFromHeightLast::forced_import(db, "difficulty_adjustment", version, indexes)?,
|
||||
epoch: ComputedFromHeightLast::forced_import(db, "difficulty_epoch", version, indexes)?,
|
||||
blocks_before_next_adjustment: ComputedFromHeightLast::forced_import(
|
||||
as_hash: ComputedFromHeight::forced_import(db, "difficulty_as_hash", version, indexes)?,
|
||||
adjustment: ComputedFromHeight::forced_import(db, "difficulty_adjustment", version, indexes)?,
|
||||
epoch: ComputedFromHeight::forced_import(db, "difficulty_epoch", version, indexes)?,
|
||||
blocks_before_next_adjustment: ComputedFromHeight::forced_import(
|
||||
db,
|
||||
"blocks_before_next_difficulty_adjustment",
|
||||
version + v2,
|
||||
indexes,
|
||||
)?,
|
||||
days_before_next_adjustment: ComputedFromHeightLast::forced_import(
|
||||
days_before_next_adjustment: ComputedFromHeight::forced_import(
|
||||
db,
|
||||
"days_before_next_difficulty_adjustment",
|
||||
version + v2,
|
||||
|
||||
@@ -2,15 +2,15 @@ use brk_traversable::Traversable;
|
||||
use brk_types::{DifficultyEpoch, StoredF32, StoredF64, StoredU32};
|
||||
use vecdb::{Rw, StorageMode};
|
||||
|
||||
use crate::internal::{ComputedFromHeightLast, ComputedHeightDerivedLast};
|
||||
use crate::internal::{ComputedFromHeight, ComputedHeightDerived};
|
||||
|
||||
/// Difficulty metrics: raw difficulty, derived stats, adjustment, and countdown
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub raw: ComputedHeightDerivedLast<StoredF64>,
|
||||
pub as_hash: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub adjustment: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub epoch: ComputedFromHeightLast<DifficultyEpoch, M>,
|
||||
pub blocks_before_next_adjustment: ComputedFromHeightLast<StoredU32, M>,
|
||||
pub days_before_next_adjustment: ComputedFromHeightLast<StoredF32, M>,
|
||||
pub raw: ComputedHeightDerived<StoredF64>,
|
||||
pub as_hash: ComputedFromHeight<StoredF32, M>,
|
||||
pub adjustment: ComputedFromHeight<StoredF32, M>,
|
||||
pub epoch: ComputedFromHeight<DifficultyEpoch, M>,
|
||||
pub blocks_before_next_adjustment: ComputedFromHeight<StoredU32, M>,
|
||||
pub days_before_next_adjustment: ComputedFromHeight<StoredF32, M>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user