From b474e78fb9101f3d40f82e3efcff124efd0271ea Mon Sep 17 00:00:00 2001 From: NguyenNguyen Date: Mon, 11 Jan 2021 13:44:58 +0700 Subject: [PATCH] fix TestRewardInflation --- eth/backend_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/eth/backend_test.go b/eth/backend_test.go index d91045649d..1b628a00b0 100644 --- a/eth/backend_test.go +++ b/eth/backend_test.go @@ -8,16 +8,19 @@ import ( func TestRewardInflation(t *testing.T) { for i := 0; i < 100; i++ { + // the first 2 years chainReward := new(big.Int).Mul(new(big.Int).SetUint64(250), new(big.Int).SetUint64(params.Ether)) chainReward = rewardInflation(chainReward, uint64(i), 10) + // 3rd year, 4th year, 5th year halfReward := new(big.Int).Mul(new(big.Int).SetUint64(125), new(big.Int).SetUint64(params.Ether)) - if 20 <= i && i < 60 && chainReward.Cmp(halfReward) != 0 { + if 20 <= i && i < 50 && chainReward.Cmp(halfReward) != 0 { t.Error("Fail tor calculate reward inflation for 2 -> 5 years", "chainReward", chainReward) } + // after 5 years quarterReward := new(big.Int).Mul(new(big.Int).SetUint64(62.5*1000), new(big.Int).SetUint64(params.Finney)) - if 60 <= i && chainReward.Cmp(quarterReward) != 0 { + if 50 <= i && chainReward.Cmp(quarterReward) != 0 { t.Error("Fail tor calculate reward inflation above 6 years", "chainReward", chainReward) } }