|
56 | 56 | ] |
57 | 57 |
|
58 | 58 | ENDED_UP_ON_A_FORK_FLAG_NAME = "ended_up_on_a_fork" |
59 | | -STALE_BLOCK_BELOW_REORG_LIMIT_FLAG_NAME = "stale_block_below_reorg_limit" |
60 | 59 | NO_INCOMING_BLOCKS_WHILE_ON_STALE_CHAIN_FLAG_NAME = "no_incoming_blocks_while_on_stale_chain" |
61 | 60 |
|
62 | 61 | NODE_OUTPUT_LINE_NEW_TIP_REGEX = re.compile( |
63 | 62 | r"NEW TIP in chainstate (?P<block_id>[0-9A-Fa-f]+) with height (?P<height>\d+), timestamp: (?P<timestamp>\d+)" |
64 | 63 | ) |
65 | | -NODE_OUTPUT_LINE_STALE_BLOCK_RECEIVED_REGEX = re.compile( |
66 | | - r"Received stale block (?P<block_id>[0-9A-Fa-f]+) with height (?P<height>\d+), timestamp: (?P<timestamp>\d+)" |
67 | | -) |
68 | 64 |
|
69 | 65 | # The regex used to decide whether a node's output line should be printed to the console |
70 | 66 | # (we want to avoid debug and info lines since they're both too noisy during sync and put extra |
@@ -159,10 +155,10 @@ def do_full_sync(self): |
159 | 155 | self.restore_peer_db() |
160 | 156 |
|
161 | 157 | node_proc_env = os.environ.copy() |
162 | | - # Note: "chainstate_verbose_block_ids=debug" allows to catch the "Received stale block" line |
163 | | - # and also forces certain block-processing functions in chainstate to print full block ids. |
164 | | - # We avoid using the "normal" debug log, because it's too noisy, e.g. even |
165 | | - # "info,chainstate=debug" produces hundreds of megabytes of logs during the full sync. |
| 158 | + # Note: "chainstate_verbose_block_ids=debug" forces certain block-processing functions |
| 159 | + # in chainstate to print full block ids. We avoid using the "normal" debug log, because |
| 160 | + # it's too noisy, e.g. even "info,chainstate=debug" produces hundreds of megabytes of |
| 161 | + # logs during the full sync. |
166 | 162 | node_proc_env["RUST_LOG"] = "info,chainstate_verbose_block_ids=debug" |
167 | 163 |
|
168 | 164 | node_proc = subprocess.Popen( |
@@ -236,24 +232,6 @@ def on_node_output_line_or_timeout(line: Optional[str]): |
236 | 232 | ) |
237 | 233 | log_func(f"Tip reached, height = {height}{extra}") |
238 | 234 | return False |
239 | | - |
240 | | - elif (stale_block_received_match := NODE_OUTPUT_LINE_STALE_BLOCK_RECEIVED_REGEX.search(line)) is not None: |
241 | | - block_id = stale_block_received_match.group("block_id") |
242 | | - height = int(stale_block_received_match.group("height")) |
243 | | - |
244 | | - log.warn(f"Stale block received at height {height}: {block_id}") |
245 | | - |
246 | | - if actual_tip_height - height >= MAX_REORG_DEPTH: |
247 | | - # Note: this may mean 2 things: |
248 | | - # a) If we're on the proper chain, then we've found a peer who is on |
249 | | - # a fork, in which case we definitely want to create this flag. |
250 | | - # b) If we're on a fork, then the stale block may be from the proper |
251 | | - # chain, in which case the flag creation is redundant, because the code |
252 | | - # above or below should catch this situation; but it's not harmful either. |
253 | | - self.touch_flag( |
254 | | - STALE_BLOCK_BELOW_REORG_LIMIT_FLAG_NAME, |
255 | | - f"height={height}, block id={block_id}" |
256 | | - ) |
257 | 235 | else: |
258 | 236 | seconds_since_last_tip = ( |
259 | 237 | cur_seconds_since_epoch - last_tip_arrival_time |
|
0 commit comments