pub struct SampledWindowManager<T: GhostdagStoreReader, U: BlockWindowCacheReader, V: HeaderStoreReader, W: DaaStoreReader> { /* private fields */ }Expand description
A sampled window manager implementing KIP-0004
Implementations§
Source§impl<T: GhostdagStoreReader, U: BlockWindowCacheReader, V: HeaderStoreReader, W: DaaStoreReader> SampledWindowManager<T, U, V, W>
impl<T: GhostdagStoreReader, U: BlockWindowCacheReader, V: HeaderStoreReader, W: DaaStoreReader> SampledWindowManager<T, U, V, W>
pub fn new( genesis: &GenesisBlock, ghostdag_store: Arc<T>, headers_store: Arc<V>, daa_store: Arc<W>, block_window_cache_for_difficulty: Arc<U>, block_window_cache_for_past_median_time: Arc<U>, max_difficulty_target: Uint256, target_time_per_block: u64, sampling_activation_daa_score: u64, difficulty_window_size: usize, min_difficulty_window_len: usize, difficulty_sample_rate: u64, past_median_time_window_size: usize, past_median_time_sample_rate: u64, ) -> Self
Trait Implementations§
Source§impl<T: Clone + GhostdagStoreReader, U: Clone + BlockWindowCacheReader, V: Clone + HeaderStoreReader, W: Clone + DaaStoreReader> Clone for SampledWindowManager<T, U, V, W>
impl<T: Clone + GhostdagStoreReader, U: Clone + BlockWindowCacheReader, V: Clone + HeaderStoreReader, W: Clone + DaaStoreReader> Clone for SampledWindowManager<T, U, V, W>
Source§fn clone(&self) -> SampledWindowManager<T, U, V, W>
fn clone(&self) -> SampledWindowManager<T, U, V, W>
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: GhostdagStoreReader, U: BlockWindowCacheReader, V: HeaderStoreReader, W: DaaStoreReader> WindowManager for SampledWindowManager<T, U, V, W>
impl<T: GhostdagStoreReader, U: BlockWindowCacheReader, V: HeaderStoreReader, W: DaaStoreReader> WindowManager for SampledWindowManager<T, U, V, W>
fn block_window( &self, ghostdag_data: &GhostdagData, window_type: WindowType, ) -> Result<Arc<BlockWindowHeap>, RuleError>
fn calc_daa_window( &self, ghostdag_data: &GhostdagData, window: Arc<BlockWindowHeap>, ) -> DaaWindow
fn block_daa_window( &self, ghostdag_data: &GhostdagData, ) -> Result<DaaWindow, RuleError>
fn calculate_difficulty_bits( &self, _high_ghostdag_data: &GhostdagData, daa_window: &DaaWindow, ) -> u32
fn calc_past_median_time( &self, ghostdag_data: &GhostdagData, ) -> Result<(u64, Arc<BlockWindowHeap>), RuleError>
fn estimate_network_hashes_per_second( &self, window: Arc<BlockWindowHeap>, ) -> DifficultyResult<u64>
fn window_size( &self, _ghostdag_data: &GhostdagData, window_type: WindowType, ) -> usize
fn sample_rate( &self, _ghostdag_data: &GhostdagData, window_type: WindowType, ) -> u64
Auto Trait Implementations§
impl<T, U, V, W> Freeze for SampledWindowManager<T, U, V, W>
impl<T, U, V, W> RefUnwindSafe for SampledWindowManager<T, U, V, W>
impl<T, U, V, W> Send for SampledWindowManager<T, U, V, W>
impl<T, U, V, W> Sync for SampledWindowManager<T, U, V, W>
impl<T, U, V, W> Unpin for SampledWindowManager<T, U, V, W>
impl<T, U, V, W> UnwindSafe for SampledWindowManager<T, U, V, W>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<S> CastArc for Swhere
S: CastFromSync + ?Sized,
impl<S> CastArc for Swhere
S: CastFromSync + ?Sized,
Source§impl<T> CastFrom for Twhere
T: Any + 'static,
impl<T> CastFrom for Twhere
T: Any + 'static,
Source§fn ref_any(&self) -> &(dyn Any + 'static)
fn ref_any(&self) -> &(dyn Any + 'static)
Returns a immutable reference to
Any, which is backed by the type implementing this trait.Source§fn mut_any(&mut self) -> &mut (dyn Any + 'static)
fn mut_any(&mut self) -> &mut (dyn Any + 'static)
Returns a mutable reference to
Any, which is backed by the type implementing this trait.Source§impl<T> CastFromSync for T
impl<T> CastFromSync for T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more