diff --git a/coreV2/state/validators/validators.go b/coreV2/state/validators/validators.go index 40239cbb2..f865937f8 100644 --- a/coreV2/state/validators/validators.go +++ b/coreV2/state/validators/validators.go @@ -464,13 +464,12 @@ func (v *Validators) PayRewardsV3(height uint64, period int64) (moreRewards *big safeRewardVariable := big.NewInt(0).Set(reward) if validator.bus.Accounts().IsX3Mining(stake.Owner, height) { - // todo: move up safeRewards := big.NewInt(0).Mul(safeReward, big.NewInt(period)) safeRewards.Mul(safeRewards, stake.BipValue) safeRewards.Div(safeRewards, validator.GetTotalBipStake()) - safeRewards.Mul(safeRewards, big.NewInt(3)) safeRewards.Sub(safeRewards, big.NewInt(0).Div(big.NewInt(0).Mul(safeRewards, big.NewInt(int64(developers.Commission+dao.Commission))), big.NewInt(100))) safeRewards.Sub(safeRewards, big.NewInt(0).Div(big.NewInt(0).Mul(safeRewards, big.NewInt(int64(candidate.Commission))), big.NewInt(100))) + safeRewards.Mul(safeRewards, big.NewInt(3)) calcRewards := big.NewInt(0).Mul(calcReward, big.NewInt(period)) calcRewards.Mul(calcRewards, stake.BipValue) @@ -481,6 +480,9 @@ func (v *Validators) PayRewardsV3(height uint64, period int64) (moreRewards *big feeRewards := big.NewInt(0).Sub(reward, calcRewards) safeRewardVariable.Set(big.NewInt(0).Add(safeRewards, feeRewards)) + if safeRewardVariable.Sign() < 1 { + continue + } moreRewards.Add(moreRewards, new(big.Int).Sub(safeRewardVariable, reward)) }