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§
Source§impl 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§
Source§impl Clone for ProofOfWork
impl Clone for ProofOfWork
Source§fn clone(&self) -> ProofOfWork
fn clone(&self) -> ProofOfWork
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more