Skip to content

Commit

Permalink
Tally Handler Fixes (#1342) (#1343)
Browse files Browse the repository at this point in the history
* reassign after addition since values are not modified in place

* fix incorrect logic; add bkava when there is no error

Co-authored-by: Nick DeLuca <[email protected]>
  • Loading branch information
karzak and nddeluca authored Oct 9, 2022
1 parent b2012bc commit 14c2d03
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/tally_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,13 @@ func (bkavaMap bkavaByDenom) add(coin sdk.Coin) {
if !found {
bkavaMap[coin.Denom] = sdk.ZeroInt()
}
bkavaMap[coin.Denom].Add(coin.Amount)
bkavaMap[coin.Denom] = bkavaMap[coin.Denom].Add(coin.Amount)
}

func (bkavaMap bkavaByDenom) toCoins() sdk.Coins {
coins := sdk.Coins{}
for denom, amt := range bkavaMap {
coins.Add(sdk.NewCoin(denom, amt))
coins = coins.Add(sdk.NewCoin(denom, amt))
}
return coins.Sort()
}
Expand Down Expand Up @@ -245,7 +245,7 @@ func (th TallyHandler) addBkavaFromEarn(ctx sdk.Context, addr sdk.AccAddress, bk
}
for _, share := range shares {
if th.lk.IsDerivativeDenom(ctx, share.Denom) {
if coin, err := th.ek.ConvertToAssets(ctx, share); err != nil {
if coin, err := th.ek.ConvertToAssets(ctx, share); err == nil {
bkava.add(coin)
}
}
Expand Down

0 comments on commit 14c2d03

Please sign in to comment.