Apply suggestions from code review

Co-Authored-By: Łukasz Magiera <magik6k@users.noreply.github.com>
This commit is contained in:
Whyrusleeping 2019-09-27 13:47:10 -07:00 committed by GitHub
parent bd4924aa56
commit b611637652
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -35,8 +35,10 @@ var MiningRewardInitialAttoFilBytes = []byte{0x8, 0x57, 0x31, 0x68, 0x6e, 0x4f,
const FilecoinPrecision = 1000000000000000000 const FilecoinPrecision = 1000000000000000000
// six years // six years
// Blocks
const HalvingPeriodBlocks = 6 * 365 * 24 * 60 * 2 const HalvingPeriodBlocks = 6 * 365 * 24 * 60 * 2
// Blocks
const AdjustmentPeriod = 7 * 24 * 60 * 2 const AdjustmentPeriod = 7 * 24 * 60 * 2
// TODO: Move other important consts here // TODO: Move other important consts here

View File

@ -633,12 +633,12 @@ func DepositFunds(act *types.Actor, amt types.BigInt) {
act.Balance = types.BigAdd(act.Balance, amt) 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) var miningRewardTotal = types.FromFil(build.MiningRewardTotal)
// MiningReward returns correct mining reward // MiningReward returns correct mining reward
// coffer is amount of FIL in NetworkAddress // 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) ci := big.NewInt(0).Set(coffer.Int)
res := ci.Mul(ci, IV.Int) res := ci.Mul(ci, IV.Int)
res = res.Div(res, miningRewardTotal.Int) res = res.Div(res, miningRewardTotal.Int)