Skip to content

Commit

Permalink
Protocol loop should continue on error (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaoticTempest authored Nov 28, 2023
1 parent 0357770 commit 3cb44f3
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions node/src/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,28 @@ impl MpcSignProtocol {
}
}

let mut state = {
let guard = self.state.write().await;
let state = {
let guard = self.state.read().await;
guard.clone()
};
state = state.progress(&self.ctx).await?;
state = state.advance(&self.ctx, contract_state).await?;
state.handle(&self.ctx, &mut queue).await?;
let state = match state.progress(&self.ctx).await {
Ok(state) => state,
Err(err) => {
tracing::info!("protocol unable to progress: {err:?}");
continue;
}
};
let mut state = match state.advance(&self.ctx, contract_state).await {
Ok(state) => state,
Err(err) => {
tracing::info!("protocol unable to advance: {err:?}");
continue;
}
};
if let Err(err) = state.handle(&self.ctx, &mut queue).await {
tracing::info!("protocol unable to handle messages: {err:?}");
continue;
}

let mut guard = self.state.write().await;
*guard = state;
Expand Down

0 comments on commit 3cb44f3

Please sign in to comment.