From 91b101354341cbf370bf5c281bc155630e523d86 Mon Sep 17 00:00:00 2001 From: asmaa-starkware <163830216+asmaastarkware@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:15:12 +0300 Subject: [PATCH] fix(consensus): resolve dropped messages (#2236) --- crates/sequencing/papyrus_consensus/src/lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/sequencing/papyrus_consensus/src/lib.rs b/crates/sequencing/papyrus_consensus/src/lib.rs index a14bb0043c..ea8a7cf4d1 100644 --- a/crates/sequencing/papyrus_consensus/src/lib.rs +++ b/crates/sequencing/papyrus_consensus/src/lib.rs @@ -66,15 +66,17 @@ where } loop { - let message = current_height_messages.pop().unwrap_or( + let message = if let Some(msg) = current_height_messages.pop() { + msg + } else { // TODO(matan): Handle parsing failures and utilize ReportCallback. network_receiver .next() .await .expect("Network receiver closed unexpectedly") .0 - .expect("Failed to parse consensus message"), - ); + .expect("Failed to parse consensus message") + }; if message.height() != height.0 { debug!("Received a message for a different height. {:?}", message);