File tree Expand file tree Collapse file tree 3 files changed +24
-30
lines changed Expand file tree Collapse file tree 3 files changed +24
-30
lines changed Original file line number Diff line number Diff line change 3333 Dict , int2ip
3434)
3535
36- from mytoninstaller .utils import enable_tha
37-
3836
3937class MyTonCore ():
4038 def __init__ (self , local ):
@@ -3081,7 +3079,8 @@ def check_enable_mode(self, name):
30813079 raise Exception (f'Cannot enable validator mode while liteserver mode is enabled. '
30823080 f'Use `disable_mode liteserver` first.' )
30833081 if name == 'liquid-staking' :
3084- enable_tha (self .local )
3082+ from mytoninstaller .settings import enable_ton_http_api
3083+ enable_ton_http_api (self .local )
30853084
30863085 def enable_mode (self , name ):
30873086 if name not in MODES :
Original file line number Diff line number Diff line change @@ -485,17 +485,36 @@ def EnableJsonRpc(local):
485485 color_print (text )
486486#end define
487487
488+ def tha_exists ():
489+ try :
490+ resp = requests .get ('http://127.0.0.1:8801/healthcheck' , timeout = 3 )
491+ except :
492+ return False
493+ if resp .status_code == 200 and resp .text == '"OK"' :
494+ return True
495+ return False
496+ #end define
497+
488498def enable_ton_http_api (local ):
489- local .add_log ("start EnableTonHttpApi function" , "debug" )
499+ try :
500+ if not tha_exists ():
501+ enable_ton_http_api (local )
502+ except Exception as e :
503+ local .add_log (f"Error in enable_ton_http_api: { e } " , "warning" )
504+ pass
505+ #end define
506+
507+ def do_enable_ton_http_api (local ):
508+ local .add_log ("start do_enable_ton_http_api function" , "debug" )
490509 if not os .path .exists ('/usr/bin/ton/local.config.json' ):
491510 from mytoninstaller .mytoninstaller import CreateLocalConfigFile
492511 CreateLocalConfigFile (local , [])
493512 ton_http_api_installer_path = pkg_resources .resource_filename ('mytoninstaller.scripts' , 'ton_http_api_installer.sh' )
494513 exit_code = run_as_root (["bash" , ton_http_api_installer_path ])
495514 if exit_code == 0 :
496- text = "EnableTonHttpApi - {green}OK{endc}"
515+ text = "do_enable_ton_http_api - {green}OK{endc}"
497516 else :
498- text = "EnableTonHttpApi - {red}Error{endc}"
517+ text = "do_enable_ton_http_api - {red}Error{endc}"
499518 color_print (text )
500519#end define
501520
Original file line number Diff line number Diff line change 22import json
33import time
44import subprocess
5-
6- import requests
75from nacl .signing import SigningKey
86
97
@@ -52,25 +50,3 @@ def get_ed25519_pubkey(privkey):
5250 pubkey = privkey_obj .verify_key .encode ()
5351 return pubkey
5452#end define
55-
56-
57- def tha_exists ():
58- try :
59- resp = requests .get ('http://127.0.0.1:8801/healthcheck' , timeout = 3 )
60- except :
61- return False
62- if resp .status_code == 200 and resp .text == '"OK"' :
63- return True
64- return False
65-
66-
67- def enable_tha (local ):
68- try :
69- if not tha_exists ():
70- local .add_log ("Enabling TON HTTP API" , "debug" )
71- from mytoninstaller .settings import enable_ton_http_api
72- enable_ton_http_api (local )
73- local .add_log ("Enabled TON HTTP API" , "debug" )
74- except Exception as e :
75- local .add_log (f"Error in enable_tha: { e } " , "warning" )
76- pass
You can’t perform that action at this time.
0 commit comments