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



How to punish the sender of a invalid block



data InvalidBlockPunishment m Source #

How to handle a discovered Invalidity

This type is opaque because the soundness of the punishment is subtle because of where it is invoked during the chain selection. As a result, arbitrary monadic actions would be foot guns. Instead, this module defines a small DSL for punishment that we judge to be sound.


data Invalidity Source #

Is the added block itself invalid, or is its prefix invalid?

mkPunishThisThread :: IOLike m => m ( InvalidBlockPunishment m) Source #

Create a punishment that kills this thread

mkUnlessImproved :: forall proxy m blk. ( IOLike m, NoThunks ( SelectView ( BlockProtocol blk)), Ord ( SelectView ( BlockProtocol blk))) => proxy blk -> STM m ( SelectView ( BlockProtocol blk) -> InvalidBlockPunishment m -> InvalidBlockPunishment m) Source #

Allocate a stateful punishment that performs the given punishment unless the given header is better than the previous invocation