mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-21 16:08:10 -07:00
65 lines
1.9 KiB
Rust
65 lines
1.9 KiB
Rust
use brk_error::Result;
|
|
use brk_types::Version;
|
|
use vecdb::{Database, EagerVec, ImportableVec};
|
|
|
|
use super::Vecs;
|
|
use crate::{
|
|
indexes,
|
|
internal::{
|
|
LazyPercentCumulativeRolling, OneMinusPpm, PercentCumulativeRolling, RatioRollingWindows,
|
|
ValuePerBlockCumulative, ValuePerBlockCumulativeRolling, ValuePerBlockFull, WindowStartVec,
|
|
Windows,
|
|
},
|
|
};
|
|
|
|
impl Vecs {
|
|
pub(crate) fn forced_import(
|
|
db: &Database,
|
|
version: Version,
|
|
indexes: &indexes::Vecs,
|
|
cached_starts: &Windows<&WindowStartVec>,
|
|
) -> Result<Self> {
|
|
let fee_dominance =
|
|
PercentCumulativeRolling::forced_import(db, "fee_dominance", version, indexes)?;
|
|
|
|
let subsidy_dominance = LazyPercentCumulativeRolling::from_source::<OneMinusPpm>(
|
|
"subsidy_dominance",
|
|
version,
|
|
&fee_dominance,
|
|
);
|
|
|
|
Ok(Self {
|
|
coinbase: ValuePerBlockCumulativeRolling::forced_import(
|
|
db,
|
|
"coinbase",
|
|
version,
|
|
indexes,
|
|
cached_starts,
|
|
)?,
|
|
subsidy: ValuePerBlockCumulativeRolling::forced_import(
|
|
db,
|
|
"subsidy",
|
|
version,
|
|
indexes,
|
|
cached_starts,
|
|
)?,
|
|
fees: ValuePerBlockFull::forced_import(db, "fees", version, indexes, cached_starts)?,
|
|
output_volume: EagerVec::forced_import(db, "output_volume", version)?,
|
|
unclaimed: ValuePerBlockCumulative::forced_import(
|
|
db,
|
|
"unclaimed_rewards",
|
|
version,
|
|
indexes,
|
|
)?,
|
|
fee_dominance,
|
|
subsidy_dominance,
|
|
fee_to_subsidy_ratio: RatioRollingWindows::forced_import(
|
|
db,
|
|
"fee_to_subsidy_ratio",
|
|
version,
|
|
indexes,
|
|
)?,
|
|
})
|
|
}
|
|
}
|