@@ -50,15 +50,17 @@ import Ouroboros.Network.SizeInBytes
50
50
51
51
-- | Abstract over the ChainDB
52
52
data ChainDbView m blk = ChainDbView {
53
- getCurrentChain :: STM m (AnchoredFragment (Header blk ))
53
+ getCurrentChain :: STM m (AnchoredFragment (Header blk ))
54
+ , getCurrentChainWithTime :: STM m (AnchoredFragment (HeaderWithTime blk ))
54
55
, getIsFetched :: STM m (Point blk -> Bool )
55
56
, getMaxSlotNo :: STM m MaxSlotNo
56
57
, addBlockWaitWrittenToDisk :: InvalidBlockPunishment m -> blk -> m Bool
57
58
}
58
59
59
60
defaultChainDbView :: IOLike m => ChainDB m blk -> ChainDbView m blk
60
61
defaultChainDbView chainDB = ChainDbView {
61
- getCurrentChain = ChainDB. getCurrentChain chainDB
62
+ getCurrentChain = ChainDB. getCurrentChain chainDB
63
+ , getCurrentChainWithTime = ChainDB. getCurrentChainWithTime chainDB
62
64
, getIsFetched = ChainDB. getIsFetched chainDB
63
65
, getMaxSlotNo = ChainDB. getMaxSlotNo chainDB
64
66
, addBlockWaitWrittenToDisk = ChainDB. addBlockWaitWrittenToDisk chainDB
@@ -182,7 +184,7 @@ mkBlockFetchConsensusInterface ::
182
184
-- ^ Slot forge time, see 'headerForgeUTCTime' and 'blockForgeUTCTime'.
183
185
-> STM m FetchMode
184
186
-- ^ See 'readFetchMode'.
185
- -> BlockFetchConsensusInterface peer (Header blk ) ( HeaderWithTime blk ) blk m
187
+ -> BlockFetchConsensusInterface peer (HeaderWithTime blk ) blk m
186
188
mkBlockFetchConsensusInterface
187
189
bcfg chainDB getCandidates blockFetchSize slotForgeTime readFetchMode =
188
190
BlockFetchConsensusInterface {
@@ -206,8 +208,8 @@ mkBlockFetchConsensusInterface
206
208
readCandidateChains :: STM m (Map peer (AnchoredFragment (HeaderWithTime blk )))
207
209
readCandidateChains = getCandidates
208
210
209
- readCurrentChain :: STM m (AnchoredFragment (Header blk ))
210
- readCurrentChain = getCurrentChain chainDB
211
+ readCurrentChain :: STM m (AnchoredFragment (HeaderWithTime blk ))
212
+ readCurrentChain = getCurrentChainWithTime chainDB
211
213
212
214
readFetchedBlocks :: STM m (Point blk -> Bool )
213
215
readFetchedBlocks = getIsFetched chainDB
@@ -287,7 +289,7 @@ mkBlockFetchConsensusInterface
287
289
-- fragment, by the time the block fetch download logic considers the
288
290
-- fragment, our current chain might have changed.
289
291
plausibleCandidateChain :: HasCallStack
290
- => AnchoredFragment (Header blk )
292
+ => AnchoredFragment (HeaderWithTime blk )
291
293
-> AnchoredFragment (HeaderWithTime blk )
292
294
-> Bool
293
295
plausibleCandidateChain ours cand
0 commit comments