Skip to content

Commit

Permalink
Add missing TemplateDistributionTypes case
Browse files Browse the repository at this point in the history
..to `TryFrom<(u8, &'a mut [u8])> for PoolMessages`
  • Loading branch information
jbesraa authored and plebhash committed Jun 13, 2024
1 parent ee3c847 commit f7d8378
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions protocols/v2/roles-logic-sv2/src/parsers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1106,11 +1106,18 @@ impl<'a> TryFrom<(u8, &'a mut [u8])> for PoolMessages<'a> {
let is_common: Result<CommonMessageTypes, Error> = v.0.try_into();
let is_mining: Result<MiningTypes, Error> = v.0.try_into();
let is_job_declaration: Result<JobDeclarationTypes, Error> = v.0.try_into();
match (is_common, is_mining, is_job_declaration) {
(Ok(_), Err(_), Err(_)) => Ok(Self::Common(v.try_into()?)),
(Err(_), Ok(_), Err(_)) => Ok(Self::Mining(v.try_into()?)),
(Err(_), Err(_), Ok(_)) => Ok(Self::JobDeclaration(v.try_into()?)),
(Err(e), Err(_), Err(_)) => Err(e),
let is_template_distribution: Result<TemplateDistributionTypes, Error> = v.0.try_into();
match (
is_common,
is_mining,
is_job_declaration,
is_template_distribution,
) {
(Ok(_), Err(_), Err(_), Err(_)) => Ok(Self::Common(v.try_into()?)),
(Err(_), Ok(_), Err(_), Err(_)) => Ok(Self::Mining(v.try_into()?)),
(Err(_), Err(_), Ok(_), Err(_)) => Ok(Self::JobDeclaration(v.try_into()?)),
(Err(_), Err(_), Err(_), Ok(_)) => Ok(Self::TemplateDistribution(v.try_into()?)),
(Err(e), Err(_), Err(_), Err(_)) => Err(e),
// This is an impossible state is safe to panic here
_ => panic!(),
}
Expand Down

0 comments on commit f7d8378

Please sign in to comment.