From 33d4d258db145241158a4f12b9fc3b52c9752665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?colin=20axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 9 May 2022 17:43:41 +0200 Subject: [PATCH 1/2] emit events after writing cache --- modules/apps/29-fee/keeper/escrow.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/apps/29-fee/keeper/escrow.go b/modules/apps/29-fee/keeper/escrow.go index 0ca84684440..f1cff49ae3e 100644 --- a/modules/apps/29-fee/keeper/escrow.go +++ b/modules/apps/29-fee/keeper/escrow.go @@ -228,5 +228,8 @@ func (k Keeper) RefundFeesOnChannelClosure(ctx sdk.Context, portID, channelID st // write the cache writeFn() + // NOTE: The context returned by CacheContext() refers to a new EventManager, so it needs to explicitly set events to the original context. + ctx.EventManager().EmitEvents(cacheCtx.EventManager().Events()) + return nil } From 2f34cb8be97a197dae1f172243874443aca34cce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?colin=20axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 9 May 2022 18:21:36 +0200 Subject: [PATCH 2/2] switch ordering --- modules/apps/29-fee/keeper/escrow.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/apps/29-fee/keeper/escrow.go b/modules/apps/29-fee/keeper/escrow.go index f1cff49ae3e..2c5b570320e 100644 --- a/modules/apps/29-fee/keeper/escrow.go +++ b/modules/apps/29-fee/keeper/escrow.go @@ -225,11 +225,11 @@ func (k Keeper) RefundFeesOnChannelClosure(ctx sdk.Context, portID, channelID st k.DeleteFeesInEscrow(cacheCtx, identifiedPacketFee.PacketId) } - // write the cache - writeFn() - // NOTE: The context returned by CacheContext() refers to a new EventManager, so it needs to explicitly set events to the original context. ctx.EventManager().EmitEvents(cacheCtx.EventManager().Events()) + // write the cache + writeFn() + return nil }