@@ -4,6 +4,7 @@ import { maxShredEvent, ShredEvent } from "../../../api/entities";
44import { delayMs , xRangeMs } from "./const" ;
55import { nsPerMs , slotsPerLeader } from "../../../consts" ;
66import { getSlotGroupLeader } from "../../../utils" ;
7+ import { startupFinalTurbineHeadAtom } from "../../StartupProgress/atoms" ;
78
89type ShredEventTsDeltaMs = number | undefined ;
910/**
@@ -40,17 +41,32 @@ export function createLiveShredsAtoms() {
4041 min : number ;
4142 max : number ;
4243 } > ( ) ;
44+ const rangeAfterStartupAtom = atom ( ( get ) => {
45+ const range = get ( _slotRangeAtom ) ;
46+ const startupFinalTurbineHead = get ( startupFinalTurbineHeadAtom ) ;
47+ if ( ! range || startupFinalTurbineHead == null ) return undefined ;
48+
49+ return {
50+ min : Math . max ( startupFinalTurbineHead + 1 , range . min ) ,
51+ max : Math . max ( startupFinalTurbineHead + 1 , range . max ) ,
52+ } ;
53+ } ) ;
4354 return {
4455 /**
4556 * min completed slot we've seen since we started collecting data
4657 */
4758 minCompletedSlot : atom ( ( get ) => get ( _minCompletedSlotAtom ) ) ,
4859 range : atom ( ( get ) => get ( _slotRangeAtom ) ) ,
60+ rangeAfterStartup : rangeAfterStartupAtom ,
61+ // leader slots after turbine head at the end of startup
4962 groupLeaderSlots : atom ( ( get ) => {
50- const range = get ( _slotRangeAtom ) ;
51- if ( ! range ) return [ ] ;
63+ const range = get ( rangeAfterStartupAtom ) ;
64+ const startupFinalTurbineHead = get ( startupFinalTurbineHeadAtom ) ;
65+ if ( ! range || startupFinalTurbineHead == null ) return [ ] ;
5266
53- const slots = [ getSlotGroupLeader ( range . min ) ] ;
67+ const min = Math . max ( startupFinalTurbineHead + 1 , range . min ) ;
68+
69+ const slots = [ getSlotGroupLeader ( min ) ] ;
5470 while ( slots [ slots . length - 1 ] + slotsPerLeader - 1 < range . max ) {
5571 slots . push (
5672 getSlotGroupLeader ( slots [ slots . length - 1 ] + slotsPerLeader ) ,
0 commit comments