Skip to content

Commit

Permalink
db-sync: Fix the reward.spendable_epoch value for MIR rewards
Browse files Browse the repository at this point in the history
  • Loading branch information
erikd committed Sep 24, 2021
1 parent dd23425 commit fb33c06
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cardano-db-sync/src/Cardano/DbSync/Era/Shelley/Insert/Epoch.hs
Expand Up @@ -174,10 +174,18 @@ insertRewards epoch icache rewardsChunk = do
, DB.rewardType = Generic.rewardSource rwd
, DB.rewardAmount = Generic.coinToDbLovelace (Generic.rewardAmount rwd)
, DB.rewardEarnedEpoch = unEpochNo epoch
, DB.rewardSpendableEpoch = 2 + unEpochNo epoch
, DB.rewardSpendableEpoch = unEpochNo epoch + spendableEpoch (Generic.rewardSource rwd)
, DB.rewardPoolId = lookupPoolIdPairMaybe (Generic.rewardPool rwd) icache
}

spendableEpoch :: DB.RewardSource -> Word64
spendableEpoch src =
case src of
DB.RwdMember -> 2
DB.RwdLeader -> 2
DB.RwdReserves -> 1
DB.RwdTreasury -> 1

-- -------------------------------------------------------------------------------------------------

lookupStakeAddrIdPair
Expand Down

0 comments on commit fb33c06

Please sign in to comment.