|
15 | 15 | from mytoninstaller.config import GetLiteServerConfig, get_ls_proxy_config |
16 | 16 | from mytoninstaller.node_args import get_node_args |
17 | 17 | from mytoninstaller.utils import GetInitBlock |
18 | | -from mytoncore.utils import dict2b64, str2bool, b642dict |
| 18 | +from mytoncore.utils import dict2b64, str2bool, b642dict, b642hex |
19 | 19 |
|
20 | 20 | from mytoninstaller.settings import ( |
21 | 21 | FirstNodeSettings, |
@@ -196,10 +196,19 @@ def PrintLiteServerConfig(local, args): |
196 | 196 |
|
197 | 197 |
|
198 | 198 | def CreateLocalConfigFile(local, args): |
199 | | - initBlock = GetInitBlock() |
200 | | - initBlock_b64 = dict2b64(initBlock) |
| 199 | + init_block = GetInitBlock() |
| 200 | + if init_block['rootHash'] is None: |
| 201 | + local.add_log("Failed to get recent init block. Using init block from global config.", "warning") |
| 202 | + with open('/usr/bin/ton/global.config.json', 'r') as f: |
| 203 | + config = json.load(f) |
| 204 | + config_init_block = config['validator']['init_block'] |
| 205 | + init_block = dict() |
| 206 | + init_block["seqno"] = config_init_block['seqno'] |
| 207 | + init_block["rootHash"] = b642hex(config_init_block['root_hash']) |
| 208 | + init_block["fileHash"] = b642hex(config_init_block['file_hash']) |
| 209 | + init_block_b64 = dict2b64(init_block) |
201 | 210 | user = local.buffer.user or os.environ.get("USER", "root") |
202 | | - args = ["python3", "-m", "mytoninstaller", "-u", user, "-e", "clc", "-i", initBlock_b64] |
| 211 | + args = ["python3", "-m", "mytoninstaller", "-u", user, "-e", "clc", "-i", init_block_b64] |
203 | 212 | run_as_root(args) |
204 | 213 | #end define |
205 | 214 |
|
|
0 commit comments