Skip to content

Commit

Permalink
Remove mandatory networkId from follow function
Browse files Browse the repository at this point in the history
  • Loading branch information
noonio authored and ffakenz committed Oct 9, 2024
1 parent e97bd04 commit 4793f95
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion hydra-chain-observer/src/Hydra/Blockfrost/ChainObserver.hs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ blockfrostClient ::
NodeClient IO
blockfrostClient tracer projectPath blockConfirmations = do
NodeClient
{ follow = \_ startChainFrom observerHandler -> do
{ follow = \startChainFrom observerHandler -> do
prj <- Blockfrost.projectFromFile projectPath

Blockfrost.Block{_blockHash = (Blockfrost.BlockHash genesisBlockHash)} <-
Expand Down
7 changes: 3 additions & 4 deletions hydra-chain-observer/src/Hydra/ChainObserver.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ main observerHandler = do
traceWith tracer KnownScripts{scriptInfo = Contract.scriptInfo}
case opts of
DirectOpts DirectOptions{networkId, nodeSocket, startChainFrom} -> do
let NodeClient{follow} = ouroborusClient tracer nodeSocket
follow networkId startChainFrom observerHandler
let NodeClient{follow} = ouroborusClient tracer nodeSocket networkId
follow startChainFrom observerHandler
BlockfrostOpts BlockfrostOptions{projectPath, startChainFrom} -> do
-- FIXME: should be configurable
let blockConfirmations = 1
NodeClient{follow} = blockfrostClient tracer projectPath blockConfirmations
-- FIXME
follow (error "not-used") startChainFrom observerHandler
follow startChainFrom observerHandler
2 changes: 1 addition & 1 deletion hydra-chain-observer/src/Hydra/ChainObserver/NodeClient.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ defaultObserverHandler :: Applicative m => ObserverHandler m
defaultObserverHandler = const $ pure ()

newtype NodeClient m = NodeClient
{ follow :: NetworkId -> Maybe ChainPoint -> ObserverHandler m -> m ()
{ follow :: Maybe ChainPoint -> ObserverHandler m -> m ()
}

type ChainObserverLog :: Type
Expand Down
5 changes: 3 additions & 2 deletions hydra-chain-observer/src/Hydra/Ouroborus/ChainObserver.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ import Ouroboros.Network.Protocol.ChainSync.Client (
ouroborusClient ::
Tracer IO ChainObserverLog ->
SocketPath ->
NetworkId ->
NodeClient IO
ouroborusClient tracer nodeSocket =
ouroborusClient tracer nodeSocket networkId =
NodeClient
{ follow = \networkId startChainFrom observerHandler -> do
{ follow = \startChainFrom observerHandler -> do
traceWith tracer ConnectingToNode{nodeSocket, networkId}
chainPoint <- case startChainFrom of
Nothing -> queryTip networkId nodeSocket
Expand Down

0 comments on commit 4793f95

Please sign in to comment.