File tree 4 files changed +57
-2
lines changed
4 files changed +57
-2
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,7 @@ import qualified Kupo.App.ChainSync.Node as Node
142
142
import qualified Kupo.App.ChainSync.Ogmios as Ogmios
143
143
import qualified Kupo.App.FetchBlock.Node as Node
144
144
import qualified Kupo.App.FetchBlock.Ogmios as Ogmios
145
+ import qualified Kupo.App.FetchTip.Node as Node
145
146
import qualified Kupo.App.FetchTip.Ogmios as Ogmios
146
147
147
148
--
@@ -305,8 +306,20 @@ newFetchTipClient = \case
305
306
throwIO UnableToFetchTipFromHydra
306
307
Ogmios {ogmiosHost, ogmiosPort} ->
307
308
Ogmios. newFetchTipClient ogmiosHost ogmiosPort
308
- CardanoNode {} ->
309
- error " TODO: newFetchTipClient for CardanoNode"
309
+ CardanoNode {nodeSocket, nodeConfig} -> do
310
+ NetworkParameters
311
+ { networkMagic
312
+ , slotsPerEpoch
313
+ } <- liftIO (parseNetworkParameters nodeConfig)
314
+ response <- newEmptyTMVarIO
315
+ withChainSyncServer
316
+ noConnectionStatusToggle
317
+ [ NodeToClientV_9 .. maxBound ]
318
+ networkMagic
319
+ slotsPerEpoch
320
+ nodeSocket
321
+ (Node. newFetchTipClient response)
322
+ atomically $ takeTMVar response
310
323
311
324
-- | Consumer process that is reading messages from the 'Mailbox'. Messages are
312
325
-- enqueued by another process (the producer).
Original file line number Diff line number Diff line change
1
+ -- This Source Code Form is subject to the terms of the Mozilla Public
2
+ -- License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ -- file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
+
5
+ module Kupo.App.FetchTip.Node
6
+ ( newFetchTipClient
7
+ ) where
8
+
9
+ import Kupo.Prelude
10
+
11
+ import Control.Concurrent.Class.MonadSTM
12
+ ( MonadSTM (.. )
13
+ )
14
+ import Kupo.Data.Cardano
15
+ ( Point
16
+ , Tip
17
+ )
18
+ import Ouroboros.Network.Protocol.ChainSync.ClientPipelined
19
+ ( ChainSyncClientPipelined (.. )
20
+ , ClientPipelinedStIdle (.. )
21
+ , ClientStNext (.. )
22
+ )
23
+
24
+ newFetchTipClient
25
+ :: (MonadSTM m )
26
+ => TMVar m Tip
27
+ -> ChainSyncClientPipelined block Point Tip m ()
28
+ newFetchTipClient response =
29
+ ChainSyncClientPipelined $ pure $
30
+ SendMsgRequestNext
31
+ (pure () )
32
+ ClientStNext
33
+ { recvMsgRollForward = \ _header tip -> do
34
+ atomically $ putTMVar response tip
35
+ pure (SendMsgDone () )
36
+ , recvMsgRollBackward = \ _point tip -> do
37
+ atomically $ putTMVar response tip
38
+ pure (SendMsgDone () )
39
+ }
Original file line number Diff line number Diff line change @@ -548,6 +548,8 @@ spec = skippableContext "End-to-end" $ do
548
548
}
549
549
runSpec env 120 $ do
550
550
waitSlot (>= getPointSlotNo tip)
551
+ points <- listCheckpoints
552
+ forM_ points $ \ point -> getPointSlotNo point `shouldSatisfy` (>= getPointSlotNo tip)
551
553
Health {configuration} <- getHealth
552
554
configuration `shouldBe` (Just InstallIndexesIfNotExist )
553
555
You can’t perform that action at this time.
0 commit comments