File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -352,12 +352,22 @@ impl StateService {
352352 // aren't blocks in the restored non-finalized state that are above the max checkpoint height,
353353 // otherwise, unless checkpoint sync is disabled in the zebra-consensus configuration,
354354 // Zebra will be unable to commit checkpoint verified blocks, and its chain sync will stall.
355- let is_finalized_tip_past_max_checkpoint = if let Some ( tip ) = & finalized_tip {
356- tip . coinbase_height ( ) . expect ( "valid block must have height" ) >= max_checkpoint_height
357- } else {
358- false
359- } ;
355+ let finalized_tip_height = finalized_tip
356+ . as_ref ( )
357+ . map ( |tip| tip . coinbase_height ( ) . expect ( "valid block must have height" ) ) ;
358+ let is_finalized_tip_past_max_checkpoint =
359+ finalized_tip_height . is_some_and ( |tip_height| tip_height >= max_checkpoint_height ) ;
360360 let backup_dir_path = config. non_finalized_state_backup_dir ( network) ;
361+
362+ if backup_dir_path. is_some ( ) && !is_finalized_tip_past_max_checkpoint {
363+ tracing:: info!(
364+ ?finalized_tip_height,
365+ ?max_checkpoint_height,
366+ "not restoring the non-finalized state backup, because the finalized tip is absent \
367+ or below the max checkpoint height: Zebra will re-download and re-verify the \
368+ blocks above its finalized tip"
369+ ) ;
370+ }
361371 let skip_backup_task = config. debug_skip_non_finalized_state_backup_task ;
362372 let ( non_finalized_state, non_finalized_state_sender, non_finalized_state_receiver) =
363373 NonFinalizedState :: new ( network)
Original file line number Diff line number Diff line change @@ -175,7 +175,14 @@ impl NonFinalizedState {
175175 return with_watch_channel ( self ) ;
176176 } ;
177177
178- if skip_backup_task {
178+ if !should_restore_backup {
179+ tracing:: info!(
180+ ?backup_dir_path,
181+ spawning_backup_task = !skip_backup_task,
182+ "not restoring non-finalized blocks from backup, any backed up blocks that are \
183+ missing from the non-finalized state will be deleted"
184+ ) ;
185+ } else if skip_backup_task {
179186 tracing:: info!(
180187 ?backup_dir_path,
181188 "restoring non-finalized blocks from backup (sync write mode, backup task skipped)"
@@ -221,6 +228,8 @@ impl NonFinalizedState {
221228 ?num_blocks_restored,
222229 "restored blocks from non-finalized backup cache"
223230 ) ;
231+ } else if should_restore_backup {
232+ tracing:: info!( "no blocks were restored from the non-finalized backup cache" ) ;
224233 }
225234
226235 ( non_finalized_state, sender, receiver)
You can’t perform that action at this time.
0 commit comments