def do_start(self) -> None: loop = asyncio.get_event_loop() discovery_bootstrap = DiscoveryBootstrapService(self.event_bus, self.context.trinity_config) asyncio.ensure_future(exit_with_service_and_endpoint(discovery_bootstrap, self.event_bus)) asyncio.ensure_future(discovery_bootstrap.run()) loop.run_forever() loop.close()
def do_start(self) -> None: loop = asyncio.get_event_loop() service = PeerCountReporter(self.event_bus) asyncio.ensure_future(exit_with_service_and_endpoint(service, self.event_bus)) asyncio.ensure_future(service.run()) loop.run_forever() loop.close()
def do_start(self) -> None: db_manager = create_db_manager( self.context.trinity_config.database_ipc_path) db_manager.connect() trinity_config = self.context.trinity_config eth1_app_config = self.context.trinity_config.get_app_config( Eth1AppConfig) chain_config = trinity_config.get_chain_config() chain: BaseAsyncChain if eth1_app_config.is_light_mode: header_db = db_manager.get_headerdb() # type: ignore event_bus_light_peer_chain = EventBusLightPeerChain( self.context.event_bus) chain = chain_config.light_chain_class( header_db, peer_chain=event_bus_light_peer_chain) elif eth1_app_config.is_full_mode: db = db_manager.get_db() # type: ignore chain = chain_config.full_chain_class(db) else: raise NotImplementedError( f"Unsupported mode: {trinity_config.sync_mode}") rpc = RPCServer(chain, self.context.event_bus) ipc_server = IPCServer(rpc, self.context.trinity_config.jsonrpc_ipc_path) loop = asyncio.get_event_loop() asyncio.ensure_future( exit_with_service_and_endpoint(ipc_server, self.context.event_bus)) asyncio.ensure_future(ipc_server.run()) loop.run_forever() loop.close()
def do_start(self) -> None: service = EthstatsService( self.context, self.server_url, self.server_secret, self.node_id, self.node_contact, ) loop: asyncio.AbstractEventLoop = asyncio.get_event_loop() asyncio.ensure_future( exit_with_service_and_endpoint(service, self.context.event_bus)) asyncio.ensure_future(service.run()) loop.run_forever() loop.close()
def do_start(self) -> None: trinity_config = self.context.trinity_config if trinity_config.has_app_config(Eth1AppConfig): modules = self.setup_eth1_modules(trinity_config) elif trinity_config.has_app_config(BeaconAppConfig): modules = self.setup_beacon_modules() else: raise Exception("Unsupported Node Type") rpc = RPCServer(modules, self.context.event_bus) ipc_server = IPCServer(rpc, self.context.trinity_config.jsonrpc_ipc_path) loop = asyncio.get_event_loop() asyncio.ensure_future(exit_with_service_and_endpoint(ipc_server, self.context.event_bus)) asyncio.ensure_future(ipc_server.run()) loop.run_forever() loop.close()
def do_start(self) -> None: trinity_config = self.context.trinity_config beacon_config = trinity_config.get_app_config(BeaconAppConfig) db_manager = create_db_consumer_manager(trinity_config.database_ipc_path) base_db = db_manager.get_db() # type: ignore chain_db = db_manager.get_chaindb() # type: ignore chain_config = beacon_config.get_chain_config() chain = chain_config.beacon_chain_class(base_db) if self.context.args.beacon_nodekey: from eth_keys.datatypes import PrivateKey privkey = PrivateKey(bytes.fromhex(self.context.args.beacon_nodekey)) else: privkey = ecies.generate_privkey() server = BCCServer( privkey=privkey, port=self.context.args.port, chain=chain, chaindb=chain_db, headerdb=None, base_db=base_db, network_id=trinity_config.network_id, max_peers=DEFAULT_MAX_PEERS, bootstrap_nodes=None, preferred_nodes=None, event_bus=self.context.event_bus, token=None, ) syncer = BeaconChainSyncer( chain_db, server.peer_pool, server.cancel_token, ) loop = asyncio.get_event_loop() asyncio.ensure_future(exit_with_service_and_endpoint(server, self.context.event_bus)) asyncio.ensure_future(server.run()) asyncio.ensure_future(syncer.run()) loop.run_forever() loop.close()