fix block commit function
This commit is contained in:
parent
679902e4cc
commit
b403251ace
|
@ -532,7 +532,6 @@ class Carnot:
|
||||||
|
|
||||||
parent = self.safe_blocks.get(block.parent())
|
parent = self.safe_blocks.get(block.parent())
|
||||||
grand_parent = self.safe_blocks.get(parent.parent())
|
grand_parent = self.safe_blocks.get(parent.parent())
|
||||||
while grand_parent and grand_parent.view > self.latest_committed_view:
|
|
||||||
# this case should just trigger on genesis_case,
|
# this case should just trigger on genesis_case,
|
||||||
# as the preconditions on outer calls should check on block validity
|
# as the preconditions on outer calls should check on block validity
|
||||||
if not parent or not grand_parent:
|
if not parent or not grand_parent:
|
||||||
|
@ -542,7 +541,9 @@ class Carnot:
|
||||||
isinstance(block.qc, (StandardQc,)) and
|
isinstance(block.qc, (StandardQc,)) and
|
||||||
isinstance(parent.qc, (StandardQc,))
|
isinstance(parent.qc, (StandardQc,))
|
||||||
)
|
)
|
||||||
if can_commit:
|
# Manually commit all the chain between a newly committed block and the previous highest
|
||||||
|
# committed block.
|
||||||
|
while can_commit and grand_parent and grand_parent.view > self.latest_committed_view:
|
||||||
self.committed_blocks[grand_parent.id()] = grand_parent
|
self.committed_blocks[grand_parent.id()] = grand_parent
|
||||||
self.increment_latest_committed_view(grand_parent.view)
|
self.increment_latest_committed_view(grand_parent.view)
|
||||||
grand_parent = self.safe_blocks.get(grand_parent.parent())
|
grand_parent = self.safe_blocks.get(grand_parent.parent())
|
||||||
|
|
Loading…
Reference in New Issue