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
co-authored by Łukasz Magiera
parent bd4924aa56
commit b611637652
2 changed files with 4 additions and 2 deletions
+2
View File
@@ -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
+2 -2
View File
@@ -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)