nimue_pow

Trait PowStrategy

Source
pub trait PowStrategy: Clone + Sync {
    // Required methods
    fn new(challenge: [u8; 32], bits: f64) -> Self;
    fn check(&mut self, nonce: u64) -> bool;

    // Provided method
    fn solve(&mut self) -> Option<u64> { ... }
}

Required Methods§

Source

fn new(challenge: [u8; 32], bits: f64) -> Self

Creates a new proof-of-work challenge. The challenge is a 32-byte array that represents the challenge. The bits is the binary logarithm of the expected amount of work. When bits is large (i.e. close to 64), a valid solution may not be found.

Source

fn check(&mut self, nonce: u64) -> bool

Check if the nonce satisfies the challenge.

Provided Methods§

Source

fn solve(&mut self) -> Option<u64>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§