@@ -119,6 +119,7 @@ import Cardano.Api.Ledger.Internal.Reexport qualified as Ledger
119119import Cardano.Api.LedgerState.Internal.ConvertLedgerEvent
120120import Cardano.Api.LedgerState.Internal.LedgerEvent
121121import Cardano.Api.Monad.Error
122+ import Cardano.Api.Network (Serialised (.. ))
122123import Cardano.Api.Network.IPC.Internal
123124 ( LocalChainSyncClient (LocalChainSyncClientPipelined )
124125 , LocalNodeClientProtocols (.. )
@@ -133,7 +134,6 @@ import Cardano.Api.Query.Internal.Type.QueryInMode
133134 , PoolDistribution (unPoolDistr )
134135 , ProtocolState
135136 , SerialisedCurrentEpochState (.. )
136- , SerialisedPoolDistribution
137137 , decodeCurrentEpochState
138138 , decodePoolDistribution
139139 , decodeProtocolState
@@ -1967,6 +1967,7 @@ data LeadershipError
19671967 = LeaderErrDecodeLedgerStateFailure
19681968 | LeaderErrDecodeProtocolStateFailure (LBS. ByteString , DecoderError )
19691969 | LeaderErrDecodeProtocolEpochStateFailure DecoderError
1970+ | LeaderErrDecodePoolDistributionFailure DecoderError
19701971 | LeaderErrGenesisSlot
19711972 | LeaderErrStakePoolHasNoStake PoolId
19721973 | LeaderErrStakeDistribUnstable
@@ -1995,6 +1996,8 @@ instance Api.Error LeadershipError where
19951996 " Leadership schedule currently cannot be calculated from genesis"
19961997 LeaderErrStakePoolHasNoStake poolId ->
19971998 " The stake pool: " <> pshow poolId <> " has no stake"
1999+ LeaderErrDecodePoolDistributionFailure decoderError ->
2000+ " Failed to successfully decode the pool stake distribution: " <> pshow decoderError
19982001 LeaderErrDecodeProtocolEpochStateFailure decoderError ->
19992002 " Failed to successfully decode the current epoch state: " <> pshow decoderError
20002003 LeaderErrStakeDistribUnstable curSlot stableAfterSlot stabWindow predictedLastSlot ->
@@ -2192,7 +2195,7 @@ currentEpochEligibleLeadershipSlots
21922195 -> ProtocolState era
21932196 -> PoolId
21942197 -> SigningKey VrfKey
2195- -> SerialisedPoolDistribution era
2198+ -> Serialised ( PoolDistribution era )
21962199 -> EpochNo
21972200 -- ^ Current EpochInfo
21982201 -> Either LeadershipError (Set SlotNo )
@@ -2211,9 +2214,10 @@ currentEpochEligibleLeadershipSlots sbe sGen eInfo pp ptclState poolid (VrfSigni
22112214 first LeaderErrSlotRangeCalculationFailure $
22122215 Slot. epochInfoRange eInfo currentEpoch
22132216
2217+ -- FUCKED UP HERE:
22142218 setSnapshotPoolDistr <-
2215- first LeaderErrDecodeProtocolEpochStateFailure
2216- . fmap (SL. unPoolDistr . fromConsensusPoolDistr . unPoolDistr)
2219+ first LeaderErrDecodePoolDistributionFailure
2220+ . fmap (SL. unPoolDistr . unPoolDistr)
22172221 $ decodePoolDistribution sbe serPoolDistr
22182222
22192223 let slotRangeOfInterest :: Core. EraPParams ledgerera => Core. PParams ledgerera -> Set SlotNo
@@ -2552,22 +2556,3 @@ handleExceptions = liftEither <=< liftIO . runExceptT . flip catches handlers
25522556 [ Handler $ throwError . FoldBlocksIOException
25532557 , Handler $ throwError . FoldBlocksMuxError
25542558 ]
2555-
2556- -- WARNING: Do NOT use this function anywhere else except in its current call sites.
2557- -- This is a temporary work around.
2558- fromConsensusPoolDistr :: Consensus. PoolDistr c -> SL. PoolDistr
2559- fromConsensusPoolDistr cpd =
2560- SL. PoolDistr
2561- { SL. unPoolDistr = Map. map toLedgerIndividualPoolStake $ Shelley. unPoolDistr cpd
2562- , SL. pdTotalActiveStake = SL. CompactCoin 0
2563- }
2564-
2565- -- WARNING: Do NOT use this function anywhere else except in its current call sites.
2566- -- This is a temporary work around.
2567- toLedgerIndividualPoolStake :: Consensus. IndividualPoolStake c -> SL. IndividualPoolStake
2568- toLedgerIndividualPoolStake ips =
2569- SL. IndividualPoolStake
2570- { SL. individualPoolStake = Shelley. individualPoolStake ips
2571- , SL. individualPoolStakeVrf = SL. toVRFVerKeyHash $ Shelley. individualPoolStakeVrf ips
2572- , SL. individualTotalPoolStake = SL. CompactCoin 0
2573- }
0 commit comments