async def setup_full_node( consensus_constants: ConsensusConstants, db_name, port, local_bt, introducer_port=None, simulator=False, send_uncompact_interval=30, ): db_path = bt.root_path / f"{db_name}" if db_path.exists(): db_path.unlink() config = bt.config["full_node"] config["database_path"] = db_name config["send_uncompact_interval"] = send_uncompact_interval config["target_uncompact_proofs"] = 30 config["peer_connect_interval"] = 50 if introducer_port is not None: config["introducer_peer"]["host"] = self_hostname config["introducer_peer"]["port"] = introducer_port else: config["introducer_peer"] = None config["port"] = port config["rpc_port"] = port + 1000 overrides = config["network_overrides"]["constants"][ config["selected_network"]] updated_constants = consensus_constants.replace_str_to_bytes(**overrides) if simulator: kwargs = service_kwargs_for_full_node_simulator( local_bt.root_path, config, local_bt) else: kwargs = service_kwargs_for_full_node(local_bt.root_path, config, updated_constants) kwargs.update( parse_cli_args=False, connect_to_daemon=False, ) service = Service(**kwargs) await service.start() yield service._api service.stop() await service.wait_closed() if db_path.exists(): db_path.unlink()
async def setup_full_node( consensus_constants: ConsensusConstants, db_name, port, introducer_port=None, simulator=False, send_uncompact_interval=30, ): db_path = bt.root_path / f"{db_name}" if db_path.exists(): db_path.unlink() config = bt.config["full_node"] config["database_path"] = db_name config["send_uncompact_interval"] = send_uncompact_interval config["peer_connect_interval"] = 3 if introducer_port is not None: config["introducer_peer"]["host"] = self_hostname config["introducer_peer"]["port"] = introducer_port else: config["introducer_peer"] = None config["port"] = port config["rpc_port"] = port + 1000 if simulator: kwargs = service_kwargs_for_full_node_simulator( bt.root_path, config, consensus_constants, bt) else: kwargs = service_kwargs_for_full_node(bt.root_path, config, consensus_constants) kwargs.update( parse_cli_args=False, connect_to_daemon=False, ) service = Service(**kwargs) await service.start() yield service._api service.stop() await service.wait_closed() if db_path.exists(): db_path.unlink()