Skip to content

Commit

Permalink
extend BakerPoolStatus/PoolCurrentPayday info with suspension info
Browse files Browse the repository at this point in the history
  • Loading branch information
drsk committed Dec 19, 2024
1 parent f265d3f commit a9dbd52
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3331,10 +3331,12 @@ doGetPoolStatus pbs psBakerId@(BakerId aid) = case delegationChainParameters @pv
return $! ActiveBakerPoolStatus{..}
epochBakers <- refLoad (_birkCurrentEpochBakers $ bspBirkParameters bsp)
mepochBaker <- epochBaker psBakerId epochBakers
psCurrentPaydayStatus <- case mepochBaker of
Nothing -> return Nothing
(psCurrentPaydayStatus, psIsSuspended) <- case mepochBaker of
Nothing -> return (Nothing, False)
Just (currentEpochBaker, effectiveStake) -> do
poolRewards <- refLoad (bspPoolRewards bsp)
let isSuspended =
fromCondDef (BaseAccounts._bieIsSuspended currentEpochBaker) False
mbcr <- lookupBakerCapitalAndRewardDetails psBakerId poolRewards
case mbcr of
Nothing ->
Expand All @@ -3345,7 +3347,7 @@ doGetPoolStatus pbs psBakerId@(BakerId aid) = case delegationChainParameters @pv
\the current epoch capital distribution."
Just (bc, BakerPoolRewardDetails{..}) -> do
return $
Just
( Just
CurrentPaydayBakerPoolStatus
{ bpsBlocksBaked = blockCount,
bpsFinalizationLive = finalizationAwake,
Expand All @@ -3359,8 +3361,12 @@ doGetPoolStatus pbs psBakerId@(BakerId aid) = case delegationChainParameters @pv
bpsCommissionRates =
currentEpochBaker
^. BaseAccounts.bieBakerPoolInfo
. BaseAccounts.poolCommissionRates
}
. BaseAccounts.poolCommissionRates,
bpsIsPrimedForSuspension = fromCondDef (fmap primedForSuspension suspensionInfo) False,
bpsMissedRounds = fromCondDef (fmap missedRounds suspensionInfo) 0
},
isSuspended
)
if isJust psActiveStatus || isJust psCurrentPaydayStatus
then return $ Just BakerPoolStatus{..}
else return Nothing
Expand Down

0 comments on commit a9dbd52

Please sign in to comment.