Skip to content

Commit

Permalink
Merge branch 'release/v6.2.x' into mergify/bp/release/v6.2.x/pr-2355
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoke authored Oct 17, 2024
2 parents 1e246de + e8d9826 commit 5a1b423
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 5a1b423

Please sign in to comment.