Unverified Commit 18d70da2 authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub
Browse files

call EpochEnd event before increasing (#1043) (#1111)

(cherry picked from commit fb9cb2e0

)

Co-authored-by: default avatarAdam Tucker <adamleetucker@outlook.com>
parent 63633b87
Showing with 3 additions and 3 deletions
+3 -3
......@@ -31,9 +31,6 @@ 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,
......@@ -41,6 +38,9 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
),
)
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(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment