Skip to content

Commit

Permalink
GDD: use new AF.splitAtSlot (#1231)
Browse files Browse the repository at this point in the history
With #1207 merged, we can use `AF.splitAtSlot` which was introduced for
the use in the GDD by @facundominguez in
IntersectMBO/ouroboros-network#4884.
  • Loading branch information
amesgen authored Aug 29, 2024
2 parents 3da919f + 491595b commit 242f513
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Patch

- Used new `AF.splitAtSlot` function in GDD.
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ densityDisconnect (GenesisWindow sgen) (SecurityParam k) states candidateSuffixe
where
densityBounds = do
(peer, candidateSuffix) <- candidateSuffixes
let clippedFragment = dropBeyondGenesisWindow candidateSuffix
let (clippedFragment, _) =
AF.splitAtSlot firstSlotAfterGenesisWindow candidateSuffix
state <- maybeToList (states Map.!? peer)
-- Skip peers that haven't sent any headers yet.
-- They should be disconnected by timeouts instead.
Expand Down Expand Up @@ -400,11 +401,6 @@ densityDisconnect (GenesisWindow sgen) (SecurityParam k) states candidateSuffixe
firstSlotAfterGenesisWindow =
succWithOrigin loeIntersectionSlot + SlotNo sgen

-- This is performance sensitive. We used to call @takeWhileOldest@ here,
-- which would reconstruct much of the original fragment.
dropBeyondGenesisWindow =
AF.dropWhileNewest ((>= firstSlotAfterGenesisWindow) . blockSlot)

-- Note [Chain disagreement]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~
--
Expand Down

0 comments on commit 242f513

Please sign in to comment.