12
12
from chia .apis import ApiProtocolRegistry
13
13
from chia .consensus .constants import replace_str_to_bytes
14
14
from chia .consensus .default_constants import DEFAULT_CONSTANTS , update_testnet_overrides
15
- from chia .full_node .full_node import FullNode
16
- from chia .full_node .full_node_api import FullNodeAPI
17
15
from chia .full_node .full_node_rpc_api import FullNodeRpcApi
18
16
from chia .protocols .outbound_message import NodeType
19
- from chia .server .aliases import FullNodeService
17
+ from chia .server .aliases import SolverService
20
18
from chia .server .signal_handlers import SignalHandlers
21
- from chia .server .start_service import RpcInfo , Service , async_run
19
+ from chia .server .start_service import Service , async_run
20
+ from chia .solver .solver import Solver
21
+ from chia .solver .solver_api import SolverAPI
22
22
from chia .util .chia_logging import initialize_service_logging
23
23
from chia .util .config import load_config , load_config_cli
24
24
from chia .util .default_root import resolve_root_path
30
30
SERVICE_NAME = "solver"
31
31
32
32
33
- async def create_solver_service (
33
+ def create_solver_service (
34
34
root_path : pathlib .Path ,
35
35
config : dict [str , Any ],
36
36
consensus_constants : ConsensusConstants ,
37
37
connect_to_daemon : bool = True ,
38
38
override_capabilities : Optional [list [tuple [uint16 , str ]]] = None ,
39
- ) -> FullNodeService :
39
+ ) -> SolverService :
40
40
service_config = config [SERVICE_NAME ]
41
41
42
42
network_id = service_config ["selected_network" ]
43
43
upnp_list = []
44
44
if service_config ["enable_upnp" ]:
45
45
upnp_list = [service_config ["port" ]]
46
46
47
- node = await FullNode .create (
48
- service_config ,
49
- root_path = root_path ,
50
- consensus_constants = consensus_constants ,
51
- )
52
- peer_api = FullNodeAPI (node )
47
+ node = Solver (root_path , service_config , consensus_constants )
48
+ peer_api = SolverAPI (node )
49
+ network_id = service_config ["selected_network" ]
53
50
54
- rpc_info : Optional [RpcInfo [FullNodeRpcApi ]] = None
55
51
if service_config .get ("start_rpc_server" , True ):
56
52
rpc_info = (FullNodeRpcApi , service_config ["rpc_port" ])
57
53
@@ -64,7 +60,6 @@ async def create_solver_service(
64
60
advertised_port = service_config ["port" ],
65
61
service_name = SERVICE_NAME ,
66
62
upnp_ports = upnp_list ,
67
- # connect_peers=get_unresolved_peer_infos(service_config, NodeType.SOLVER),
68
63
on_connect_callback = node .on_connect ,
69
64
network_id = network_id ,
70
65
rpc_info = rpc_info ,
@@ -84,7 +79,7 @@ async def async_main(service_config: dict[str, Any], root_path: pathlib.Path) ->
84
79
updated_constants = replace_str_to_bytes (DEFAULT_CONSTANTS , ** overrides )
85
80
initialize_service_logging (service_name = SERVICE_NAME , config = config , root_path = root_path )
86
81
87
- service = await create_solver_service (root_path , config , updated_constants )
82
+ service = create_solver_service (root_path , config , updated_constants )
88
83
async with SignalHandlers .manage () as signal_handlers :
89
84
await service .setup_process_global_state (signal_handlers = signal_handlers )
90
85
await service .run ()
0 commit comments