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 3, 2024
1 parent cfb325b commit 3958b3e
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,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 @@ -168,8 +168,12 @@ 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 $
readTVar varLoEFrag <* writeTVar 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 3958b3e

Please sign in to comment.