Skip to content

Commit

Permalink
Update lib/shelley/src/Cardano/Wallet/Shelley/Network/Blockfrost.hs
Browse files Browse the repository at this point in the history
Co-authored-by: Heinrich Apfelmus <[email protected]>
  • Loading branch information
Unisay and HeinrichApfelmus committed Jun 20, 2022
1 parent ef23bd6 commit c205888
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions lib/core/test/unit/Cardano/Wallet/Network/LightSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import Prelude
import Cardano.Wallet.Network
( ChainFollower (..) )
import Cardano.Wallet.Network.Light
( LightBlocks, LightSyncSource (..), hoistLightSyncSource, lightSync )
( Consensual (Consensual, NotConsensual)
, LightBlocks
, LightSyncSource (..)
, hoistLightSyncSource
, lightSync
)
import Cardano.Wallet.Primitive.BlockSummary
( BlockSummary (..) )
import Cardano.Wallet.Primitive.Types
Expand Down Expand Up @@ -98,17 +103,17 @@ mkLightSyncSourceMock = LightSyncSource
, getTip = NE.head
, isConsensus = \pt -> any ((pt ==) . toPoint)
, getBlockHeaderAtHeight = \height ->
find ((height ==) . toHeight)
maybe NotConsensual Consensual . find ((height ==) . toHeight)
, getBlockHeaderAt = \pt ->
find ((pt ==) . toPoint)
maybe NotConsensual Consensual . find ((pt ==) . toPoint)
, getNextBlocks = \pt chain ->
case NE.span ((pt /=) . toPoint) chain of
(_, []) -> Nothing -- point does not exist
(xs, _) -> Just (reverse xs)
(_, []) -> NotConsensual
(xs, _) -> Consensual (reverse xs)
, getNextBlockHeader = \bh chain ->
case NE.span (bh /=) chain of
(_, []) -> Nothing -- point does not exist
(xs, _) -> listToMaybe (reverse xs)
(_, []) -> NotConsensual
(xs, _) -> Consensual $ listToMaybe $ reverse xs
, getAddressTxs = \_ _ _ -> pure ()
}
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import Cardano.Wallet.Logging
import Cardano.Wallet.Network
( ChainFollower, NetworkLayer (..) )
import Cardano.Wallet.Network.Light
( Consensual (Consensual, NotConsensual), LightSyncSource (..) )
( Consensual (..), LightSyncSource (..) )
import Cardano.Wallet.Primitive.BlockSummary
( BlockEvents (..)
, ChainEvents
Expand Down

0 comments on commit c205888

Please sign in to comment.