Skip to content

Commit

Permalink
Added a 30% juice on coinbase reward for few hours after the fork
Browse files Browse the repository at this point in the history
  • Loading branch information
gameofpointers committed Nov 15, 2024
1 parent e06e2cf commit 159f1d6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions consensus/misc/rewards.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,19 @@ import (
)

func CalculateReward(parent *types.WorkObject, header *types.WorkObjectHeader) *big.Int {
var reward *big.Int
if header.PrimaryCoinbase().IsInQiLedgerScope() {
return CalculateQiReward(parent.WorkObjectHeader())
reward = new(big.Int).Set(CalculateQiReward(parent.WorkObjectHeader()))
} else {
return CalculateQuaiReward(parent)
reward = new(big.Int).Set(CalculateQuaiReward(parent))
}

// ~30% extra reward for grace number of blocks after the fork to encourage nodes to move to the fork
if header.NumberU64() >= params.GoldenAgeForkNumberV2 && header.NumberU64() < params.GoldenAgeForkNumberV2+params.GoldenAgeForkGraceNumber {
reward = new(big.Int).Add(reward, new(big.Int).Div(reward, big.NewInt(70)))
}

return reward
}

// Calculate the amount of Quai that Qi can be converted to. Expect the current Header and the Qi amount in "qits", returns the quai amount in "its"
Expand Down

0 comments on commit 159f1d6

Please sign in to comment.