Skip to content

Commit

Permalink
CNS-694: fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
oren-lava committed Dec 19, 2023
1 parent 3c190e6 commit f0e86a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 0 additions & 2 deletions testutil/keeper/mock_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,11 @@ func (k mockBankKeeper) SetBalance(ctx sdk.Context, addr sdk.AccAddress, amounts
func (k mockBankKeeper) AddToBalance(addr sdk.AccAddress, amounts sdk.Coins) error {
if _, ok := balance[addr.String()]; ok {
for _, coin := range amounts {
fmt.Printf("before balance[addr.String()].String(): %v\n", balance[addr.String()].String())
balance[addr.String()] = balance[addr.String()].Add(coin)
}
} else {
balance[addr.String()] = amounts
}
fmt.Printf("after balance[addr.String()].String(): %v\n", balance[addr.String()].String())
return nil
}

Expand Down
18 changes: 9 additions & 9 deletions x/rewards/keeper/rewards.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ func (k Keeper) DistributeBlockReward(ctx sdk.Context) {
utils.Attribute{Key: "distribution_pool_balance", Value: distributionPoolBalance.String()},
utils.Attribute{Key: "blocks_to_next_timer_expiry", Value: strconv.FormatInt(blocksToNextTimerExpiry, 10)},
)
}

coins := sdk.NewCoins(sdk.NewCoin(k.stakingKeeper.BondDenom(ctx), validatorsRewards))
} else {
coins := sdk.NewCoins(sdk.NewCoin(k.stakingKeeper.BondDenom(ctx), validatorsRewards))

// distribute rewards to validators (same as Cosmos mint module)
err := k.addCollectedFees(ctx, coins)
if err != nil {
utils.LavaFormatError("critical - could not send validators rewards to fee collector", err,
utils.Attribute{Key: "rewards", Value: coins.String()},
)
// distribute rewards to validators (same as Cosmos mint module)
err := k.addCollectedFees(ctx, coins)
if err != nil {
utils.LavaFormatError("critical - could not send validators rewards to fee collector", err,
utils.Attribute{Key: "rewards", Value: coins.String()},
)
}
}
}

Expand Down

0 comments on commit f0e86a9

Please sign in to comment.