Skip to content

Commit

Permalink
Don't retrigger chain selection if the tip of the loe fragment doesn'…
Browse files Browse the repository at this point in the history
…t change
  • Loading branch information
facundominguez committed May 30, 2024
1 parent 82376e6 commit 64f3da3
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module Ouroboros.Consensus.Genesis.Governor (
, updateLoEFragUnconditional
) where

import Control.Monad (guard)
import Control.Monad (guard, when)
import Control.Tracer (Tracer, traceWith)
import Data.Containers.ListUtils (nubOrd)
import Data.Foldable (for_)
Expand Down Expand Up @@ -163,8 +163,11 @@ runGdd loEUpdater varLoEFrag chainDb getTrigger =
curLedger <- ChainDB.getCurrentLedger chainDb
pure (newTrigger, curChain, curLedger)
loeFrag <- updateLoEFrag loEUpdater curChain curLedger
atomically $ writeTVar varLoEFrag loeFrag
triggerChainSelectionAsync chainDb
oldLoEFrag <- atomically $ swapTVar varLoEFrag loeFrag
-- The chain selection only depends on the LoE tip, so there
-- is no point in retriggering it if the LoE tip hasn't changed.
when (AF.headHash oldLoEFrag /= AF.headHash loeFrag) $
triggerChainSelectionAsync chainDb
spin newTrigger

data DensityBounds blk =
Expand Down

0 comments on commit 64f3da3

Please sign in to comment.