ouroboros-consensus-0.1.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Protocol.MockChainSel

Synopsis

Documentation

selectChain Source #

Arguments

∷ ∀ proxy p hdr l. ConsensusProtocol p 
⇒ proxy p 
→ (hdr → SelectView p) 
Chain hdr

Our chain

→ [(Chain hdr, l)]

Upstream chains

Maybe (Chain hdr, l) 

Chain selection between our chain and list of candidates

This is only a model of chain selection: in reality of course we will not work with entire chains in memory. This function is intended as an explanation of how chain selection should work conceptually.

The l parameter here models the ledger state for each chain, and serves as evidence that the chains we are selecting between have been validated. (It would not be correct to run chain selection on unvalidated chains and then somehow fail if the selected chain turns out to be invalid.)

Returns Nothing if we stick with our current chain.

selectUnvalidatedChainConsensusProtocol p ⇒ proxy p → (hdr → SelectView p) → Chain hdr → [Chain hdr] → Maybe (Chain hdr) Source #

Chain selection on unvalidated chains