adding highest voted view so that a node doesn't vote twice.

This commit is contained in:
mjalalzai 2023-03-30 20:43:56 -07:00
parent 88a3fa04a6
commit 46c4803f8b

View File

@ -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: