From fe7faaf0f0e394b729ac5a26efd248c2d0134d76 Mon Sep 17 00:00:00 2001 From: Srinivas Baride Date: Thu, 27 Jul 2023 16:54:56 +0530 Subject: [PATCH] Fix delete session in endblock --- x/session/keeper/abci.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x/session/keeper/abci.go b/x/session/keeper/abci.go index 3c63a007..cb538f07 100644 --- a/x/session/keeper/abci.go +++ b/x/session/keeper/abci.go @@ -17,6 +17,9 @@ func (k *Keeper) EndBlock(ctx sdk.Context) []abcitypes.ValidatorUpdate { // Iterate over all sessions that have become inactive at the current block time. k.IterateSessionsForInactiveAt(ctx, ctx.BlockTime(), func(_ int, item types.Session) bool { + // Delete the session from the InactiveAt index before updating the InactiveAt value. + k.DeleteSessionForInactiveAt(ctx, item.InactiveAt, item.ID) + // If the session's status is active, set it to inactive-pending and schedule // its next status update based on the status change delay. if item.Status.Equal(hubtypes.StatusActive) {