Skip to content

Commit

Permalink
Fix documentation of followsLoEFrag
Browse files Browse the repository at this point in the history
  • Loading branch information
Niols committed May 29, 2024
1 parent 7b023f1 commit 1fea816
Showing 1 changed file with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ import Ouroboros.Network.AnchoredFragment (Anchor, AnchoredFragment,
AnchoredSeq (..))
import qualified Ouroboros.Network.AnchoredFragment as AF
import qualified Ouroboros.Network.AnchoredSeq as AS
import qualified Data.Type.Bool as LoE

-- | Perform the initial chain selection based on the tip of the ImmutableDB
-- and the contents of the VolatileDB.
Expand Down Expand Up @@ -709,12 +710,21 @@ chainSelectionForBlock cdb@CDB{..} blockCache hdr punish = electric $ do
curTip = castPoint $ AF.headPoint curChain
curHead = AF.headAnchor curChain

-- Either frag extends loe or loe extends frag. The fragment is represented
-- by the current chain and a diff with that current chain. It is tempting
-- to only consider the suffix of the diff, but that would be incorrect,
-- because the diff might not intersect with the LoE fragment, because the
-- diff suffix is anchored somewhere on the current chain and LoE frag's tip
-- might be older than that anchor.
-- | Trim the given candidate fragment to respect the LoE.
--
-- The returned fragment is such that:
--
-- - It is a prefix of the given fragment.
-- - If it contains the tip of the LoE fragment, then it contains at most
-- @k@ block after it.
-- - If it does not contain the tip of the LoE fragment, then it is included
-- in the LoE fragment.
--
-- The fragment is represented by the current chain and a diff with that
-- current chain. It is tempting to only consider the suffix of the diff,
-- but that would be incorrect, because the diff might not intersect with
-- the LoE fragment, because the diff suffix is anchored somewhere on the
-- current chain and LoE frag's tip might be older than that anchor.
--
-- PRECONDITIONS:
--
Expand Down

0 comments on commit 1fea816

Please sign in to comment.