lock only when fetching, giving a chance for tip updates

This commit is contained in:
Victor Shyba 2020-03-26 14:25:50 -03:00
parent 7ad3447598
commit d2fb7a7151

View file

@ -354,8 +354,8 @@ class Ledger(metaclass=LedgerRegistry):
self.headers.chunk_getter = get_chunk
async def doit():
async with self._header_processing_lock:
for height in reversed(sorted(self.headers.known_missing_checkpointed_chunks)):
for height in reversed(sorted(self.headers.known_missing_checkpointed_chunks)):
async with self._header_processing_lock:
await self.headers.ensure_chunk_at(height)
self._other_tasks.add(doit())
await self.update_headers()