pub trait PowStrategy: Clone + Sync {
// Required methods
fn new(challenge: [u8; 32], bits: f64) -> Self;
fn check(&mut self, nonce: u64) -> bool;
fn solution(&self, nonce: u64) -> PoWSolution;
// Provided method
fn solve(&mut self) -> Option<PoWSolution> { ... }
}Required Methods§
Sourcefn new(challenge: [u8; 32], bits: f64) -> Self
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.
Sourcefn solution(&self, nonce: u64) -> PoWSolution
fn solution(&self, nonce: u64) -> PoWSolution
Builds a solution given the input nonce
Provided Methods§
fn solve(&mut self) -> Option<PoWSolution>
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.