Always checks equihash solution with n=200, k=9 parameters

This commit is contained in:
Arya 2024-04-29 16:44:16 -04:00
parent d84d7356dd
commit d143a04972
1 changed files with 4 additions and 5 deletions

View File

@ -69,11 +69,10 @@ impl Solution {
/// Returns `Ok(())` if `EquihashSolution` is valid for `header`
#[allow(clippy::unwrap_in_result)]
pub fn check(&self, header: &Header) -> Result<(), Error> {
// TODO: Add Equihash parameters to `testnet::Parameters`
let n = 200;
let k = 9;
let nonce = &header.nonce;
let (solution, n, k) = match self {
Solution::Common(solution) => (solution.as_slice(), 200, 9),
Solution::Regtest(solution) => (solution.as_slice(), 48, 5),
};
let mut input = Vec::new();
header
@ -84,7 +83,7 @@ impl Solution {
// This data is kept constant during solver runs, so the verifier API takes it separately.
let input = &input[0..Solution::INPUT_LENGTH];
equihash::is_valid_solution(n, k, input, nonce.as_ref(), solution)?;
equihash::is_valid_solution(n, k, input, nonce.as_ref(), self.value())?;
Ok(())
}