module Ouroboros.Consensus.ByronSpec.Ledger.Conversions (
fromByronSpecPrevHash
, fromByronSpecSlotNo
, toByronSpecSlotNo
) where
import qualified Byron.Spec.Chain.STS.Block as Spec
import qualified Byron.Spec.Ledger.Core as Spec
import Ouroboros.Consensus.Block
fromByronSpecPrevHash :: (Spec.Hash -> HeaderHash b)
-> Spec.Hash -> ChainHash b
fromByronSpecPrevHash :: forall b. (Hash -> HeaderHash b) -> Hash -> ChainHash b
fromByronSpecPrevHash Hash -> HeaderHash b
f Hash
h
| Hash
h Hash -> Hash -> Bool
forall a. Eq a => a -> a -> Bool
== Hash
Spec.genesisHash = ChainHash b
forall {k} (b :: k). ChainHash b
GenesisHash
| Bool
otherwise = HeaderHash b -> ChainHash b
forall {k} (b :: k). HeaderHash b -> ChainHash b
BlockHash (Hash -> HeaderHash b
f Hash
h)
fromByronSpecSlotNo :: Spec.Slot -> SlotNo
fromByronSpecSlotNo :: Slot -> SlotNo
fromByronSpecSlotNo (Spec.Slot Word64
slot) = Word64 -> SlotNo
SlotNo Word64
slot
toByronSpecSlotNo :: SlotNo -> Spec.Slot
toByronSpecSlotNo :: SlotNo -> Slot
toByronSpecSlotNo (SlotNo Word64
slot) = Word64 -> Slot
Spec.Slot Word64
slot