Skip to content

Commit

Permalink
fix(consensus): add timeout when waiting for first proposal message
Browse files Browse the repository at this point in the history
  • Loading branch information
guy-starkware committed Dec 23, 2024
1 parent 72b34b3 commit 8025287
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/sequencing/papyrus_consensus/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,12 @@ impl<ContextT: ConsensusContext> MultiHeightManager<ContextT> {
// Get the first message to verify the init was sent.
// TODO(guyn): add a timeout and panic, since StreamHandler should only send once
// the first message (message_id=0) has arrived.
let Some(first_part) = content_receiver.next().await else {
let Some(first_part) = content_receiver.try_next().map_err(|_| {
ConsensusError::InternalNetworkError(
"Stream handler must fill the first message before sending the stream".to_string(),
)
})?
else {
return Err(ConsensusError::InternalNetworkError(
"Proposal receiver closed".to_string(),
));
Expand Down

0 comments on commit 8025287

Please sign in to comment.