From 245c4cd73d92ef7c66a6e9478d58d359fa699d08 Mon Sep 17 00:00:00 2001 From: mjalalzai <33738574+MForensic@users.noreply.github.com> Date: Sun, 15 Oct 2023 12:33:44 -0700 Subject: [PATCH] Receive timeout QC --- carnot/carnot-vote-aggregation.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/carnot/carnot-vote-aggregation.py b/carnot/carnot-vote-aggregation.py index 545d6ff..844c951 100644 --- a/carnot/carnot-vote-aggregation.py +++ b/carnot/carnot-vote-aggregation.py @@ -463,3 +463,21 @@ class Carnot: sender=self.id ) return Send(payload=timeout_msg, to=self.overlay.my_committee()) + + +def receive_timeout_qc(self, timeout_qc: TimeoutQc): + if timeout_qc.view < self.current_view: + # Ignore outdated timeout QC + return + + # Update the local high QC with the new high QC from the timeout QC + self.update_high_qc(timeout_qc.high_qc) + + # Update the last view timeout QC + self.update_timeout_qc(timeout_qc) + + # Update the current view based on the timeout QC + self.update_current_view_from_timeout_qc(timeout_qc) + + # Optionally, rebuild the overlay from the timeout QC + # self.rebuild_overlay_from_timeout_qc(timeout_qc)