Skip to content
Permalink
Browse files

Update ProtocolLedgerView for Praos

  • Loading branch information...
edsko committed May 15, 2019
1 parent 5eb3011 commit 7c4d6156434c21b81400d415f4523ea728956bd0
Showing with 10 additions and 9 deletions.
  1. +10 −9 ouroboros-consensus/src/Ouroboros/Consensus/Ledger/Mock.hs
@@ -466,17 +466,18 @@ instance ( PraosCrypto c, SimpleBlockCrypto c')
=> ProtocolLedgerView (SimpleBlock (ExtNodeConfig AddrDist (Praos c)) c') where
protocolLedgerView (EncNodeConfig _ addrDist) _ =
equalStakeDistr addrDist
where
equalStakeDistr :: AddrDist -> StakeDist
equalStakeDistr = IntMap.fromList
. mapMaybe (nodeStake . snd)
. Map.toList
anachronisticProtocolLedgerView (EncNodeConfig _ addrDist) _ _ =
Just $ slotUnbounded $ equalStakeDistr addrDist

nodeStake :: NodeId -> Maybe (Int, Rational)
nodeStake (RelayId _) = Nothing
nodeStake (CoreId i) = Just (i, 1)
equalStakeDistr :: AddrDist -> StakeDist
equalStakeDistr = IntMap.fromList
. mapMaybe (nodeStake . snd)
. Map.toList
where
nodeStake :: NodeId -> Maybe (Int, Rational)
nodeStake (RelayId _) = Nothing
nodeStake (CoreId i) = Just (i, 1)

anachronisticProtocolLedgerView = error "TODO: write up discussion with Jared, Nicholas and Duncan"

instance (PraosCrypto c, SimpleBlockCrypto c')
=> ProtocolLedgerView (SimpleBlock (WithLeaderSchedule (Praos c)) c') where

0 comments on commit 7c4d615

Please sign in to comment.
You can’t perform that action at this time.