global: snapshot

This commit is contained in:
nym21
2026-03-10 11:53:46 +01:00
parent 5ede3dc416
commit 8f93a5947e
16 changed files with 2123 additions and 2015 deletions
@@ -100,8 +100,10 @@ impl<R: RealizedOps> CohortState<R> {
}
pub(crate) fn reset_single_iteration_values(&mut self) {
self.sent = Sats::ZERO;
self.satdays_destroyed = Sats::ZERO;
if R::TRACK_ACTIVITY {
self.sent = Sats::ZERO;
self.satdays_destroyed = Sats::ZERO;
}
self.realized.reset_single_iteration_values();
}
@@ -198,8 +200,10 @@ impl<R: RealizedOps> CohortState<R> {
pre: &SendPrecomputed,
) {
self.supply -= supply;
self.sent += pre.sats;
self.satdays_destroyed += pre.age.satdays_destroyed(pre.sats);
if R::TRACK_ACTIVITY {
self.sent += pre.sats;
self.satdays_destroyed += pre.age.satdays_destroyed(pre.sats);
}
self.realized
.send(pre.sats, pre.current_ps, pre.prev_ps, pre.ath_ps, pre.prev_investor_cap);
@@ -241,8 +245,10 @@ impl<R: RealizedOps> CohortState<R> {
self.supply -= supply;
if supply.value > Sats::ZERO {
self.sent += supply.value;
self.satdays_destroyed += age.satdays_destroyed(supply.value);
if R::TRACK_ACTIVITY {
self.sent += supply.value;
self.satdays_destroyed += age.satdays_destroyed(supply.value);
}
let sats = supply.value;
@@ -4,6 +4,7 @@ use brk_types::{Cents, CentsSats, CentsSquaredSats, Sats};
/// Trait for realized state operations, implemented by Minimal, Core, and Full variants.
pub trait RealizedOps: Default + Clone + Send + Sync + 'static {
const TRACK_ACTIVITY: bool = false;
fn cap(&self) -> Cents;
fn profit(&self) -> Cents;
fn loss(&self) -> Cents;
@@ -159,6 +160,8 @@ pub struct CoreRealizedState {
}
impl RealizedOps for CoreRealizedState {
const TRACK_ACTIVITY: bool = true;
#[inline]
fn cap(&self) -> Cents {
self.minimal.cap()
@@ -273,6 +276,8 @@ pub struct RealizedState {
}
impl RealizedOps for RealizedState {
const TRACK_ACTIVITY: bool = true;
#[inline]
fn cap(&self) -> Cents {
self.core.cap()