File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Expand file tree Collapse file tree 2 files changed +27
-2
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+
3638
3739class MyTonCore ():
3840 def __init__ (self , local ):
@@ -3079,8 +3081,7 @@ def check_enable_mode(self, name):
30793081 raise Exception (f'Cannot enable validator mode while liteserver mode is enabled. '
30803082 f'Use `disable_mode liteserver` first.' )
30813083 if name == 'liquid-staking' :
3082- from mytoninstaller .settings import enable_ton_http_api
3083- enable_ton_http_api (self .local )
3084+ enable_tha (self .local )
30843085
30853086 def enable_mode (self , name ):
30863087 if name not in MODES :
Original file line number Diff line number Diff line change 22import json
33import time
44import subprocess
5+
6+ import requests
57from nacl .signing import SigningKey
68
79
@@ -50,3 +52,25 @@ def get_ed25519_pubkey(privkey):
5052 pubkey = privkey_obj .verify_key .encode ()
5153 return pubkey
5254#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