Skip to content

Commit

Permalink
connectToLocalNode can throw
Browse files Browse the repository at this point in the history
  • Loading branch information
andreabedini authored and raduom committed May 21, 2022
1 parent 51a25ab commit 91b469a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions plutus-streaming/src/Plutus/Streaming.hs
Expand Up @@ -22,8 +22,8 @@ import Cardano.Api.ChainSync.Client (ClientStIdle (SendMsgDone, SendMsgFindInter
ClientStNext (ClientStNext, recvMsgRollBackward, recvMsgRollForward))
import Control.Concurrent (Chan, MVar, newChan, newEmptyMVar, putMVar, readChan, takeMVar, writeChan)
import Control.Concurrent.Async (withAsync)
import Control.Exception (SomeException, catch)
import Control.Monad.Trans.Except (runExceptT)
-- import Data.Aeson (ToJSON (..))
import GHC.Generics (Generic)
import Streaming (Of, Stream)
import Streaming.Prelude qualified as S
Expand All @@ -33,11 +33,6 @@ data ChainSyncEvent a
| RollBackward ChainPoint ChainTip
deriving (Show, Functor, Generic)

-- deriving instance Generic ChainPoint

-- instance ToJSON ChainPoint
-- instance ToJSON a => ToJSON (ChainSyncEvent a)

type SimpleChainSyncEvent = ChainSyncEvent (BlockInMode CardanoMode)

type ChainSyncEventWithLedgerState = ChainSyncEvent (BlockInMode CardanoMode, Either LedgerStateError (LedgerState, [LedgerEvent]))
Expand Down Expand Up @@ -121,6 +116,7 @@ runChainSyncStreamingClient socketPath networkId point mChan = do
connectToLocalNode
connectInfo
localNodeClientProtocols
`catch` \(_ :: SomeException) -> putMVar mChan Nothing

runChainSyncStreamingClientWithLedgerState ::
FilePath ->
Expand Down

0 comments on commit 91b469a

Please sign in to comment.