Skip to content

Commit

Permalink
fix tally to correctly collect ballot losers
Browse files Browse the repository at this point in the history
  • Loading branch information
Yun committed Oct 14, 2019
1 parent 87ec62a commit ce700f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion x/oracle/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func EndBlocker(ctx sdk.Context, k Keeper) {
return false
})

// Transit whitelist array to map for fast lookup
// Changes whitelist array to map for fast lookup
whitelistMap := make(map[string]bool)
for _, denom := range k.Whitelist(ctx) {
whitelistMap[denom] = true
Expand Down
5 changes: 3 additions & 2 deletions x/oracle/tally.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ func tally(ctx sdk.Context, pb types.PriceBallot, k Keeper) (weightedMedian sdk.
}

for _, vote := range pb {
if vote.Price.GTE(weightedMedian.Sub(rewardSpread)) && vote.Price.LTE(weightedMedian.Add(rewardSpread)) {
if validator := k.StakingKeeper.Validator(ctx, vote.Voter); validator != nil {
// If a validator is not found, then just ignore the vote
if validator := k.StakingKeeper.Validator(ctx, vote.Voter); validator != nil {
if vote.Price.GTE(weightedMedian.Sub(rewardSpread)) && vote.Price.LTE(weightedMedian.Add(rewardSpread)) {
power := validator.GetConsensusPower()

ballotWinners = append(ballotWinners, types.Claim{
Expand Down

0 comments on commit ce700f2

Please sign in to comment.