mirror of
https://github.com/logos-co/nomos-specs.git
synced 2025-02-08 21:43:48 +00:00
get highest qc from new view votes
This commit is contained in:
parent
21ab307969
commit
81e90e167b
@ -466,19 +466,17 @@ class Carnot:
|
|||||||
self.rebuild_overlay_from_timeout_qc(timeout_qc)
|
self.rebuild_overlay_from_timeout_qc(timeout_qc)
|
||||||
self.broadcast(timeout_qc) # we broadcast so all nodes can get ready for voting on a new view
|
self.broadcast(timeout_qc) # we broadcast so all nodes can get ready for voting on a new view
|
||||||
|
|
||||||
def approve_new_view(self, new_views: Set[NewView]):
|
def approve_new_view(self, timeout_qc: TimeoutQc, new_views: Set[NewView]):
|
||||||
assert len(set(new_view.view for new_view in new_views)) == 1
|
|
||||||
# newView.view == self.last_timeout_view_qc.view for member of root committee and its children because
|
# newView.view == self.last_timeout_view_qc.view for member of root committee and its children because
|
||||||
# they have already created the timeout_qc. For other nodes newView.view > self.last_timeout_view_qc.view.
|
# they have already created the timeout_qc. For other nodes newView.view > self.last_timeout_view_qc.view.
|
||||||
if self.last_timeout_view_qc is not None:
|
if self.last_timeout_view_qc is not None:
|
||||||
assert all(new_view.view >= self.last_timeout_view_qc.view for new_view in new_views)
|
assert all(new_view.view >= self.last_timeout_view_qc.view for new_view in new_views)
|
||||||
assert all(new_view.view == new_view.timeout_qc.view for new_view in new_views)
|
assert all(new_view.view == timeout_qc.view for new_view in new_views)
|
||||||
assert len(new_views) == self.overlay.super_majority_threshold(self.id)
|
assert len(new_views) == self.overlay.super_majority_threshold(self.id)
|
||||||
assert all(self.overlay.is_member_of_child_committee(self.id, new_view.sender) for new_view in new_views)
|
assert all(self.overlay.is_member_of_child_committee(self.id, new_view.sender) for new_view in new_views)
|
||||||
|
|
||||||
new_views = list(new_views)
|
# get the highest qc from the new views
|
||||||
timeout_qc = new_views[0].timeout_qc
|
new_high_qc = max([new_view.timeout_qc for new_view in new_views] + [timeout_qc.high_qc], key=lambda qc: qc.view)
|
||||||
new_high_qc = timeout_qc.high_qc
|
|
||||||
|
|
||||||
self.rebuild_overlay_from_timeout_qc(timeout_qc)
|
self.rebuild_overlay_from_timeout_qc(timeout_qc)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user