예제 #1
0
 async def _hang_until_storage_served(self, event: CollectMissingStorage) -> None:
     try:
         await self.wait(self._serve_storage(event))
     except OperationCancelled:
         await self._event_bus.broadcast(
             MissingStorageResult(is_retry_acceptable=False),
             event.broadcast_config(),
         )
         raise
예제 #2
0
파일: chain.py 프로젝트: s0b0lev/trinity
 async def _serve_storage(self, event: CollectMissingStorage) -> None:
     await self._state_downloader.ensure_node_present(
         event.missing_node_hash)
     num_nodes_collected = await self._state_downloader.download_storage(
         event.storage_key,
         event.storage_root_hash,
         event.account_address,
     )
     await self._event_bus.broadcast(
         MissingStorageCollected(num_nodes_collected),
         event.broadcast_config(),
     )
예제 #3
0
파일: chain.py 프로젝트: Elnaril/trinity
 async def _hang_until_storage_served(self, event: CollectMissingStorage) -> None:
     try:
         await asyncio.wait_for(
             self._serve_storage(event),
             timeout=BLOCK_IMPORT_MISSING_STATE_TIMEOUT,
         )
     except asyncio.CancelledError:
         await self._event_bus.broadcast(
             MissingStorageResult(is_retry_acceptable=False),
             event.broadcast_config(),
         )
         raise
     except asyncio.TimeoutError:
         pass
예제 #4
0
 async def _serve_storage(self, event: CollectMissingStorage) -> None:
     num_nodes_collected = await self._state_downloader.download_storage(
         event.storage_key,
         event.storage_root_hash,
         event.account_address,
         event.urgent,
     )
     bonus_node = await self._state_downloader.ensure_nodes_present(
         {event.missing_node_hash},
         event.urgent,
     )
     await self._event_bus.broadcast(
         MissingStorageResult(num_nodes_collected + bonus_node),
         event.broadcast_config(),
     )
예제 #5
0
 async def collect_storage(event: CollectMissingStorage):
     replace_missing_node(event.missing_node_hash)
     await event_bus.broadcast(
         MissingStorageResult(1), event.broadcast_config()
     )