mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 10:50:44 +00:00
fix test reward
This commit is contained in:
parent
7e33e27642
commit
2c49f07ec3
1 changed files with 8 additions and 2 deletions
|
|
@ -201,12 +201,18 @@ func GetRewardBalancesRate(masterAddr common.Address, totalReward *big.Int, vali
|
||||||
log.Error("Fail to get vote capacity", "error", err)
|
log.Error("Fail to get vote capacity", "error", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
totalCap.Add(totalCap, voterCap)
|
totalCap.Add(totalCap, voterCap)
|
||||||
voterCaps[voteAddr] = voterCap
|
voterCaps[voteAddr] = voterCap
|
||||||
}
|
}
|
||||||
for addr, voteCap := range voterCaps {
|
for addr, voteCap := range voterCaps {
|
||||||
balances[addr] = new(big.Int).Mul(totalVoterReward, voteCap)
|
rcap := new(big.Int).Mul(totalVoterReward, voteCap)
|
||||||
balances[addr] = new(big.Int).Div(balances[addr], totalCap)
|
rcap = new(big.Int).Div(rcap, totalCap)
|
||||||
|
if balances[addr] != nil {
|
||||||
|
balances[addr].Add(balances[addr], rcap)
|
||||||
|
} else {
|
||||||
|
balances[addr] = rcap
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue