pub struct ProofOfWork {
pub total_difficulty: Difficulty,
pub secondary_scaling: u32,
pub nonce: u64,
pub proof: Proof,
pub seed: [u8; 32],
}Expand description
Block header information pertaining to the proof of work
Fields§
§total_difficulty: DifficultyTotal accumulated difficulty since genesis block
secondary_scaling: u32Variable difficulty scaling factor fo secondary proof of work
nonce: u64Nonce increment used to mine this block.
proof: ProofProof of work data.
seed: [u8; 32]Randomx seed.
Implementations§
Source§impl ProofOfWork
impl ProofOfWork
Sourcepub fn write<W: Writer>(&self, writer: &mut W) -> Result<(), Error>
pub fn write<W: Writer>(&self, writer: &mut W) -> Result<(), Error>
Write implementation, can’t define as trait impl as we need a version
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,
header: &[u8],
height: u64,
nonce: u64,
) -> Difficulty
pub fn to_difficulty( &self, header: &[u8], height: u64, nonce: u64, ) -> Difficulty
Maximum 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§
Source§impl Clone for ProofOfWork
impl Clone for ProofOfWork
Source§fn clone(&self) -> ProofOfWork
fn clone(&self) -> ProofOfWork
Returns a duplicate 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 ProofOfWork
impl Debug for ProofOfWork
Source§impl Default for ProofOfWork
impl Default for ProofOfWork
Source§fn default() -> ProofOfWork
fn default() -> ProofOfWork
Returns the “default value” for a type. Read more
Source§impl PartialEq for ProofOfWork
impl PartialEq for ProofOfWork
Source§impl Readable for ProofOfWork
impl Readable for ProofOfWork
Source§impl Serialize for ProofOfWork
impl Serialize for ProofOfWork
Source§impl Writeable for ProofOfWork
impl Writeable for ProofOfWork
impl StructuralPartialEq for ProofOfWork
Auto Trait Implementations§
impl Freeze for ProofOfWork
impl RefUnwindSafe for ProofOfWork
impl Send for ProofOfWork
impl Sync for ProofOfWork
impl Unpin for ProofOfWork
impl UnwindSafe for ProofOfWork
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