Пример #1
0
    async def do_run(self, event_bus: EndpointAPI) -> None:
        trinity_config = self._boot_info.trinity_config
        app_config = trinity_config.get_app_config(Eth1AppConfig)
        chain_config = app_config.get_chain_config()

        base_db = DBClient.connect(trinity_config.database_ipc_path)

        with base_db:
            loop = asyncio.get_event_loop()

            beam_chain = make_pausing_beam_chain(
                chain_config.vm_configuration,
                chain_config.chain_id,
                chain_config.consensus_context_class,
                base_db,
                event_bus,
                # these preview executions are lower priority than the primary block import
                loop=loop,
                urgent=False,
            )

            preview_server = BlockPreviewServer(event_bus, beam_chain, self.shard_num)

            async with background_asyncio_service(preview_server) as manager:
                await manager.wait_finished()
Пример #2
0
    async def do_run(cls, boot_info: BootInfo, event_bus: EndpointAPI) -> None:
        trinity_config = boot_info.trinity_config
        app_config = trinity_config.get_app_config(Eth1AppConfig)
        chain_config = app_config.get_chain_config()

        base_db = DBClient.connect(trinity_config.database_ipc_path)

        with base_db:
            loop = asyncio.get_event_loop()

            beam_chain = make_pausing_beam_chain(
                chain_config.vm_configuration,
                chain_config.chain_id,
                base_db,
                event_bus,
                # these preview executions are lower priority than the primary block import
                loop=loop,
                urgent=False,
            )

            preview_server = BlockPreviewServer(event_bus, beam_chain,
                                                cls.shard_num)

            async with run_service(preview_server):
                await preview_server.cancellation()
Пример #3
0
    def do_start(self) -> None:
        trinity_config = self.boot_info.trinity_config
        app_config = trinity_config.get_app_config(Eth1AppConfig)
        chain_config = app_config.get_chain_config()

        base_db = DBClient.connect(trinity_config.database_ipc_path)

        self._beam_chain = make_pausing_beam_chain(
            chain_config.vm_configuration,
            chain_config.chain_id,
            base_db,
            self.event_bus,
            self._loop,
            # these preview executions are lower priority than the primary block import
            urgent=False,
        )

        import_server = BlockPreviewServer(self.event_bus, self._beam_chain, self.shard_num)
        asyncio.ensure_future(exit_with_services(import_server, self._event_bus_service))
        asyncio.ensure_future(import_server.run())