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])>, usize), 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§
Sourcefn backend_name(&self) -> &'static str
fn backend_name(&self) -> &'static str
Human-readable backend name (“cpu”, “cuda”, “metal”, etc.)
Sourcefn recommended_lanes(&mut self, requested: usize) -> usize
fn recommended_lanes(&mut self, requested: usize) -> usize
Recommend optimal lane count for this backend.
Sourcefn find_proof_batch(
&mut self,
header_without_nonce: &[u8],
start_nonce: u64,
lanes: usize,
difficulty: u32,
) -> Result<(Option<(u64, [u8; 32])>, usize), Error>
fn find_proof_batch( &mut self, header_without_nonce: &[u8], start_nonce: u64, lanes: usize, difficulty: u32, ) -> Result<(Option<(u64, [u8; 32])>, usize), Error>
Search for a valid proof in a batch of nonces starting at start_nonce.
Returns (proof_result, actual_hashes) where actual_hashes is the
number of hashes actually computed (may be less than lanes when the
backend exits early after finding a proof).