Struct grin_core::consensus::HeaderDifficultyInfo
source · pub struct HeaderDifficultyInfo {
pub hash: Option<Hash>,
pub timestamp: u64,
pub difficulty: Difficulty,
pub secondary_scaling: u32,
pub is_secondary: bool,
}
Expand description
Minimal header information required for the Difficulty calculation to take place. Used to iterate through a number of blocks. Note that an instance of this is unable to calculate its own hash, due to an optimization that prevents the header’s PoW proof nonces from being deserialized on read
Fields§
§hash: Option<Hash>
Hash of this block
timestamp: u64
Timestamp of the header, 1 when not used (returned info)
difficulty: Difficulty
Network difficulty or next difficulty to use
secondary_scaling: u32
Network secondary PoW factor or factor to use
is_secondary: bool
Whether the header is a secondary proof of work
Implementations§
source§impl HeaderDifficultyInfo
impl HeaderDifficultyInfo
sourcepub fn new(
hash: Option<Hash>,
timestamp: u64,
difficulty: Difficulty,
secondary_scaling: u32,
is_secondary: bool
) -> HeaderDifficultyInfo
pub fn new( hash: Option<Hash>, timestamp: u64, difficulty: Difficulty, secondary_scaling: u32, is_secondary: bool ) -> HeaderDifficultyInfo
Default constructor
sourcepub fn from_ts_diff(
timestamp: u64,
difficulty: Difficulty
) -> HeaderDifficultyInfo
pub fn from_ts_diff( timestamp: u64, difficulty: Difficulty ) -> HeaderDifficultyInfo
Constructor from a timestamp and difficulty, setting a default secondary PoW factor
sourcepub fn from_diff_scaling(
difficulty: Difficulty,
secondary_scaling: u32
) -> HeaderDifficultyInfo
pub fn from_diff_scaling( difficulty: Difficulty, secondary_scaling: u32 ) -> HeaderDifficultyInfo
Constructor from a difficulty and secondary factor, setting a default timestamp
Trait Implementations§
source§impl Clone for HeaderDifficultyInfo
impl Clone for HeaderDifficultyInfo
source§fn clone(&self) -> HeaderDifficultyInfo
fn clone(&self) -> HeaderDifficultyInfo
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for HeaderDifficultyInfo
impl Debug for HeaderDifficultyInfo
source§impl PartialEq for HeaderDifficultyInfo
impl PartialEq for HeaderDifficultyInfo
source§fn eq(&self, other: &HeaderDifficultyInfo) -> bool
fn eq(&self, other: &HeaderDifficultyInfo) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for HeaderDifficultyInfo
impl StructuralPartialEq for HeaderDifficultyInfo
Auto Trait Implementations§
impl Freeze for HeaderDifficultyInfo
impl RefUnwindSafe for HeaderDifficultyInfo
impl Send for HeaderDifficultyInfo
impl Sync for HeaderDifficultyInfo
impl Unpin for HeaderDifficultyInfo
impl UnwindSafe for HeaderDifficultyInfo
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.