global: snapshot

This commit is contained in:
nym21
2026-03-18 21:04:08 +01:00
parent 24f344c0b1
commit 92e1a0ccaf
39 changed files with 819 additions and 1912 deletions

View File

@@ -97,24 +97,17 @@ impl Vecs {
)?;
self.subsidy.compute(prices, starting_indexes.height, exit)?;
self.unclaimed.compute(
self.unclaimed.base.sats.height.compute_transform(
starting_indexes.height,
prices,
exit,
|vec| {
vec.compute_transform(
starting_indexes.height,
&self.subsidy.base.sats.height,
|(height, subsidy, ..)| {
let halving = Halving::from(height);
let expected = Sats::FIFTY_BTC / 2_usize.pow(halving.to_usize() as u32);
(height, expected.checked_sub(subsidy).unwrap())
},
exit,
)?;
Ok(())
&self.subsidy.base.sats.height,
|(height, subsidy, ..)| {
let halving = Halving::from(height);
let expected = Sats::FIFTY_BTC / 2_usize.pow(halving.to_usize() as u32);
(height, expected.checked_sub(subsidy).unwrap())
},
exit,
)?;
self.unclaimed.compute(prices, starting_indexes.height, exit)?;
self.fee_dominance
.compute_binary::<Sats, Sats, RatioSatsBp16>(

View File

@@ -38,12 +38,11 @@ impl Vecs {
)?,
subsidy: AmountPerBlockCumulative::forced_import(db, "subsidy", version, indexes)?,
fees: AmountPerBlockFull::forced_import(db, "fees", version, indexes, cached_starts)?,
unclaimed: AmountPerBlockCumulativeWithSums::forced_import(
unclaimed: AmountPerBlockCumulative::forced_import(
db,
"unclaimed_rewards",
version,
indexes,
cached_starts,
)?,
fee_dominance: PercentPerBlock::forced_import(db, "fee_dominance", version, indexes)?,
fee_dominance_rolling,

View File

@@ -13,7 +13,7 @@ pub struct Vecs<M: StorageMode = Rw> {
pub coinbase: AmountPerBlockCumulativeWithSums<M>,
pub subsidy: AmountPerBlockCumulative<M>,
pub fees: AmountPerBlockFull<M>,
pub unclaimed: AmountPerBlockCumulativeWithSums<M>,
pub unclaimed: AmountPerBlockCumulative<M>,
#[traversable(wrap = "fees", rename = "dominance")]
pub fee_dominance: PercentPerBlock<BasisPoints16, M>,
#[traversable(wrap = "fees", rename = "dominance")]