Skip to content

Commit

Permalink
fix: huckleberry event OnRecvPacket
Browse files Browse the repository at this point in the history
  • Loading branch information
ulbqb committed May 30, 2023
1 parent 82881e0 commit d1ae1c4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions modules/core/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,12 +410,11 @@ func (k Keeper) RecvPacket(goCtx context.Context, msg *channeltypes.MsgRecvPacke
// Cache context so that we may discard state changes from callback if the acknowledgement is unsuccessful.
cacheCtx, writeFn = ctx.CacheContext()
ack := cbs.OnRecvPacket(cacheCtx, msg.Packet, relayer)
// NOTE: The context returned by CacheContext() refers to a new EventManager, so it needs to explicitly set events to the original context.
// Events from callback are emitted regardless of acknowledgement success
ctx.EventManager().EmitEvents(cacheCtx.EventManager().Events())
if ack == nil || ack.Success() {
// write application state changes for asynchronous and successful acknowledgements
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())
}

// Set packet acknowledgement only if the acknowledgement is not nil.
Expand Down

0 comments on commit d1ae1c4

Please sign in to comment.