From b14e630869a70ba51a15ce4b3f691f8256748327 Mon Sep 17 00:00:00 2001 From: yourmoonlight Date: Thu, 21 Jul 2022 15:24:23 +0800 Subject: [PATCH] the db exporter has a 1000 block gap, so export height should at least 1000 lower then latest height --- scripts/sync_block.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/sync_block.py b/scripts/sync_block.py index d7c925fefe..464a795c76 100644 --- a/scripts/sync_block.py +++ b/scripts/sync_block.py @@ -7,7 +7,6 @@ import argparse - def get_height(method, url, post_data, headers): parsed_url = urllib.parse.urlparse(url) @@ -44,8 +43,9 @@ def check_or_do(network): current_height = get_height(method, url, post_data, headers) print("main current_height is %s, last_export_height is %s" % (current_height, last_export_height)) + export_height = int(current_height) - 1000 - if int(current_height) - int(last_export_height) > 10000: + if export_height - int(last_export_height) > 10000: # export block, kubectl exec export_tmp = "kubectl exec -it -n starcoin-%s starcoin-1 -- /starcoin/starcoin_db_exporter export-block-range --db-path /sc-data/%s -s %s -e %s -n %s -o /sc-data/." @@ -55,7 +55,6 @@ def check_or_do(network): print(export_cmd) os.system(export_cmd) - # tar block csv file filename = "block_%s_%s.csv" % (start, end) file_compress_name = "%s.tar.gz" % filename