global: snapshot

This commit is contained in:
nym21
2026-04-14 22:53:10 +02:00
parent 904ec93668
commit 39da441d14
57 changed files with 2886 additions and 1668 deletions

View File

@@ -85,8 +85,17 @@ impl Vecs {
.compute_rest(starting_indexes.height, exit)?;
}
for (otype, source) in self.input_count.by_type.iter_typed() {
self.input_share.get_mut(otype).compute_count_ratio(
source,
&self.input_count.all,
starting_indexes.height,
exit,
)?;
}
for (otype, source) in self.tx_count.by_type.iter_typed() {
self.tx_percent.get_mut(otype).compute_count_ratio(
self.tx_share.get_mut(otype).compute_count_ratio(
source,
&self.tx_count.all,
starting_indexes.height,

View File

@@ -39,18 +39,28 @@ impl Vecs {
cached_starts,
)?;
let tx_percent = SpendableType::try_new(|_, name| {
let input_share = SpendableType::try_new(|_, name| {
PercentCumulativeRolling::forced_import(
db,
&format!("tx_percent_with_{name}_prevout"),
&format!("{name}_prevout_share"),
version,
indexes,
)
})?;
let tx_share = SpendableType::try_new(|_, name| {
PercentCumulativeRolling::forced_import(
db,
&format!("tx_share_with_{name}_prevout"),
version,
indexes,
)
})?;
Ok(Self {
input_count,
input_share,
tx_count,
tx_percent,
tx_share,
})
}
}

View File

@@ -9,6 +9,7 @@ use crate::internal::{PerBlockCumulativeRolling, PercentCumulativeRolling};
#[derive(Traversable)]
pub struct Vecs<M: StorageMode = Rw> {
pub input_count: WithInputTypes<PerBlockCumulativeRolling<StoredU64, StoredU64, M>>,
pub input_share: SpendableType<PercentCumulativeRolling<BasisPoints16, M>>,
pub tx_count: WithInputTypes<PerBlockCumulativeRolling<StoredU64, StoredU64, M>>,
pub tx_percent: SpendableType<PercentCumulativeRolling<BasisPoints16, M>>,
pub tx_share: SpendableType<PercentCumulativeRolling<BasisPoints16, M>>,
}