Skip to content

Commit 647f34e

Browse files
committed
add add-shard to installer
1 parent 37593eb commit 647f34e

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

mytoninstaller/settings.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ def FirstNodeSettings(local):
6363
# Прописать автозагрузку
6464
cpus = psutil.cpu_count() - 1
6565
cmd = f"{validatorAppPath} --threads {cpus} --daemonize --global-config {globalConfigPath} --db {ton_db_dir} --logname {tonLogPath} --archive-ttl {archive_ttl} --verbosity 1"
66+
67+
if os.getenv('ADD_SHARD'):
68+
add_shard = os.getenv('ADD_SHARD')
69+
cmd += f' -M'
70+
for shard in add_shard.split():
71+
cmd += f' --add-shard {shard}'
72+
6673
add2systemd(name="validator", user=vuser, start=cmd) # post="/usr/bin/python3 /usr/src/mytonctrl/mytoncore.py -e \"validator down\""
6774

6875
# Получить внешний ip адрес

scripts/install.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ def run_cli():
3838
"dump",
3939
message="Do you want to download blockchain's dump? "
4040
"This reduces synchronization time but requires to download a large file",
41+
),
42+
inquirer.Text(
43+
"add-shard",
44+
message="Set shards node will sync. Skip to sync all shards. "
45+
"Format: <workchain>:<shard>. Divide multiple shards with space. "
46+
"Example: `0:2000000000000000 0:6000000000000000`",
47+
validate=lambda _, x: not x or all([":" in i for i in x.split()])
4148
)
4249
]
4350

@@ -51,6 +58,7 @@ def parse_args(answers: dict):
5158
network = answers["network"].lower()
5259
config = answers["config"]
5360
archive_ttl = answers["archive-ttl"]
61+
add_shard = answers["add-shard"]
5462
validator_mode = answers["validator-mode"]
5563
dump = answers["dump"]
5664

@@ -61,6 +69,8 @@ def parse_args(answers: dict):
6169

6270
if archive_ttl:
6371
os.putenv('ARCHIVE_TTL', archive_ttl) # set env variable
72+
if add_shard:
73+
os.putenv('ADD_SHARD', add_shard)
6474

6575
if validator_mode and validator_mode not in ('Skip', 'Validator wallet'):
6676
if validator_mode == 'Nominator pool':

0 commit comments

Comments
 (0)