| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Peras.SelectView
Synopsis
- data WeightedSelectView proto = WeightedSelectView {}
- wsvTotalWeight ∷ WeightedSelectView proto → PerasWeight
- weightedSelectView ∷ (GetHeader1 h, HasHeader (h blk), HeaderHash blk ~ HeaderHash (h blk), BlockSupportsProtocol blk) ⇒ BlockConfig blk → PerasWeightSnapshot blk → AnchoredFragment (h blk) → WithEmptyFragment (WeightedSelectView (BlockProtocol blk))
- data WithEmptyFragment a
- withEmptyFragmentFromMaybe ∷ Maybe a → WithEmptyFragment a
- withEmptyFragmentToMaybe ∷ WithEmptyFragment a → Maybe a
WeightedSelectView
data WeightedSelectView proto Source #
Information from a non-empty chain fragment for a weighted chain comparison against other fragments with the same anchor.
Comparisons of fragments with different anchors are not possible in general, as the fragments might not intersect, and so some blocks after their intersection (and hence their weight boost) are unknown.
Constructors
| WeightedSelectView | |
Fields
| |
Instances
wsvTotalWeight ∷ WeightedSelectView proto → PerasWeight Source #
The total weight, ie the sum of wsvBlockNo and wsvBoostedWeight.
weightedSelectView ∷ (GetHeader1 h, HasHeader (h blk), HeaderHash blk ~ HeaderHash (h blk), BlockSupportsProtocol blk) ⇒ BlockConfig blk → PerasWeightSnapshot blk → AnchoredFragment (h blk) → WithEmptyFragment (WeightedSelectView (BlockProtocol blk)) Source #
Get the WeightedSelectView for a fragment using the given
PerasWeightSnapshot. Note that this is only meanigful for comparisons
against other fragments with the same anchor.
Returns EmptyFragment iff the input fragment is empty.
Utility: WithEmptyFragment
data WithEmptyFragment a Source #
Attach the possibility of an empty fragment to a type.
Constructors
| EmptyFragment | |
| NonEmptyFragment !a |
Instances
| Show a ⇒ Show (WithEmptyFragment a) Source # | |||||
Defined in Ouroboros.Consensus.Peras.SelectView Methods showsPrec ∷ Int → WithEmptyFragment a → ShowS # show ∷ WithEmptyFragment a → String # showList ∷ [WithEmptyFragment a] → ShowS # | |||||
| Eq a ⇒ Eq (WithEmptyFragment a) Source # | |||||
Defined in Ouroboros.Consensus.Peras.SelectView Methods (==) ∷ WithEmptyFragment a → WithEmptyFragment a → Bool # (/=) ∷ WithEmptyFragment a → WithEmptyFragment a → Bool # | |||||
| Ord a ⇒ Ord (WithEmptyFragment a) Source # | Prefer non-empty fragments to empty ones. | ||||
Defined in Ouroboros.Consensus.Peras.SelectView Methods compare ∷ WithEmptyFragment a → WithEmptyFragment a → Ordering # (<) ∷ WithEmptyFragment a → WithEmptyFragment a → Bool # (<=) ∷ WithEmptyFragment a → WithEmptyFragment a → Bool # (>) ∷ WithEmptyFragment a → WithEmptyFragment a → Bool # (>=) ∷ WithEmptyFragment a → WithEmptyFragment a → Bool # max ∷ WithEmptyFragment a → WithEmptyFragment a → WithEmptyFragment a # min ∷ WithEmptyFragment a → WithEmptyFragment a → WithEmptyFragment a # | |||||
| ChainOrder a ⇒ ChainOrder (WithEmptyFragment a) Source # | Prefer non-empty fragments to empty ones. This instance assumes that the underlying fragments all have the same anchor. | ||||
Defined in Ouroboros.Consensus.Peras.SelectView Associated Types
Methods preferCandidate ∷ ChainOrderConfig (WithEmptyFragment a) → WithEmptyFragment a → WithEmptyFragment a → Bool Source # | |||||
| type ChainOrderConfig (WithEmptyFragment a) Source # | |||||
Defined in Ouroboros.Consensus.Peras.SelectView | |||||