From 46c4803f8b8cb319259f251a189c345f31cf3545 Mon Sep 17 00:00:00 2001 From: mjalalzai <33738574+MForensic@users.noreply.github.com> Date: Thu, 30 Mar 2023 20:43:56 -0700 Subject: [PATCH] adding highest voted view so that a node doesn't vote twice. --- carnot/carnot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/carnot/carnot.py b/carnot/carnot.py index e3279b9..45dc308 100644 --- a/carnot/carnot.py +++ b/carnot/carnot.py @@ -227,7 +227,7 @@ class Carnot: qc=None ) self.send(vote, *self.overlay.parent_committee(self.id)) - self.increment_voted_view(block.view) + self.increment_voted_view(block.view) # to avoid voting again for this view. self.increment_view_qc(block.qc) def forward_vote(self, vote: Vote): @@ -279,7 +279,7 @@ class Carnot: if can_commit: self.committed_blocks[block.id()] = block def increment_voted_view(self,view: View): - highest_voted_view =max(view,highest_voted_view) + self.highest_voted_view = max(view,self.highest_voted_view) def increment_view_qc(self, qc: Qc) -> bool: if qc.view < self.current_view: