Skip to main content

Solver

Trait Solver 

Source
pub trait Solver {
    // Required methods
    fn backend_name(&self) -> &'static str;
    fn recommended_lanes(&mut self, requested: usize) -> usize;
    fn find_proof_batch(
        &mut self,
        header_without_nonce: &[u8],
        start_nonce: u64,
        lanes: usize,
        difficulty: u32,
    ) -> Result<Option<(u64, [u8; 32])>, Error>;
    fn benchmark_hashes(
        &mut self,
        header_without_nonce: &[u8],
        start_nonce: u64,
        lanes: usize,
    ) -> Result<usize, Error>;
}
Expand description

Backend-agnostic solver interface.

Required Methods§

Source

fn backend_name(&self) -> &'static str

Human-readable backend name (“cpu”, “cuda”, “metal”, etc.)

Source

fn recommended_lanes(&mut self, requested: usize) -> usize

Recommend optimal lane count for this backend.

Source

fn find_proof_batch( &mut self, header_without_nonce: &[u8], start_nonce: u64, lanes: usize, difficulty: u32, ) -> Result<Option<(u64, [u8; 32])>, Error>

Search for a valid proof in a batch of nonces starting at start_nonce.

Source

fn benchmark_hashes( &mut self, header_without_nonce: &[u8], start_nonce: u64, lanes: usize, ) -> Result<usize, Error>

Run benchmark: hash lanes nonces starting from start_nonce. Returns number of hashes computed.

Implementors§