@@ -451,13 +451,13 @@ async fn live_sync_backfill_and_purge(
451
451
return ;
452
452
} ;
453
453
454
+ stats:: new_mithril_update ( cfg. chain , update. tip . slot_or_default ( ) ) ;
455
+
454
456
debug ! (
455
457
"Before Backfill: Size of the Live Chain is: {} Blocks" ,
456
458
live_chain_length( cfg. chain)
457
459
) ;
458
460
459
- let live_chain_head: Point ;
460
-
461
461
loop {
462
462
// We will re-attempt backfill, until its successful.
463
463
// 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(
467
467
sleep ( Duration :: from_secs ( 10 ) ) . await ;
468
468
}
469
469
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 ( ) {
472
471
break ;
473
472
}
474
473
}
475
474
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 ) ;
482
477
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" , ) ;
487
479
488
480
// Once Backfill is completed OK we can use the Blockchain data for Syncing and Querying
489
481
sync_ready. signal ( ) ;
@@ -501,6 +493,8 @@ async fn live_sync_backfill_and_purge(
501
493
update_sender = get_chain_update_tx_queue ( cfg. chain ) . await ;
502
494
}
503
495
496
+ stats:: new_mithril_update ( cfg. chain , update. tip . slot_or_default ( ) ) ;
497
+
504
498
debug ! ( "Mithril Tip has advanced to: {update:?} : PURGE NEEDED" ) ;
505
499
506
500
let update_point: Point = update. tip . clone ( ) ;
@@ -510,9 +504,11 @@ async fn live_sync_backfill_and_purge(
510
504
error ! ( "Mithril Purge Failed: {}" , error) ;
511
505
}
512
506
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
+
513
510
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." ,
516
512
) ;
517
513
518
514
// Trigger any sleeping followers that data has changed.
0 commit comments