@@ -74,6 +74,7 @@ def inject_globals(func):
7474 console .AddItem ("disable_mode" , inject_globals (disable_mode ), local .translate ("disable_mode_cmd" ))
7575 console .AddItem ("get" , inject_globals (GetSettings ), local .translate ("get_cmd" ))
7676 console .AddItem ("set" , inject_globals (SetSettings ), local .translate ("set_cmd" ))
77+ console .AddItem ("rollback" , inject_globals (rollback_to_mtc1 ), local .translate ("rollback_cmd" ))
7778
7879 console .AddItem ("seqno" , inject_globals (Seqno ), local .translate ("seqno_cmd" ))
7980 console .AddItem ("getconfig" , inject_globals (GetConfig ), local .translate ("getconfig_cmd" ))
@@ -325,6 +326,17 @@ def Upgrade(ton, args):
325326 color_print (text )
326327#end define
327328
329+ def rollback_to_mtc1 (ton , args ):
330+ color_print ("{red}Warning: this is dangerous, please make sure you've backed up mytoncore's db.{endc}" )
331+ a = input ("Do you want to continue? [Y/n]" )
332+ if a .lower () != 'y' :
333+ print ('aborted.' )
334+ return
335+ ton .rollback_modes ()
336+ rollback_script_path = pkg_resources .resource_filename ('mytonctrl' , 'migrations/roll_back_001.sh' )
337+ run_args = ["bash" , rollback_script_path ]
338+ exit_code = run_as_root (run_args )
339+
328340def cleanup_validator_db (ton , args ):
329341 cleanup_script_path = pkg_resources .resource_filename ('mytonctrl' , 'scripts/cleanup.sh' )
330342 run_args = ["bash" , cleanup_script_path ]
@@ -1215,7 +1227,8 @@ def SetSettings(ton, args):
12151227 return
12161228 if name == 'usePool' or name == 'useController' :
12171229 mode_name = 'nominator-pool' if name == 'usePool' else 'liquid-staking'
1218- color_print ("{red}" + f"Error: set { name } ... is deprecated and does not work" + "{endc}" + f"\n Instead, use <bold>enable_mode { mode_name } <endc>" )
1230+ color_print (f"{{red}} Error: set { name } ... is deprecated and does not work {{endc}}."
1231+ f"\n Instead, use {{bold}}enable_mode { mode_name } {{endc}}" )
12191232 return
12201233 ton .SetSettings (name , value )
12211234 color_print ("SetSettings - {green}OK{endc}" )
0 commit comments