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 @@ -91,15 +91,25 @@ def FirstNodeSettings(local):
9191 StartValidator (local )
9292#end define
9393
94+ def is_testnet (local ):
95+ testnet_zero_state_root_hash = "gj+B8wb/AmlPk1z1AhVI484rhrUpgSr2oSFIh56VoSg="
96+ with open (local .buffer .global_config_path ) as f :
97+ config = json .load (f )
98+ if config ['validator' ]['zero_state' ]['root_hash' ] == testnet_zero_state_root_hash :
99+ return True
100+ return False
101+
94102def DownloadDump (local ):
95103 dump = local .buffer .dump
96- if dump == False :
104+ if dump is False :
97105 return
98106 #end if
99107
100108 local .add_log ("start DownloadDump function" , "debug" )
101- url = "https://dump.ton.org"
102- dumpSize = requests .get (url + "/dumps/latest.tar.size.archive.txt" ).text
109+ url = "https://dump.ton.org/dumps/latest"
110+ if is_testnet (local ):
111+ url += '_testnet'
112+ dumpSize = requests .get (url + ".tar.size.archive.txt" ).text
103113 print ("dumpSize:" , dumpSize )
104114 needSpace = int (dumpSize ) * 3
105115 diskSpace = psutil .disk_usage ("/var" )
@@ -113,7 +123,7 @@ def DownloadDump(local):
113123
114124 # download dump using aria2c to a temporary file
115125 temp_file = "/tmp/latest.tar.lz"
116- cmd = f"aria2c -x 8 -s 8 -c { url } /dumps/latest .tar.lz -d / -o { temp_file } "
126+ cmd = f"aria2c -x 8 -s 8 -c { url } .tar.lz -d / -o { temp_file } "
117127 os .system (cmd )
118128
119129 # process the downloaded file
You can’t perform that action at this time.
0 commit comments