Epoch(22) } else if sat < Self::STARTING_SATS[24] { Epoch(23) } else if sat < Self::STARTING_SATS[25] { Epoch(24) } else if sat < Self::STARTING_SATS[26] { Epoch(25) } else if sat < Self::STARTING_SATS[27] { Epoch(26) } else if sat < Self::STARTING_SATS[28] { Epoch(27) } else if sat < Self::STARTING_SATS[29] { Epoch(28) } else if sat < Self::STARTING_SATS[30] { Epoch(29) } else if sat < Self::STARTING_SATS[31] { Epoch(30) } else if sat < Self::STARTING_SATS[32] { Epoch(31) } else if sat < Self::STARTING_SATS[33] { Epoch(32) } else { Epoch(33) } } } impl From for Epoch { fn from(height: Height) -> Self { Self(height.0 / SUBSIDY_HALVING_INTERVAL) } } #[cfg(test)] mod tests { use super::super::*; #[test] fn starting_sat() { assert_eq!(Epoch(0).starting_sat(), 0); assert_eq!( Epoch(1).starting_sat(), Epoch(0).subsidy() * u64::from(SUBSIDY_HALVING_INTERVAL)