Skip to content

Commit

Permalink
refactor: clean distribution logs (#2356)
Browse files Browse the repository at this point in the history
* add check to remove logs

* remove wrong condition
  • Loading branch information
sainoe authored Oct 17, 2024
1 parent 81755f1 commit 4ec913b
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 4ec913b

Please sign in to comment.