ouroboros-consensus- Consensus layer for the Ouroboros blockchain protocol
Safe Haskell None
Language Haskell2010





data ParseError blk Source #

Note that we recover from the error, and thus never throw it as an Exception .

Defined here instead of in the Parser module because TraceEvent depends on it.


BlockReadErr ReadIncrementalErr

A block could not be parsed.

BlockCorruptedErr ( HeaderHash blk)

A block was corrupted, e.g., checking its signature and/or hash failed.

DuplicatedBlock ( HeaderHash blk) FsPath FsPath

A block with the same hash occurred twice in the VolatileDB files.

We include the file in which it occurred first and the file in which it occured the second time. The two files can be the same.

data ParsedBlockInfo blk Source #

Information returned by the parser about a single block.

The parser returns for each block, its offset, its size and its BlockInfo

The fields of this record are strict to make sure that by evaluating this record to WHNF, we no longer hold on to the entire block. Otherwise, we might accidentally keep all blocks in a single file in memory during parsing.

parseBlockFile :: forall m blk h. ( IOLike m, GetPrevHash blk, HasBinaryBlockInfo blk, HasNestedContent Header blk, DecodeDisk blk ( ByteString -> blk)) => CodecConfig blk -> HasFS m h -> (blk -> Bool ) -> BlockValidationPolicy -> FsPath -> m ([ ParsedBlockInfo blk], Maybe ( ParseError blk, BlockOffset )) Source #

Parse the given file containing blocks.

Return the ParsedBlockInfo for all the valid blocks in the file. Stop when encountering an error and include the offset to truncate to.