Make clearer that the distribution iterates over all active validators (#8866)

* Make clearer that the distribution iterates over all active validators, not just ones that voted

* Update x/distribution/keeper/allocation.go

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>

* Move comment to docstring

* Change variable name

* Fix: remove git conflict markers

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: SaReN <sahithnarahari@gmail.com>
This commit is contained in:
Rikard Hjort 2021-03-29 18:57:50 +02:00 committed by GitHub
parent 03563287f6
commit 7fc7b3f6ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -11,9 +11,11 @@ import (
)
// AllocateTokens handles distribution of the collected fees
// bondedVotes is a list of (validator address, validator voted on last block flag) for all
// validators in the bonded set.
func (k Keeper) AllocateTokens(
ctx sdk.Context, sumPreviousPrecommitPower, totalPreviousPower int64,
previousProposer sdk.ConsAddress, previousVotes []abci.VoteInfo,
previousProposer sdk.ConsAddress, bondedVotes []abci.VoteInfo,
) {
logger := k.Logger(ctx)
@ -83,7 +85,7 @@ func (k Keeper) AllocateTokens(
// allocate tokens proportionally to voting power
// TODO consider parallelizing later, ref https://github.com/cosmos/cosmos-sdk/pull/3099#discussion_r246276376
for _, vote := range previousVotes {
for _, vote := range bondedVotes {
validator := k.stakingKeeper.ValidatorByConsAddr(ctx, vote.Validator.Address)
// TODO consider microslashing for missing votes.