Skip to content

Commit

Permalink
call EpochEnd event before increasing (#1043)
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic authored Mar 17, 2022
1 parent 8fb4665 commit fb9cb2e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions x/epochs/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
epochInfo.CurrentEpochStartTime = epochInfo.StartTime
logger.Info(fmt.Sprintf("Starting new epoch with identifier %s epoch number %d", epochInfo.Identifier, epochInfo.CurrentEpoch))
} else {
epochInfo.CurrentEpoch += 1
epochInfo.CurrentEpochStartTime = epochInfo.CurrentEpochStartTime.Add(epochInfo.Duration)
logger.Info(fmt.Sprintf("Starting epoch with identifier %s epoch number %d", epochInfo.Identifier, epochInfo.CurrentEpoch))
ctx.EventManager().EmitEvent(
sdk.NewEvent(
types.EventTypeEpochEnd,
sdk.NewAttribute(types.AttributeEpochNumber, fmt.Sprintf("%d", epochInfo.CurrentEpoch)),
),
)
k.AfterEpochEnd(ctx, epochInfo.Identifier, epochInfo.CurrentEpoch)
epochInfo.CurrentEpoch += 1
epochInfo.CurrentEpochStartTime = epochInfo.CurrentEpochStartTime.Add(epochInfo.Duration)
logger.Info(fmt.Sprintf("Starting epoch with identifier %s epoch number %d", epochInfo.Identifier, epochInfo.CurrentEpoch))
}
k.SetEpochInfo(ctx, epochInfo)
ctx.EventManager().EmitEvent(
Expand Down

0 comments on commit fb9cb2e

Please sign in to comment.