From b611637652ab7a1fa01c06d51513e4572379c6d6 Mon Sep 17 00:00:00 2001 From: Whyrusleeping Date: Fri, 27 Sep 2019 13:47:10 -0700 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Ɓukasz Magiera --- build/params.go | 2 ++ chain/vm/vm.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/build/params.go b/build/params.go index 2d7e95b29..89aca1d57 100644 --- a/build/params.go +++ b/build/params.go @@ -35,8 +35,10 @@ var MiningRewardInitialAttoFilBytes = []byte{0x8, 0x57, 0x31, 0x68, 0x6e, 0x4f, const FilecoinPrecision = 1000000000000000000 // six years +// Blocks const HalvingPeriodBlocks = 6 * 365 * 24 * 60 * 2 +// Blocks const AdjustmentPeriod = 7 * 24 * 60 * 2 // TODO: Move other important consts here diff --git a/chain/vm/vm.go b/chain/vm/vm.go index 6616e8312..8b9e8568b 100644 --- a/chain/vm/vm.go +++ b/chain/vm/vm.go @@ -633,12 +633,12 @@ func DepositFunds(act *types.Actor, amt types.BigInt) { act.Balance = types.BigAdd(act.Balance, amt) } -var IV = types.BigInt{big.NewInt(0).SetBytes(build.MiningRewardInitialAttoFilBytes)} +var initialReward = types.BigInt{big.NewInt(0).SetBytes(build.MiningRewardInitialAttoFilBytes)} var miningRewardTotal = types.FromFil(build.MiningRewardTotal) // MiningReward returns correct mining reward // coffer is amount of FIL in NetworkAddress -func MiningReward(coffer types.BigInt) types.BigInt { +func MiningReward(remainingReward types.BigInt) types.BigInt { ci := big.NewInt(0).Set(coffer.Int) res := ci.Mul(ci, IV.Int) res = res.Div(res, miningRewardTotal.Int)