![](/_next/image?url=%2Fimages%2Fgradient-top-bg.png&w=1920&q=75)
use super::*; #[derive(Copy, Clone, Debug, Display, FromStr, Ord, Eq, Serialize, PartialEq, PartialOrd)] pub(crate) struct Height(pub(crate) u32); impl Height { pub(crate) fn n(self) -> u32 { self.0 } pub(crate) fn subsidy(self) -> u64 { Epoch::from(self).subsidy() } pub(crate) fn starting_sat(self) -> Sat { let epoch = Epoch::from(self); let epoch_starting_sat = epoch.starting_sat(); let epoch_starting_height = epoch.starting_height(); epoch_starting_sat + u64::from(self.n() - epoch_starting_height.n()) * epoch.subsidy() } pub(crate) fn period_offset(self) -> u32 { self.0 % DIFFCHANGE_INTERVAL } } impl Add<u32> for Height { type Output = Self; fn add(self, other: u32) -> Height { Self(self.0 + other) } } impl Sub<u32> for Height { type Output = Self; fn sub(self, other: u32) -> Height { Self(self.0 - other) } } impl PartialEq<u32> for Height { fn eq(&self, other: &u32) -> bool { self.0 == *other } } #[cfg(test)] mod tests { use super::*;
Inscription #44969774
Collection
Ord
Owner
bc1pruyq7w...w4asvsdlskID
2808d4dab0...515590c5i0
Detail
History
Sign Up for our Newsletter
And be the first to know about any updates!