Skip to content

Commit

Permalink
DeclareMiningJobSuccess only when job id is the last one declared
Browse files Browse the repository at this point in the history
  • Loading branch information
GitGab19 committed May 14, 2024
1 parent 122a337 commit 0ef37d6
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions roles/jd-server/src/lib/job_declarator/message_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,22 +193,24 @@ impl ParseClientJobDeclarationMessages for JobDeclaratorDownstream {
TransactionState::Missing => return Err(Error::JDSMissingTransactions),
}
}
// TODO check it
let tx_hash_list_hash = self.tx_hash_list_hash.clone().unwrap().into_static();
let message_success = DeclareMiningJobSuccess {
request_id: message.request_id,
new_mining_job_token: signed_token(
tx_hash_list_hash,
&self.public_key.clone(),
&self.private_key.clone(),
),
};
let message_enum_success =
JobDeclaration::DeclareMiningJobSuccess(message_success);
return Ok(SendTo::Respond(message_enum_success));
}
}
None => return Err(Error::NoValidJob),
}
// TODO check it
let tx_hash_list_hash = self.tx_hash_list_hash.clone().unwrap().into_static();
let message_success = DeclareMiningJobSuccess {
request_id: message.request_id,
new_mining_job_token: signed_token(
tx_hash_list_hash,
&self.public_key.clone(),
&self.private_key.clone(),
),
};
let message_enum_success = JobDeclaration::DeclareMiningJobSuccess(message_success);
Ok(SendTo::Respond(message_enum_success))
Ok(SendTo::None(None))
}

fn handle_submit_solution(&mut self, message: SubmitSolutionJd<'_>) -> Result<SendTo, Error> {
Expand Down

0 comments on commit 0ef37d6

Please sign in to comment.