Skip to content

Commit

Permalink
ChainDB.API: fix bug in validBounds
Browse files Browse the repository at this point in the history
  • Loading branch information
mrBliss committed Jul 11, 2019
1 parent e3b31a4 commit 746ba60
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions ouroboros-consensus/src/Ouroboros/Storage/ChainDB/API.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE PatternSynonyms #-}

module Ouroboros.Storage.ChainDB.API (
-- * Main ChainDB API
Expand Down Expand Up @@ -39,9 +39,9 @@ import Control.Monad.Class.MonadSTM
import Control.Monad.Class.MonadThrow

import Ouroboros.Network.AnchoredFragment (AnchoredFragment)
import Ouroboros.Network.Block (ChainUpdate, HasHeader (..),
HeaderHash, SlotNo, StandardHash, pattern GenesisPoint,
pattern BlockPoint, atSlot)
import Ouroboros.Network.Block (pattern BlockPoint, ChainUpdate,
pattern GenesisPoint, HasHeader (..), HeaderHash, SlotNo,
StandardHash, atSlot)
import Ouroboros.Network.Chain (Chain (..), Point (..), genesisPoint)
import qualified Ouroboros.Network.Chain as Chain
import Ouroboros.Network.ChainProducerState (ReaderId)
Expand Down Expand Up @@ -335,16 +335,16 @@ validBounds from to = case from of
_ -> True

StreamFromInclusive (BlockPoint { atSlot = sfrom }) -> case to of
StreamToInclusive GenesisPoint -> False
StreamToExclusive GenesisPoint -> False
StreamToInclusive (BlockPoint { atSlot = sto }) -> sfrom <= sto
StreamToExclusive (BlockPoint { atSlot = sto }) -> sfrom < sto
StreamToInclusive GenesisPoint -> False
StreamToExclusive GenesisPoint -> False
StreamToInclusive (BlockPoint { atSlot = sto }) -> sfrom <= sto
StreamToExclusive (BlockPoint { atSlot = sto }) -> sfrom < sto

StreamFromExclusive (BlockPoint { atSlot = sfrom }) -> case to of
StreamToInclusive GenesisPoint -> False
StreamToExclusive GenesisPoint -> False
StreamToInclusive (BlockPoint { atSlot = sto }) -> sfrom <= sto
StreamToExclusive (BlockPoint { atSlot = sto }) -> sfrom < sto
StreamToInclusive GenesisPoint -> False
StreamToExclusive GenesisPoint -> False
StreamToInclusive (BlockPoint { atSlot = sto }) -> sfrom < sto
StreamToExclusive (BlockPoint { atSlot = sto }) -> sfrom < sto

-- | Stream all blocks from the current chain.
--
Expand Down

0 comments on commit 746ba60

Please sign in to comment.