pub struct ChainClock {
pub tip: u64,
pub block_seconds: u64,
}Expand description
Block timing of one chain, for converting durations into heights.
Fields§
§tip: u64Current tip height.
block_seconds: u64Average seconds per block (Torvyon mainnet 20, testnet 60).
Implementations§
Source§impl ChainClock
impl ChainClock
Sourcepub fn height_after(&self, seconds: u64) -> u64
pub fn height_after(&self, seconds: u64) -> u64
Height reached about seconds from now (rounded up).
Sourcepub fn seconds_until(&self, height: u64) -> u64
pub fn seconds_until(&self, height: u64) -> u64
Estimated seconds until height (0 if already reached).
Trait Implementations§
Source§impl Clone for ChainClock
impl Clone for ChainClock
impl Copy for ChainClock
Source§impl Debug for ChainClock
impl Debug for ChainClock
impl Eq for ChainClock
Source§impl PartialEq for ChainClock
impl PartialEq for ChainClock
impl StructuralPartialEq for ChainClock
Auto Trait Implementations§
impl Freeze for ChainClock
impl RefUnwindSafe for ChainClock
impl Send for ChainClock
impl Sync for ChainClock
impl Unpin for ChainClock
impl UnsafeUnpin for ChainClock
impl UnwindSafe for ChainClock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more