global: refactor

This commit is contained in:
nym21
2026-04-22 22:23:39 +02:00
parent c5b16e7048
commit 84e924b77e
63 changed files with 726 additions and 257 deletions
@@ -6,7 +6,7 @@ use super::Vecs;
use crate::{
indexes,
internal::{
AmountPerBlockCumulative, AmountPerBlockCumulativeRolling, AmountPerBlockFull,
ValuePerBlockCumulative, ValuePerBlockCumulativeRolling, ValuePerBlockFull,
LazyPercentCumulativeRolling, OneMinusBp16, PercentCumulativeRolling, RatioRollingWindows,
WindowStartVec, Windows,
},
@@ -29,23 +29,23 @@ impl Vecs {
);
Ok(Self {
coinbase: AmountPerBlockCumulativeRolling::forced_import(
coinbase: ValuePerBlockCumulativeRolling::forced_import(
db,
"coinbase",
version,
indexes,
cached_starts,
)?,
subsidy: AmountPerBlockCumulativeRolling::forced_import(
subsidy: ValuePerBlockCumulativeRolling::forced_import(
db,
"subsidy",
version,
indexes,
cached_starts,
)?,
fees: AmountPerBlockFull::forced_import(db, "fees", version, indexes, cached_starts)?,
fees: ValuePerBlockFull::forced_import(db, "fees", version, indexes, cached_starts)?,
output_volume: EagerVec::forced_import(db, "output_volume", version)?,
unclaimed: AmountPerBlockCumulative::forced_import(
unclaimed: ValuePerBlockCumulative::forced_import(
db,
"unclaimed_rewards",
version,
@@ -3,17 +3,17 @@ use brk_types::{BasisPoints16, BasisPoints32, Height, Sats};
use vecdb::{EagerVec, PcoVec, Rw, StorageMode};
use crate::internal::{
AmountPerBlockCumulative, AmountPerBlockCumulativeRolling, AmountPerBlockFull,
ValuePerBlockCumulative, ValuePerBlockCumulativeRolling, ValuePerBlockFull,
LazyPercentCumulativeRolling, PercentCumulativeRolling, RatioRollingWindows,
};
#[derive(Traversable)]
pub struct Vecs<M: StorageMode = Rw> {
pub coinbase: AmountPerBlockCumulativeRolling<M>,
pub subsidy: AmountPerBlockCumulativeRolling<M>,
pub fees: AmountPerBlockFull<M>,
pub coinbase: ValuePerBlockCumulativeRolling<M>,
pub subsidy: ValuePerBlockCumulativeRolling<M>,
pub fees: ValuePerBlockFull<M>,
pub output_volume: M::Stored<EagerVec<PcoVec<Height, Sats>>>,
pub unclaimed: AmountPerBlockCumulative<M>,
pub unclaimed: ValuePerBlockCumulative<M>,
#[traversable(wrap = "fees", rename = "dominance")]
pub fee_dominance: PercentCumulativeRolling<BasisPoints16, M>,
#[traversable(wrap = "subsidy", rename = "dominance")]