File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -88,15 +88,25 @@ def FirstNodeSettings(local):
8888 StartValidator (local )
8989#end define
9090
91+ def is_testnet (local ):
92+ testnet_zero_state_root_hash = "gj+B8wb/AmlPk1z1AhVI484rhrUpgSr2oSFIh56VoSg="
93+ with open (local .buffer .global_config_path ) as f :
94+ config = json .load (f )
95+ if config ['validator' ]['zero_state' ]['root_hash' ] == testnet_zero_state_root_hash :
96+ return True
97+ return False
98+
9199def DownloadDump (local ):
92100 dump = local .buffer .dump
93- if dump == False :
101+ if dump is False :
94102 return
95103 #end if
96104
97105 local .add_log ("start DownloadDump function" , "debug" )
98- url = "https://dump.ton.org"
99- dumpSize = requests .get (url + "/dumps/latest.tar.size.archive.txt" ).text
106+ url = "https://dump.ton.org/dumps/latest"
107+ if is_testnet (local ):
108+ url += '_testnet'
109+ dumpSize = requests .get (url + ".tar.size.archive.txt" ).text
100110 print ("dumpSize:" , dumpSize )
101111 needSpace = int (dumpSize ) * 3
102112 diskSpace = psutil .disk_usage ("/var" )
@@ -110,7 +120,7 @@ def DownloadDump(local):
110120
111121 # download dump using aria2c to a temporary file
112122 temp_file = "/tmp/latest.tar.lz"
113- cmd = f"aria2c -x 8 -s 8 -c { url } /dumps/latest .tar.lz -d / -o { temp_file } "
123+ cmd = f"aria2c -x 8 -s 8 -c { url } .tar.lz -d / -o { temp_file } "
114124 os .system (cmd )
115125
116126 # process the downloaded file
You can’t perform that action at this time.
0 commit comments