Skip to content
Permalink
Browse files

use ErrGetBlockchainParams name

  • Loading branch information...
paweljakubas committed Jul 12, 2019
1 parent 74eecc5 commit debb5ff0e57ea79ac14901784bcafb822ce99d6b
Showing with 13 additions and 13 deletions.
  1. +4 −4 exe/wallet/jormungandr/Main.hs
  2. +9 −9 lib/jormungandr/src/Cardano/Wallet/Jormungandr/Network.hs
@@ -74,7 +74,7 @@ import Cardano.Wallet.Jormungandr.Compatibility
import Cardano.Wallet.Jormungandr.Environment
( KnownNetwork (..), Network (..) )
import Cardano.Wallet.Jormungandr.Network
( ErrGetInitialConfigParams (..), getInitialBlockchainParameters )
( ErrGetBlockchainParams (..), getInitialBlockchainParameters )
import Cardano.Wallet.Network
( ErrNetworkTip, NetworkLayer (..), defaultRetryPolicy, waitForConnection )
import Cardano.Wallet.Primitive.AddressDerivation
@@ -348,11 +348,11 @@ cmdServe = command "serve" $ info (helper <*> cmd) $ mempty
blockchainParams <-
runExceptT (getInitialBlockchainParameters jor (coerce block0H)) >>= \case
Right a -> return a
Left (ErrGetInitialConfigParamsNetworkUnreachable _) ->
Left (ErrGetBlockchainParamsNetworkUnreachable _) ->
handleNetworkUnreachable tracer
Left (ErrGetInitialConfigParamsGenesisNotFound _) ->
Left (ErrGetBlockchainParamsGenesisNotFound _) ->
handleGenesisNotFound (sb, tracer)
Left (ErrGetInitialConfigParamsNoInitialPolicy _) ->
Left (ErrGetBlockchainParamsNoInitialPolicy _) ->
handleNoInitialPolicy tracer
return (nl, blockchainParams)

@@ -26,7 +26,7 @@ module Cardano.Wallet.Jormungandr.Network

-- * Errors
, ErrGetDescendants (..)
, ErrGetInitialConfigParams (..)
, ErrGetBlockchainParams (..)

-- * Re-export
, BaseUrl (..)
@@ -175,7 +175,7 @@ data JormungandrLayer n m = JormungandrLayer
-> ExceptT ErrPostTx m ()
, getInitialBlockchainParameters
:: Hash "Genesis"
-> ExceptT ErrGetInitialConfigParams m (BlockchainParameters (Jormungandr n))
-> ExceptT ErrGetBlockchainParams m (BlockchainParameters (Jormungandr n))
}

-- | Construct a 'JormungandrLayer'-client
@@ -241,10 +241,10 @@ mkJormungandrLayer mgr baseUrl = JormungandrLayer
, getInitialBlockchainParameters = \block0 -> do
jblock@(J.Block _ msgs) <- ExceptT $ run (cGetBlock (BlockId $ coerce block0)) >>= \case
Left (FailureResponse e) | responseStatusCode e == status400 ->
return . Left . ErrGetInitialConfigParamsGenesisNotFound $ block0
return . Left . ErrGetBlockchainParamsGenesisNotFound $ block0
x -> do
let ctx = safeLink api (Proxy @GetBlock) (BlockId $ coerce block0)
let networkUnreachable = ErrGetInitialConfigParamsNetworkUnreachable
let networkUnreachable = ErrGetBlockchainParamsNetworkUnreachable
left networkUnreachable <$> defaultHandler ctx x

let params = mconcat $ mapMaybe getConfigParameters msgs
@@ -269,7 +269,7 @@ mkJormungandrLayer mgr baseUrl = JormungandrLayer
([policy],[duration]) ->
return $ BlockchainParameters (coerceBlock jblock) policy (SlotLength duration)
_ ->
throwE $ ErrGetInitialConfigParamsNoInitialPolicy params
throwE $ ErrGetBlockchainParamsNoInitialPolicy params
}
where
run :: ClientM a -> IO (Either ServantError a)
@@ -310,8 +310,8 @@ data ErrGetDescendants
| ErrGetDescendantsParentNotFound (Hash "BlockHeader")
deriving (Show, Eq)

data ErrGetInitialConfigParams
= ErrGetInitialConfigParamsNetworkUnreachable ErrNetworkUnreachable
| ErrGetInitialConfigParamsGenesisNotFound (Hash "Genesis")
| ErrGetInitialConfigParamsNoInitialPolicy [ConfigParam]
data ErrGetBlockchainParams
= ErrGetBlockchainParamsNetworkUnreachable ErrNetworkUnreachable
| ErrGetBlockchainParamsGenesisNotFound (Hash "Genesis")
| ErrGetBlockchainParamsNoInitialPolicy [ConfigParam]
deriving (Show, Eq)

0 comments on commit debb5ff

Please sign in to comment.
You can’t perform that action at this time.