pub struct SampledDifficultyManager<T: HeaderStoreReader> { /* private fields */ }Expand description
A difficulty manager implementing KIP-0004, so based on sampled windows
Implementations§
Source§impl<T: HeaderStoreReader> SampledDifficultyManager<T>
impl<T: HeaderStoreReader> SampledDifficultyManager<T>
pub fn new( headers_store: Arc<T>, genesis_bits: u32, max_difficulty_target: Uint256, difficulty_window_size: usize, min_difficulty_window_len: usize, difficulty_sample_rate: u64, target_time_per_block: u64, ) -> Self
pub fn difficulty_full_window_size(&self) -> u64
Sourcepub fn lowest_daa_blue_score(&self, ghostdag_data: &GhostdagData) -> u64
pub fn lowest_daa_blue_score(&self, ghostdag_data: &GhostdagData) -> u64
Returns the DAA window lowest accepted blue score
pub fn calc_daa_score( &self, ghostdag_data: &GhostdagData, mergeset_non_daa: &BlockHashSet, ) -> u64
pub fn calc_daa_score_and_mergeset_non_daa_blocks( &self, ghostdag_data: &GhostdagData, store: &(impl GhostdagStoreReader + ?Sized), ) -> (u64, BlockHashSet)
pub fn calculate_difficulty_bits(&self, window: &BlockWindowHeap) -> u32
pub fn estimate_network_hashes_per_second( &self, window: &BlockWindowHeap, ) -> DifficultyResult<u64>
Trait Implementations§
Source§impl<T: Clone + HeaderStoreReader> Clone for SampledDifficultyManager<T>
impl<T: Clone + HeaderStoreReader> Clone for SampledDifficultyManager<T>
Source§fn clone(&self) -> SampledDifficultyManager<T>
fn clone(&self) -> SampledDifficultyManager<T>
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 moreAuto Trait Implementations§
impl<T> Freeze for SampledDifficultyManager<T>
impl<T> RefUnwindSafe for SampledDifficultyManager<T>where
T: RefUnwindSafe,
impl<T> Send for SampledDifficultyManager<T>
impl<T> Sync for SampledDifficultyManager<T>
impl<T> Unpin for SampledDifficultyManager<T>
impl<T> UnwindSafe for SampledDifficultyManager<T>where
T: RefUnwindSafe,
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