Skip to content

Commit

Permalink
refactor: clean distribution logs (backport #2356) (#2360)
Browse files Browse the repository at this point in the history
refactor: clean distribution logs (#2356)

* add check to remove logs

* remove wrong condition

(cherry picked from commit 4ec913b)

Co-authored-by: Simon Noetzlin <[email protected]>
  • Loading branch information
mergify[bot] and sainoe authored Oct 17, 2024
1 parent 8e9aa8a commit e8d9826
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions x/ccv/provider/keeper/distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ func (k Keeper) DeleteConsumerRewardsAllocationByDenom(ctx sdk.Context, consumer

// AllocateConsumerRewards allocates the given rewards to provider consumer chain with the given consumer id
func (k Keeper) AllocateConsumerRewards(ctx sdk.Context, consumerId string, alloc types.ConsumerRewardsAllocation) (types.ConsumerRewardsAllocation, error) {
if alloc.Rewards.IsZero() {
return types.ConsumerRewardsAllocation{}, nil
}

chainId, err := k.GetConsumerChainId(ctx, consumerId)
if err != nil {
Expand Down Expand Up @@ -268,10 +271,6 @@ func (k Keeper) AllocateConsumerRewards(ctx sdk.Context, consumerId string, allo
// AllocateTokens performs rewards distribution to the community pool and validators
// based on the Partial Set Security distribution specification.
func (k Keeper) AllocateTokens(ctx sdk.Context) {
// return if there is no coins in the consumer rewards pool
if k.GetConsumerRewardsPool(ctx).IsZero() {
return
}

// Iterate over all launched consumer chains.
// To avoid large iterations over all the consumer IDs, iterate only over
Expand Down Expand Up @@ -312,6 +311,7 @@ func (k Keeper) AllocateTokens(ctx sdk.Context) {
)
continue
}

err = k.SetConsumerRewardsAllocationByDenom(cachedCtx, consumerId, denom, remainingRewardDec)
if err != nil {
k.Logger(ctx).Error(
Expand All @@ -321,6 +321,7 @@ func (k Keeper) AllocateTokens(ctx sdk.Context) {
)
continue
}

writeCache()
}
}
Expand Down

0 comments on commit e8d9826

Please sign in to comment.