cardano-sl-0.4.3: Cardano SL main implementation

Safe HaskellNone
LanguageHaskell2010

Pos.Block.Pure

Description

Pure functions related to blocks and headers.

Synopsis

Documentation

blockDifficultyIncrement :: Block ssc -> ChainDifficulty Source #

Difficulty of the Block, which is determined from header.

headerDifficultyIncrement :: BlockHeader ssc -> ChainDifficulty Source #

Difficulty of the BlockHeader. 0 for genesis block, 1 for main block.

mkGenericBlock :: forall b. (HasHeaderHash (BBlockHeader b), Blockchain b, BHeaderHash b ~ HeaderHash) => Maybe (BBlockHeader b) -> Body b -> (BHeaderHash b -> BodyProof b -> ConsensusData b) -> ExtraHeaderData b -> ExtraBodyData b -> GenericBlock b Source #

Smart constructor for GenericBlock. Uses mkGenericBlockHeader.

data VerifyBlockParams ssc Source #

Parameters of Block static verification. Note: to check that block references previous block and/or is referenced by next block, use header verification (via vbpVerifyHeader).

Constructors

VerifyBlockParams 

Fields

Instances

Default (VerifyBlockParams ssc) Source #

By default nothing is checked.

Methods

def :: VerifyBlockParams ssc #

data VerifyHeaderParams ssc Source #

Extra data which may be used by verifyHeader function to do more checks.

Constructors

VerifyHeaderParams 

Fields

Instances

verifyBlock :: (SscHelpersClass ssc, BiSsc ssc) => VerifyBlockParams ssc -> Block ssc -> VerificationRes Source #

Check predicates defined by VerifyBlockParams. #verifyHeader #verifyGenericBlock

verifyBlocks :: forall ssc f t. (SscHelpersClass ssc, BiSsc ssc, t ~ OldestFirst f (Block ssc), NontrivialContainer t) => Maybe SlotId -> Bool -> BlockVersionData -> Maybe SlotLeaders -> OldestFirst f (Block ssc) -> VerificationRes Source #

Verify a sequence of blocks.

foldl' is used here which eliminates laziness of triple. It doesn't affect laziness of VerificationRes which is good because laziness for this data type is crucial.

verifyGenericBlock :: forall b. Blockchain b => GenericBlock b -> VerificationRes Source #

Perform cheap checks of GenericBlock, which can be done using only block itself. Checks which can be done using only header are ignored here. It is assumed that they will be done separately.

verifyHeader :: forall ssc. BiSsc ssc => VerifyHeaderParams ssc -> BlockHeader ssc -> VerificationRes Source #

Check some predicates (determined by VerifyHeaderParams) about BlockHeader. #verifyConsensusLocal

verifyHeaders :: BiSsc ssc => Bool -> NewestFirst [] (BlockHeader ssc) -> VerificationRes Source #

Verifies a set of block headers.