From ec4642b1044c08116f232a250bac90547931cd91 Mon Sep 17 00:00:00 2001 From: Srinivas Baride Date: Wed, 23 Jun 2021 21:09:09 +0530 Subject: [PATCH] Added events in subscription and session endblock --- x/session/abci.go | 7 +++++++ x/subscription/abci.go | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/x/session/abci.go b/x/session/abci.go index f1f5a800..d48fe50a 100644 --- a/x/session/abci.go +++ b/x/session/abci.go @@ -29,6 +29,13 @@ func EndBlock(ctx sdk.Context, k keeper.Keeper) []abcitypes.ValidatorUpdate { k.SetSession(ctx, item) k.SetInactiveSessionForAddress(ctx, itemAddress, item.Id) k.SetInactiveSessionAt(ctx, item.StatusAt.Add(inactiveDuration), item.Id) + ctx.EventManager().EmitTypedEvent( + &types.EventEndSession{ + Id: item.Id, + Subscription: item.Subscription, + Node: item.Node, + }, + ) return false } diff --git a/x/subscription/abci.go b/x/subscription/abci.go index 2ec88e4c..ede3f23e 100644 --- a/x/subscription/abci.go +++ b/x/subscription/abci.go @@ -33,6 +33,11 @@ func EndBlock(ctx sdk.Context, k keeper.Keeper) []abcitypes.ValidatorUpdate { k.SetSubscription(ctx, item) k.SetInactiveSubscriptionAt(ctx, item.StatusAt.Add(inactiveDuration), item.Id) + ctx.EventManager().EmitTypedEvent( + &types.EventCancelSubscription{ + Id: item.Id, + }, + ) return false }