Skip to content

Commit

Permalink
avoid JDS dropping connection on SubmitSolution with missing txs
Browse files Browse the repository at this point in the history
this is the actual fix for #912
  • Loading branch information
plebhash committed Jul 9, 2024
1 parent 71e2e4e commit 131bca5
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions roles/jd-server/src/lib/job_declarator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,23 +280,21 @@ impl JobDeclaratorDownstream {
match Self::collect_txs_in_job(self_mutex.clone()) {
Ok(_) => {
info!("All transactions in downstream job are recognized correctly by the JD Server");
let hexdata =
match JobDeclaratorDownstream::get_block_hex(
self_mutex.clone(),
message,
) {
Ok(inner) => inner,
Err(e) => {
error!(
match JobDeclaratorDownstream::get_block_hex(
self_mutex.clone(),
message,
) {
Ok(hexdata) => {
let _ =
new_block_sender.send(hexdata).await;
}
Err(e) => {
error!(
"Received solution but encountered error: {:?}",
e
);
recv.close();
//TODO should we brake it?
break;
}
};
let _ = new_block_sender.send(hexdata).await;
}
};
}
Err(error) => {
error!("Missing transactions: {:?}", error);
Expand All @@ -316,22 +314,20 @@ impl JobDeclaratorDownstream {
.unwrap();
tokio::select! {
_ = JDsMempool::add_tx_data_to_mempool(mempool, retrieve_transactions) => {
let hexdata = match JobDeclaratorDownstream::get_block_hex(
match JobDeclaratorDownstream::get_block_hex(
self_mutex.clone(),
message.clone(),
) {
Ok(inner) => inner,
Ok(hexdata) => {
let _ = new_block_sender.send(hexdata).await;
},
Err(e) => {
error!(
"Error retrieving transactions: {:?}",
e
);
recv.close();
//TODO should we brake it?
break;
}
};
let _ = new_block_sender.send(hexdata).await;
}
_ = tokio::time::sleep(Duration::from_secs(60)) => {}
};
Expand Down

0 comments on commit 131bca5

Please sign in to comment.