Skip to content

Commit

Permalink
inital changes (#449)
Browse files Browse the repository at this point in the history
Co-authored-by: Ajaz Ahmed Ansari <[email protected]>
  • Loading branch information
muku314115 and ajansari95 authored Jun 7, 2023
1 parent 7779895 commit 76e266d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions x/participationrewards/keeper/hooks.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package keeper

import (
"errors"

"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
sdk "github.com/cosmos/cosmos-sdk/types"

Expand Down Expand Up @@ -56,11 +54,7 @@ func (k *Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, _ int64)
k.GetParams(ctx).DistributionProportions,
)
if err != nil {
if errors.Is(err, types.ErrNothingToAllocate) {
k.Logger(ctx).Info(err.Error())
} else {
k.Logger(ctx).Error(err.Error())
}
k.Logger(ctx).Error(err.Error())
}

k.Logger(ctx).Info("Triggering submodule hooks")
Expand All @@ -74,6 +68,12 @@ func (k *Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, _ int64)
return nil
}

if allocation == nil {
// if allocation is unset, then return early to avoid panic
k.Logger(ctx).Error("nil allocation", "error", err.Error())
return nil
}

if err := k.AllocateZoneRewards(ctx, tvs, *allocation); err != nil {
k.Logger(ctx).Error(err.Error())
return err
Expand Down

0 comments on commit 76e266d

Please sign in to comment.