Skip to content

Commit

Permalink
Fixes CalculateBlockReward()
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashy5000 committed Jul 29, 2024
1 parent ce1f638 commit 69b0a01
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion block_reward_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestCalculateBlockReward(t *testing.T) {
// Assert
assert.Equal(t, 0.95, reward)
})
t.Run("It returns 0.99 if there is 1 miner and the block height is 100", func(t *testing.T) {
t.Run("It returns 0.99 if there is 1 miner and the Guadalajara update is active", func(t *testing.T) {
// Arrange
LoadEnv()
// Act
Expand Down
2 changes: 1 addition & 1 deletion node_util/block_reward.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func CalculateBlockReward(minerCount int64, blockHeight int) float64 {
reward = math.Pow(p, float64(minerCount))
} else {
years := (blockHeight - Env.Upgrades.Alexandria) / 31536000
reward = math.Pow(p, float64(minerCount)) * float64(10000*int(years)) // Block reward multiplies by a constant (10000) every year. This will prevent a limited supply.
reward = math.Pow(p, float64(minerCount)) + float64(10000*int(years)) // Block reward multiplies by a constant (10000) every year. This will prevent a limited supply.
}
return reward
}

0 comments on commit 69b0a01

Please sign in to comment.