mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-01 09:59:59 -07:00
global: snapshot
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user