Skip to content

Commit b764a2e

Browse files
committed
add onlyNode flag
1 parent e61f3b5 commit b764a2e

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

modules/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class Setting:
6161
'ChatId': Setting('alert-bot', None, 'Alerting Telegram chat id'),
6262
'auto_backup': Setting('validator', None, 'Make validator backup every election'),
6363
'auto_backup_path': Setting('validator', '/tmp/mytoncore/auto_backups/', 'Path to store auto-backups'),
64+
'onlyNode': Setting(None, None, 'MyTonCtrl will work only for collecting validator telemetry (if `sendTelemetry` is True), without participating in Elections and etc.')
6465
}
6566

6667

mytoncore/functions.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,14 @@ def General(local):
551551
# scanner.Run()
552552

553553
# Start threads
554-
local.start_cycle(Elections, sec=600, args=(local, ton, ))
555554
local.start_cycle(Statistics, sec=10, args=(local, ))
555+
local.start_cycle(Telemetry, sec=60, args=(local, ton, ))
556+
local.start_cycle(OverlayTelemetry, sec=7200, args=(local, ton, ))
557+
if local.db.get("onlyNode"): # mytoncore service works only for telemetry
558+
thr_sleep()
559+
return
560+
561+
local.start_cycle(Elections, sec=600, args=(local, ton, ))
556562
local.start_cycle(Offers, sec=600, args=(local, ton, ))
557563
local.start_cycle(save_past_events, sec=300, args=(local, ton, ))
558564

@@ -562,8 +568,6 @@ def General(local):
562568
local.start_cycle(Complaints, sec=t, args=(local, ton, ))
563569
local.start_cycle(Slashing, sec=t, args=(local, ton, ))
564570

565-
local.start_cycle(Telemetry, sec=60, args=(local, ton, ))
566-
local.start_cycle(OverlayTelemetry, sec=7200, args=(local, ton, ))
567571
local.start_cycle(ScanLiteServers, sec=60, args=(local, ton,))
568572

569573
from modules.custom_overlays import CustomOverlayModule

mytoninstaller/settings.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,4 +976,8 @@ def ConfigureOnlyNode(local):
976976
return
977977
local.add_log("Backup successfully created. Use this file on the controller server with `--only-mtc` flag on installation.", "info")
978978

979-
stop_service(local, 'mytoncore')
979+
mconfig = GetConfig(path=mconfig_path)
980+
mconfig.onlyNode = True
981+
SetConfig(path=mconfig_path, data=mconfig)
982+
983+
start_service(local, 'mytoncore')

0 commit comments

Comments
 (0)