Skip to content

Commit 3c53e6e

Browse files
committed
add validator installation mode
1 parent bea19f9 commit 3c53e6e

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

modules/liteserver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
class LiteserverModule(MtcModule):
77

8-
description = 'For liteserver usage only - can\'t be used with validator.'
8+
description = 'For liteserver usage only without validator.'
99
default_value = False
1010

1111
def add_console_commands(self, console):

mytoncore/functions.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def Event(local, event_name):
5757
enable_ton_storage_provider_event(local)
5858
elif event_name == "enable_liteserver_mode":
5959
enable_liteserver_mode(local)
60+
elif event_name == "enable_validator_mode":
61+
enable_validator_mode(local)
6062
local.exit()
6163
# end define
6264

@@ -93,10 +95,17 @@ def enable_ton_storage_provider_event(local):
9395
#end define
9496

9597

98+
def enable_validator_mode(local):
99+
from mytoninstaller.mytoninstaller import set_node_argument
100+
set_node_argument(local, ['--archive-ttl', '86400']) # limit validator archive ttl to 1 day
101+
102+
96103
def enable_liteserver_mode(local):
104+
from mytoninstaller.mytoninstaller import set_node_argument
97105
ton = MyTonCore(local)
98106
ton.disable_mode('validator')
99107
ton.enable_mode('liteserver')
108+
set_node_argument(local, ['--archive-ttl', '2592000']) # limit liteserver archive ttl to 30 days
100109
#end define
101110

102111

mytoninstaller/settings.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,9 @@ def CreateSymlinks(local):
891891

892892

893893
def EnableMode(local):
894+
args = ["python3", "-m", "mytoncore", "-e"]
894895
if local.buffer.mode == 'liteserver':
895-
args = ["python3", "-m", "mytoncore", "-e", "enable_liteserver_mode"]
896-
subprocess.run(args)
896+
args.append("enable_liteserver_mode")
897+
elif local.buffer.mode == 'validator':
898+
args.append("enable_validator_mode")
899+
subprocess.run(args)

0 commit comments

Comments
 (0)