Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
update mypylib (local.exit bugfix)
GetValidatorProcessInfo bugfix (if validator down)
add wallet deletion confirmation
add priority to use IPv4 address
  • Loading branch information
igroman787 committed Aug 30, 2023
1 parent c789ebc commit 857b5a5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mypylib
Submodule mypylib updated 1 files
+1 −1 mypylib.py
2 changes: 2 additions & 0 deletions mytoncore.py
Original file line number Diff line number Diff line change
Expand Up @@ -4044,6 +4044,8 @@ def GetSwapInfo():

def GetValidatorProcessInfo():
pid = get_service_pid("validator")
if pid == None or pid == 0:
return
p = psutil.Process(pid)
mem = p.memory_info()
result = dict()
Expand Down
3 changes: 3 additions & 0 deletions mytonctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,9 @@ def DeleteWallet(args):
except:
color_print("{red}Bad args. Usage:{endc} dw <wallet-name>")
return
if input("Are you sure you want to delete this wallet (yes/no): ") != "yes":
print("Cancel wallet deletion")
return
wallet = ton.GetLocalWallet(walletName)
wallet.Delete()
color_print("DeleteWallet - {green}OK{endc}")
Expand Down
14 changes: 10 additions & 4 deletions mytoninstaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ def DRVCF(args):
run_as_root(args)
#end define

def get_own_ip():
requests.packages.urllib3.util.connection.HAS_IPV6 = False
ip = requests.get("https://ifconfig.me/ip").text
return ip
#end define

def GetLiteServerConfig():
keys_dir = local.buffer.keys_dir
liteserver_key = keys_dir + "liteserver"
Expand All @@ -110,7 +116,7 @@ def GetLiteServerConfig():
data = file.read()
file.close()
key = base64.b64encode(data[4:])
ip = requests.get("https://ifconfig.me").text
ip = get_own_ip()
mconfig = GetConfig(path=local.buffer.mconfig_path)
result.ip = ip2int(ip)
result.port = mconfig.liteClient.liteServer.port
Expand Down Expand Up @@ -278,7 +284,7 @@ def FirstNodeSettings():
add2systemd(name="validator", user=vuser, start=cmd) # post="/usr/bin/python3 /usr/src/mytonctrl/mytoncore.py -e \"validator down\""

# Получить внешний ip адрес
ip = requests.get("https://ifconfig.me").text
ip = get_own_ip()
vport = random.randint(2000, 65000)
addr = "{ip}:{vport}".format(ip=ip, vport=vport)
local.add_log("Use addr: " + addr, "debug")
Expand Down Expand Up @@ -682,7 +688,7 @@ def DangerousRecoveryValidatorConfigFile():
# Create addrs object
buff = Dict()
buff["@type"] = "engine.addr"
buff.ip = ip2int(requests.get("https://ifconfig.me").text)
buff.ip = ip2int(get_own_ip())
buff.port = None
buff.categories = [0, 1, 2, 3]
buff.priority_categories = []
Expand Down Expand Up @@ -934,7 +940,7 @@ def EnableDhtServer():
add2systemd(name="dht-server", user=vuser, start=cmd)

# Получить внешний ip адрес
ip = requests.get("https://ifconfig.me").text
ip = get_own_ip()
port = random.randint(2000, 65000)
addr = "{ip}:{port}".format(ip=ip, port=port)

Expand Down

0 comments on commit 857b5a5

Please sign in to comment.