Skip to content

Commit 2c68e2f

Browse files
committed
bugfix if the files are in the wrong place
1 parent c3f3119 commit 2c68e2f

File tree

4 files changed

+37
-6
lines changed

4 files changed

+37
-6
lines changed

mytonctrl.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,29 @@ def Update(args):
202202
def Upgrade(args):
203203
repo = "ton"
204204
author, repo, branch = check_git(args, repo, "upgrade")
205-
205+
206+
# bugfix if the files are in the wrong place
207+
liteClient = ton.GetSettings("liteClient")
208+
configPath = liteClient.get("configPath")
209+
pubkeyPath = liteClient.get("liteServer").get("pubkeyPath")
210+
if "ton-lite-client-test1" in configPath:
211+
liteClient["configPath"] = configPath.replace("lite-client/ton-lite-client-test1.config.json", "global.config.json")
212+
if "/usr/bin/ton" in pubkeyPath:
213+
liteClient["liteServer"]["pubkeyPath"] = "/var/ton-work/keys/liteserver.pub"
214+
ton.SetSettings("liteClient", liteClient)
215+
validatorConsole = ton.GetSettings("validatorConsole")
216+
privKeyPath = validatorConsole.get("privKeyPath")
217+
pubKeyPath = validatorConsole.get("pubKeyPath")
218+
if "/usr/bin/ton" in privKeyPath:
219+
validatorConsole["privKeyPath"] = "/var/ton-work/keys/client"
220+
if "/usr/bin/ton" in pubKeyPath:
221+
validatorConsole["pubKeyPath"] = "/var/ton-work/keys/server.pub"
222+
ton.SetSettings("validatorConsole", validatorConsole)
223+
206224
# Run script
207225
runArgs = ["bash", "/usr/src/mytonctrl/scripts/upgrade.sh", "-a", author, "-r", repo, "-b", branch]
208226
exitCode = run_as_root(runArgs)
227+
exitCode += run_as_root(["python3", "/usr/src/mytonctrl/scripts/upgrade.py"])
209228
if exitCode == 0:
210229
text = "Upgrade - {green}OK{endc}"
211230
else:

mytoninstaller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,5 +1049,5 @@ def b642dict(b64):
10491049
General()
10501050
else:
10511051
console.Run()
1052-
local.Exit()
1052+
local.exit()
10531053
#end if

scripts/upgrade.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from mypylib.mypylib import *
99

1010

11+
# validator.service
1112
file = open("/etc/systemd/system/validator.service", 'rt')
1213
text = file.read()
1314
file.close()
@@ -17,10 +18,8 @@
1718
line = lines[i]
1819
if "ExecStart" not in line:
1920
continue
20-
if " --threads " in line or " -t " in line:
21-
continue
22-
cpus = psutil.cpu_count() - 1
23-
lines[i] += " --threads {cpus}".format(cpus=cpus)
21+
if "ton-global.config.json" in line:
22+
lines[i] += line.replace("validator-engine/ton-global.config.json", "global.config.json")
2423
#end for
2524

2625
text = "\n".join(lines)

scripts/upgrade.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ ENDC='\033[0m'
3131
# Установить дополнительные зависимости
3232
apt-get install -y libsecp256k1-dev libsodium-dev ninja-build
3333

34+
# bugfix if the files are in the wrong place
35+
wget "https://ton-blockchain.github.io/global.config.json" -O global.config.json
36+
if [ -f "/var/ton-work/keys/liteserver.pub" ]; then
37+
echo "Ok"
38+
else
39+
echo "bugfix"
40+
mkdir /var/ton-work/keys
41+
cp /usr/bin/ton/validator-engine-console/client /var/ton-work/keys/client
42+
cp /usr/bin/ton/validator-engine-console/client.pub /var/ton-work/keys/client.pub
43+
cp /usr/bin/ton/validator-engine-console/server.pub /var/ton-work/keys/server.pub
44+
cp /usr/bin/ton/validator-engine-console/liteserver.pub /var/ton-work/keys/liteserver.pub
45+
fi
46+
3447
# Go to work dir
3548
cd ${srcdir}
3649
rm -rf ${srcdir}/${repo}

0 commit comments

Comments
 (0)