@@ -561,7 +561,18 @@ func (i *Indexer) runChainTail() error {
561561 }
562562 }
563563
564- // Full mode: run historical sync before starting adder pipeline
564+ // Start live tail immediately so block notifications work during historical sync.
565+ // Nonce processing is gated by historicalSyncDone so the tracker isn't corrupted.
566+ if fullMode && len (i .nodeAddresses ) > 0 {
567+ go func () {
568+ log .Println ("Starting live tail (notifications active during historical sync)..." )
569+ if err := i .startLiveTail (); err != nil {
570+ log .Printf ("Live tail error: %v" , err )
571+ }
572+ }()
573+ }
574+
575+ // Full mode: run historical sync (live tail already running for notifications)
565576 if fullMode && len (i .nodeAddresses ) > 0 {
566577 log .Println ("Starting historical chain sync..." )
567578 syncCtx , syncCancel := context .WithCancel (context .Background ())
@@ -695,8 +706,14 @@ func (i *Indexer) runChainTail() error {
695706 }()
696707 }
697708
698- // Start live tail for chain tip (both full and lite mode)
699- return i .startLiveTail ()
709+ // In full mode, live tail was started before historical sync (above).
710+ // In lite mode, start it now.
711+ if ! fullMode {
712+ return i .startLiveTail ()
713+ }
714+
715+ // Full mode: block forever (live tail runs in its own goroutine)
716+ select {}
700717}
701718
702719// startLiveTail starts the live chain tail using raw gouroboros NtN ChainSync.
@@ -894,8 +911,9 @@ func (i *Indexer) handleRollForward(ctx chainsync.CallbackContext, blockType uin
894911 i .epochBlocks = 0
895912 }
896913
897- // Track VRF data for nonce evolution
898- if i .leaderlogEnabled && vrfOutput != nil {
914+ // Track VRF data for nonce evolution (only after historical sync completes,
915+ // otherwise historical and live tail would corrupt the nonce tracker's in-memory state)
916+ if i .leaderlogEnabled && vrfOutput != nil && atomic .LoadInt32 (& i .historicalSyncDone ) == 1 {
899917 i .nonceTracker .ProcessBlock (slot , blockEpoch , blockHash , vrfOutput )
900918 i .checkLeaderlogTrigger (slot )
901919 }
0 commit comments