Skip to content

Commit

Permalink
Merge pull request #1876 from input-output-hk/jc/fix-total-and-active…
Browse files Browse the repository at this point in the history
…-stake-denoms

fix division by zero edge case in reward calc
  • Loading branch information
nc6 committed Sep 28, 2020
2 parents cc548f0 + c775f67 commit f824efa
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -448,8 +448,8 @@ reward
Coin activeStake = fold . unStake $ stake
results = do
(hk, pparams) <- Map.toList poolParams
let sigma = fromIntegral pstake % fromIntegral totalStake
sigmaA = fromIntegral pstake % fromIntegral activeStake
let sigma = if totalStake == 0 then 0 else fromIntegral pstake % fromIntegral totalStake
sigmaA = if activeStake == 0 then 0 else fromIntegral pstake % fromIntegral activeStake
blocksProduced = Map.lookup hk b
actgr@(Stake s) = poolStake hk delegs stake
Coin pstake = fold s
Expand Down

0 comments on commit f824efa

Please sign in to comment.