From a055c2524a47c146c04e4ab0f3a54c1f922747a6 Mon Sep 17 00:00:00 2001 From: Youngjoon Lee Date: Wed, 7 Jun 2023 09:56:21 +0900 Subject: [PATCH] fix: prevent skipping one view when proposing a block in unhappy path (#166) --- nomos-services/consensus/src/lib.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nomos-services/consensus/src/lib.rs b/nomos-services/consensus/src/lib.rs index 6bb770f1..00e19002 100644 --- a/nomos-services/consensus/src/lib.rs +++ b/nomos-services/consensus/src/lib.rs @@ -300,23 +300,24 @@ where let (new_carnot, out) = carnot.approve_new_view(timeout_qc.clone(), new_views); carnot = new_carnot; output = Some(Output::Send(out)); - let next_view = timeout_qc.view + 2; + let new_view = timeout_qc.view + 1; + let next_view = new_view + 1; if carnot.is_leader_for_view(next_view) { let high_qc = carnot.high_qc(); events.push(Box::pin(view_cancel_cache.cancelable_event_future( - timeout_qc.view + 1, + new_view, async move { let _votes = Self::gather_new_views( adapter, leader_committee, - timeout_qc, + timeout_qc.clone(), leader_tally_settings.clone(), ) .await; Event::ProposeBlock { qc: Qc::Aggregated(AggregateQc { high_qc, - view: next_view, + view: new_view, }), } },