From 69b0a01857d283d76db152cccbb9b196aff1c0d9 Mon Sep 17 00:00:00 2001 From: Ashy5000 Date: Mon, 29 Jul 2024 14:24:59 -0700 Subject: [PATCH] Fixes CalculateBlockReward() --- block_reward_test.go | 2 +- node_util/block_reward.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block_reward_test.go b/block_reward_test.go index 3060d3e..d92ffd2 100644 --- a/block_reward_test.go +++ b/block_reward_test.go @@ -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 diff --git a/node_util/block_reward.go b/node_util/block_reward.go index f65fb0e..0961916 100644 --- a/node_util/block_reward.go +++ b/node_util/block_reward.go @@ -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 }