@@ -451,13 +451,13 @@ async fn live_sync_backfill_and_purge(
451451 return ;
452452 } ;
453453
454+ stats:: new_mithril_update ( cfg. chain , update. tip . slot_or_default ( ) ) ;
455+
454456 debug ! (
455457 "Before Backfill: Size of the Live Chain is: {} Blocks" ,
456458 live_chain_length( cfg. chain)
457459 ) ;
458460
459- let live_chain_head: Point ;
460-
461461 loop {
462462 // We will re-attempt backfill, until its successful.
463463 // Backfill is atomic, it either fully works, or none of the live-chain is changed.
@@ -467,23 +467,15 @@ async fn live_sync_backfill_and_purge(
467467 sleep ( Duration :: from_secs ( 10 ) ) . await ;
468468 }
469469
470- if let Some ( head_point) = get_live_head_point ( cfg. chain ) {
471- live_chain_head = head_point;
470+ if get_live_head_point ( cfg. chain ) . is_some ( ) {
472471 break ;
473472 }
474473 }
475474
476- stats:: new_mithril_update (
477- cfg. chain ,
478- update. tip . slot_or_default ( ) ,
479- live_chain_length ( cfg. chain ) as u64 ,
480- live_chain_head. slot_or_default ( ) ,
481- ) ;
475+ let new_live_chain_length = live_chain_length ( cfg. chain ) ;
476+ stats:: new_live_total_blocks ( cfg. chain , new_live_chain_length as u64 ) ;
482477
483- debug ! (
484- "After Backfill: Size of the Live Chain is: {} Blocks" ,
485- live_chain_length( cfg. chain)
486- ) ;
478+ debug ! ( "After Backfill: Size of the Live Chain is: {new_live_chain_length} Blocks" , ) ;
487479
488480 // Once Backfill is completed OK we can use the Blockchain data for Syncing and Querying
489481 sync_ready. signal ( ) ;
@@ -501,6 +493,8 @@ async fn live_sync_backfill_and_purge(
501493 update_sender = get_chain_update_tx_queue ( cfg. chain ) . await ;
502494 }
503495
496+ stats:: new_mithril_update ( cfg. chain , update. tip . slot_or_default ( ) ) ;
497+
504498 debug ! ( "Mithril Tip has advanced to: {update:?} : PURGE NEEDED" ) ;
505499
506500 let update_point: Point = update. tip . clone ( ) ;
@@ -510,9 +504,11 @@ async fn live_sync_backfill_and_purge(
510504 error ! ( "Mithril Purge Failed: {}" , error) ;
511505 }
512506
507+ let new_live_chain_length = live_chain_length ( cfg. chain ) ;
508+ stats:: new_live_total_blocks ( cfg. chain , new_live_chain_length as u64 ) ;
509+
513510 debug ! (
514- "After Purge: Size of the Live Chain is: {} Blocks: Triggering Sleeping Followers." ,
515- live_chain_length( cfg. chain)
511+ "After Purge: Size of the Live Chain is: {new_live_chain_length} Blocks: Triggering Sleeping Followers." ,
516512 ) ;
517513
518514 // Trigger any sleeping followers that data has changed.
0 commit comments