Skip to content

Commit 242f513

Browse files
authored
GDD: use new AF.splitAtSlot (#1231)
With #1207 merged, we can use `AF.splitAtSlot` which was introduced for the use in the GDD by @facundominguez in IntersectMBO/ouroboros-network#4884.
2 parents 3da919f + 491595b commit 242f513

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Patch
2+
3+
- Used new `AF.splitAtSlot` function in GDD.

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Genesis/Governor.hs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ densityDisconnect (GenesisWindow sgen) (SecurityParam k) states candidateSuffixe
302302
where
303303
densityBounds = do
304304
(peer, candidateSuffix) <- candidateSuffixes
305-
let clippedFragment = dropBeyondGenesisWindow candidateSuffix
305+
let (clippedFragment, _) =
306+
AF.splitAtSlot firstSlotAfterGenesisWindow candidateSuffix
306307
state <- maybeToList (states Map.!? peer)
307308
-- Skip peers that haven't sent any headers yet.
308309
-- They should be disconnected by timeouts instead.
@@ -400,11 +401,6 @@ densityDisconnect (GenesisWindow sgen) (SecurityParam k) states candidateSuffixe
400401
firstSlotAfterGenesisWindow =
401402
succWithOrigin loeIntersectionSlot + SlotNo sgen
402403

403-
-- This is performance sensitive. We used to call @takeWhileOldest@ here,
404-
-- which would reconstruct much of the original fragment.
405-
dropBeyondGenesisWindow =
406-
AF.dropWhileNewest ((>= firstSlotAfterGenesisWindow) . blockSlot)
407-
408404
-- Note [Chain disagreement]
409405
-- ~~~~~~~~~~~~~~~~~~~~~~~~~
410406
--

0 commit comments

Comments
 (0)