@@ -84,7 +84,7 @@ import qualified Data.Strict.Maybe as Strict
84
84
import qualified Data.Text as Text
85
85
import Data.Time.Clock (UTCTime , diffUTCTime , getCurrentTime )
86
86
import GHC.IO.Exception (userError )
87
- import Lens.Micro ((^. ) )
87
+ import Lens.Micro ((%~) , (^.) , (^? ) )
88
88
import Ouroboros.Consensus.Block (
89
89
CodecConfig ,
90
90
Point (.. ),
@@ -226,7 +226,7 @@ applyBlock env blk = do
226
226
! result <- fromEitherSTM $ tickThenReapplyCheckHash (ExtLedgerCfg (getTopLevelconfigHasLedger env)) blk (clsState oldState)
227
227
let ledgerEventsFull = mapMaybe (convertAuxLedgerEvent (leHasRewards env)) (lrEvents result)
228
228
let (ledgerEvents, deposits) = splitDeposits ledgerEventsFull
229
- let ! newLedgerState = lrResult result
229
+ let ! newLedgerState = finaliseDrepDistr ( lrResult result)
230
230
! details <- getSlotDetails env (ledgerState newLedgerState) time (cardanoBlockSlotNo blk)
231
231
! newEpoch <- fromEitherSTM $ mkNewEpoch (clsState oldState) newLedgerState (findAdaPots ledgerEvents)
232
232
let ! newEpochBlockNo = applyToEpochBlockNo (isJust $ blockIsEBB blk) (isJust newEpoch) (clsEpochBlockNo oldState)
@@ -282,18 +282,19 @@ applyBlock env blk = do
282
282
applyToEpochBlockNo _ _ GenesisEpochBlockNo = EpochBlockNo 0
283
283
applyToEpochBlockNo _ _ EBBEpochBlockNo = EpochBlockNo 0
284
284
285
+ getDrepState :: ExtLedgerState CardanoBlock -> Maybe (DRepPulsingState StandardConway )
286
+ getDrepState ls = ls ^? newEpochStateT . Shelley. newEpochStateDRepPulsingStateL
287
+
288
+ finaliseDrepDistr :: ExtLedgerState CardanoBlock -> ExtLedgerState CardanoBlock
289
+ finaliseDrepDistr ledger =
290
+ ledger & newEpochStateT %~ forceDRepPulsingState @ StandardConway
291
+
285
292
getEnacted :: ExtLedgerState CardanoBlock -> Maybe (GovRelation StrictMaybe StandardConway )
286
293
getEnacted ls = case ledgerState ls of
287
294
LedgerStateConway cls ->
288
295
Just $ govStatePrevGovActionIds $ Consensus. shelleyLedgerState cls ^. Shelley. newEpochStateGovStateL
289
296
_ -> Nothing
290
297
291
- getDrepState :: ExtLedgerState CardanoBlock -> Maybe (DRepPulsingState StandardConway )
292
- getDrepState ls = case ledgerState ls of
293
- LedgerStateConway cls ->
294
- Just $ Consensus. shelleyLedgerState cls ^. Shelley. newEpochStateDRepPulsingStateL
295
- _ -> Nothing
296
-
297
298
getCommittee :: ExtLedgerState CardanoBlock -> Maybe (StrictMaybe (Committee StandardConway ))
298
299
getCommittee ls = case ledgerState ls of
299
300
LedgerStateConway cls ->
0 commit comments