Struct grin_core::pow::ProofOfWork
source · [−]pub struct ProofOfWork {
pub total_difficulty: Difficulty,
pub secondary_scaling: u32,
pub nonce: u64,
pub proof: Proof,
}
Expand description
Block header information pertaining to the proof of work
Fields
total_difficulty: Difficulty
Total accumulated difficulty since genesis block
secondary_scaling: u32
Variable difficulty scaling factor fo secondary proof of work After HardFork4, which obsoletes secondary PoW, this effectively becomes 4 more bytes of nonce. might be repurposed in future.
nonce: u64
Nonce increment used to mine this block.
proof: Proof
Proof of work data.
Implementations
sourceimpl ProofOfWork
impl ProofOfWork
sourcepub fn write_pre_pow<W: Writer>(&self, writer: &mut W) -> Result<(), Error>
pub fn write_pre_pow<W: Writer>(&self, writer: &mut W) -> Result<(), Error>
Write the pre-hash portion of the header
sourcepub fn to_difficulty(&self, height: u64) -> Difficulty
pub fn to_difficulty(&self, height: u64) -> Difficulty
Maximum difficulty this proof of work can achieve
sourcepub fn to_unscaled_difficulty(&self) -> Difficulty
pub fn to_unscaled_difficulty(&self) -> Difficulty
Maximum unscaled difficulty this proof of work can achieve
sourcepub fn is_primary(&self) -> bool
pub fn is_primary(&self) -> bool
Whether this proof of work is for the primary algorithm (as opposed to secondary). Only depends on the edge_bits at this time.
sourcepub fn is_secondary(&self) -> bool
pub fn is_secondary(&self) -> bool
Whether this proof of work is for the secondary algorithm (as opposed to primary). Only depends on the edge_bits at this time.
Trait Implementations
sourceimpl Clone for ProofOfWork
impl Clone for ProofOfWork
sourcefn clone(&self) -> ProofOfWork
fn clone(&self) -> ProofOfWork
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ProofOfWork
impl Debug for ProofOfWork
sourceimpl Default for ProofOfWork
impl Default for ProofOfWork
sourcefn default() -> ProofOfWork
fn default() -> ProofOfWork
Returns the “default value” for a type. Read more
sourceimpl PartialEq<ProofOfWork> for ProofOfWork
impl PartialEq<ProofOfWork> for ProofOfWork
sourcefn eq(&self, other: &ProofOfWork) -> bool
fn eq(&self, other: &ProofOfWork) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ProofOfWork) -> bool
fn ne(&self, other: &ProofOfWork) -> bool
This method tests for !=
.
sourceimpl Readable for ProofOfWork
impl Readable for ProofOfWork
sourceimpl Serialize for ProofOfWork
impl Serialize for ProofOfWork
sourceimpl Writeable for ProofOfWork
impl Writeable for ProofOfWork
impl StructuralPartialEq for ProofOfWork
Auto Trait Implementations
impl RefUnwindSafe for ProofOfWork
impl Send for ProofOfWork
impl Sync for ProofOfWork
impl Unpin for ProofOfWork
impl UnwindSafe for ProofOfWork
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> CloneAny for T where
T: Any + Clone,
impl<T> CloneAny for T where
T: Any + Clone,
fn clone_any(&self) -> Box<dyn CloneAny + 'static, Global>
fn clone_any_send(&self) -> Box<dyn CloneAny + Send + 'static, Global> where
T: Send,
fn clone_any_sync(&self) -> Box<dyn CloneAny + Sync + 'static, Global> where
T: Sync,
fn clone_any_send_sync(
&self
) -> Box<dyn CloneAny + Send + Sync + 'static, Global> where
T: Send + Sync,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more