mirror of
https://github.com/logos-storage/nim-mysticeti.git
synced 2026-01-09 09:03:11 +00:00
remove rounds that were fully committed
This commit is contained in:
parent
f08666ec43
commit
bb8ea4d16a
@ -66,6 +66,16 @@ func nextRound*(validator: Validator) =
|
||||
validator.last = next
|
||||
previous.next = some next
|
||||
|
||||
func remove(validator: Validator, round: Round) =
|
||||
if previous =? round.previous:
|
||||
previous.next = round.next
|
||||
else:
|
||||
validator.first = !round.next
|
||||
if next =? round.next:
|
||||
next.previous = round.previous
|
||||
else:
|
||||
validator.last = !round.previous
|
||||
|
||||
func hasParent(blck: Block, round: uint64, author: CommitteeMember): bool =
|
||||
for parent in blck.parents:
|
||||
if parent.round == round and parent.author == author:
|
||||
@ -147,4 +157,6 @@ iterator committed*(validator: Validator): auto =
|
||||
of ProposalStatus.commit:
|
||||
slot.status = ProposalStatus.committed
|
||||
yield slot.proposal
|
||||
current = round.next
|
||||
if not done:
|
||||
validator.remove(round)
|
||||
current = round.next
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user