Skip to content

Commit 857b5a5

Browse files
committed
bugfix
update mypylib (local.exit bugfix) GetValidatorProcessInfo bugfix (if validator down) add wallet deletion confirmation add priority to use IPv4 address
1 parent c789ebc commit 857b5a5

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

mypylib

Submodule mypylib updated 1 file

mytoncore.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4044,6 +4044,8 @@ def GetSwapInfo():
40444044

40454045
def GetValidatorProcessInfo():
40464046
pid = get_service_pid("validator")
4047+
if pid == None or pid == 0:
4048+
return
40474049
p = psutil.Process(pid)
40484050
mem = p.memory_info()
40494051
result = dict()

mytonctrl.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,9 @@ def DeleteWallet(args):
686686
except:
687687
color_print("{red}Bad args. Usage:{endc} dw <wallet-name>")
688688
return
689+
if input("Are you sure you want to delete this wallet (yes/no): ") != "yes":
690+
print("Cancel wallet deletion")
691+
return
689692
wallet = ton.GetLocalWallet(walletName)
690693
wallet.Delete()
691694
color_print("DeleteWallet - {green}OK{endc}")

mytoninstaller.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ def DRVCF(args):
101101
run_as_root(args)
102102
#end define
103103

104+
def get_own_ip():
105+
requests.packages.urllib3.util.connection.HAS_IPV6 = False
106+
ip = requests.get("https://ifconfig.me/ip").text
107+
return ip
108+
#end define
109+
104110
def GetLiteServerConfig():
105111
keys_dir = local.buffer.keys_dir
106112
liteserver_key = keys_dir + "liteserver"
@@ -110,7 +116,7 @@ def GetLiteServerConfig():
110116
data = file.read()
111117
file.close()
112118
key = base64.b64encode(data[4:])
113-
ip = requests.get("https://ifconfig.me").text
119+
ip = get_own_ip()
114120
mconfig = GetConfig(path=local.buffer.mconfig_path)
115121
result.ip = ip2int(ip)
116122
result.port = mconfig.liteClient.liteServer.port
@@ -278,7 +284,7 @@ def FirstNodeSettings():
278284
add2systemd(name="validator", user=vuser, start=cmd) # post="/usr/bin/python3 /usr/src/mytonctrl/mytoncore.py -e \"validator down\""
279285

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

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

0 commit comments

Comments
 (0)