remove serialization error variant of EquihashError

This commit is contained in:
Jane Lusby 2020-07-21 16:57:22 -07:00 committed by teor
parent 0dc2d92ad8
commit b8de256c48
1 changed files with 5 additions and 7 deletions

View File

@ -74,7 +74,9 @@ impl BlockHeader {
let solution = &self.solution.0;
let mut input = Vec::new();
self.zcash_serialize(&mut input)?;
self.zcash_serialize(&mut input)
.expect("serialization into a vec can't fail");
let input = &input[0..EquihashSolution::INPUT_LENGTH];
equihash::is_valid_solution(n, k, input, nonce, solution)?;
@ -110,9 +112,5 @@ impl BlockHeader {
#[non_exhaustive]
#[derive(Debug, thiserror::Error)]
pub enum EquihashError {
#[error("invalid equihash solution for BlockHeader")]
EquihashInvalid(#[from] equihash::Error),
#[error("cannot reserialize header for equihash verification")]
Serialize(#[from] std::io::Error),
}
#[error("invalid equihash solution for BlockHeader")]
pub struct EquihashError(#[from] equihash::Error);