Fix mistype comparison symbol.

Early clean block waiters futures.
This commit is contained in:
cheatfate 2023-08-18 01:35:57 +03:00
parent f70dbf1f53
commit 9122427e04
No known key found for this signature in database
GPG Key ID: 46ADD633A7201F95
1 changed files with 3 additions and 1 deletions

View File

@ -1242,8 +1242,9 @@ proc expectBlock*(vc: ValidatorClientRef, slot: Slot,
waiter: BlockWaiter) = waiter: BlockWaiter) =
data.waiters.add(waiter) data.waiters.add(waiter)
for mitem in data.waiters.mitems(): for mitem in data.waiters.mitems():
if mitem.count <= len(data.blocks): if mitem.count >= len(data.blocks):
if not(mitem.future.finished()): mitem.future.complete(data.blocks) if not(mitem.future.finished()): mitem.future.complete(data.blocks)
data.waiters.keepItIf(not(it.future.finished()))
vc.blocksSeen.mgetOrPut(slot, BlockDataItem()).scheduleCallbacks(waiter) vc.blocksSeen.mgetOrPut(slot, BlockDataItem()).scheduleCallbacks(waiter)
if not(retFuture.finished()): retFuture.cancelCallback = cancellation if not(retFuture.finished()): retFuture.cancelCallback = cancellation
@ -1266,6 +1267,7 @@ proc registerBlock*(vc: ValidatorClientRef, eblck: EventBeaconBlockObject,
for mitem in data.waiters.mitems(): for mitem in data.waiters.mitems():
if mitem.count >= len(data.blocks): if mitem.count >= len(data.blocks):
if not(mitem.future.finished()): mitem.future.complete(data.blocks) if not(mitem.future.finished()): mitem.future.complete(data.blocks)
data.waiters.keepItIf(not(it.future.finished()))
vc.blocksSeen.mgetOrPut(eblck.slot, BlockDataItem()).scheduleCallbacks(eblck) vc.blocksSeen.mgetOrPut(eblck.slot, BlockDataItem()).scheduleCallbacks(eblck)