Skip to content
Permalink
Browse files

ChainDB.API: fix bug in validBounds

  • Loading branch information...
mrBliss authored and dcoutts committed Jul 11, 2019
1 parent 9e2fbf6 commit 655d994d1a60e1d6cd45a7a8bc823deaa0bcd6de
Showing with 12 additions and 12 deletions.
  1. +12 −12 ouroboros-consensus/src/Ouroboros/Storage/ChainDB/API.hs
@@ -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
@@ -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)
@@ -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.
--

0 comments on commit 655d994

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