module Ouroboros.Consensus.Shelley.Ledger.Integrity (
verifyBlockIntegrity
, verifyHeaderIntegrity
) where
import Data.Word (Word64)
import Ouroboros.Consensus.Block
import Ouroboros.Consensus.Shelley.Ledger.Block
import Ouroboros.Consensus.Shelley.Protocol.Abstract
(verifyHeaderIntegrity)
verifyBlockIntegrity ::
ShelleyCompatible proto era
=> Word64
-> ShelleyBlock proto era -> Bool
verifyBlockIntegrity :: Word64 -> ShelleyBlock proto era -> Bool
verifyBlockIntegrity Word64
spkp ShelleyBlock proto era
blk =
Word64 -> ShelleyProtocolHeader proto -> Bool
forall proto.
ProtocolHeaderSupportsKES proto =>
Word64 -> ShelleyProtocolHeader proto -> Bool
verifyHeaderIntegrity Word64
spkp (Header (ShelleyBlock proto era) -> ShelleyProtocolHeader proto
forall proto era.
Header (ShelleyBlock proto era) -> ShelleyProtocolHeader proto
shelleyHeaderRaw (Header (ShelleyBlock proto era) -> ShelleyProtocolHeader proto)
-> Header (ShelleyBlock proto era) -> ShelleyProtocolHeader proto
forall a b. (a -> b) -> a -> b
$ ShelleyBlock proto era -> Header (ShelleyBlock proto era)
forall blk. GetHeader blk => blk -> Header blk
getHeader ShelleyBlock proto era
blk) Bool -> Bool -> Bool
&&
Header (ShelleyBlock proto era) -> ShelleyBlock proto era -> Bool
forall blk. GetHeader blk => Header blk -> blk -> Bool
blockMatchesHeader (ShelleyBlock proto era -> Header (ShelleyBlock proto era)
forall blk. GetHeader blk => blk -> Header blk
getHeader ShelleyBlock proto era
blk) ShelleyBlock proto era
blk