File tree Expand file tree Collapse file tree 1 file changed +8
-14
lines changed
Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -1728,22 +1728,16 @@ func (ls *LedgerState) ledgerProcessBlocks() {
17281728 if rolloverResult != nil && ls .config .EventBus != nil {
17291729 newEpochId := rolloverResult .NewCurrentEpoch .EpochId
17301730
1731- // Use MarkEpochEmitted to coordinate with slot-based detection.
1732- // If slot clock already emitted this epoch event (when synced),
1733- // we skip emitting again to avoid duplicates.
1734- shouldEmit := true
1731+ // Always emit block-based epoch transitions. Even if the
1732+ // slot clock already emitted an event for this epoch, the
1733+ // block-based event is needed because it fires AFTER the
1734+ // epoch nonce has been computed. Subscribers (leader
1735+ // election, snapshot manager) use drain logic to handle
1736+ // duplicates, keeping only the latest event.
17351737 if ls .slotClock != nil {
1736- shouldEmit = ls .slotClock .MarkEpochEmitted (newEpochId )
1737- if ! shouldEmit {
1738- ls .config .Logger .Debug (
1739- "block-based epoch transition skipped (already emitted by slot clock)" ,
1740- "epoch" ,
1741- newEpochId ,
1742- )
1743- }
1738+ ls .slotClock .MarkEpochEmitted (newEpochId )
17441739 }
1745-
1746- if shouldEmit {
1740+ {
17471741 // Calculate snapshot slot (boundary - 1, or 0 if boundary is 0)
17481742 snapshotSlot := rolloverResult .NewCurrentEpoch .StartSlot
17491743 if snapshotSlot > 0 {
You can’t perform that action at this time.
0 commit comments