fix: propagate events in x/group through sdk.Results (#13808)
This commit is contained in:
parent
bcdf81cbaf
commit
90fd3e9f42
@ -754,13 +754,18 @@ func (k Keeper) Exec(goCtx context.Context, req *group.MsgExec) (*group.MsgExecR
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if _, err := k.doExecuteMsgs(cacheCtx, k.router, proposal, addr); err != nil {
|
||||
if results, err := k.doExecuteMsgs(cacheCtx, k.router, proposal, addr); err != nil {
|
||||
proposal.ExecutorResult = group.PROPOSAL_EXECUTOR_RESULT_FAILURE
|
||||
logs = fmt.Sprintf("proposal execution failed on proposal %d, because of error %s", id, err.Error())
|
||||
k.Logger(ctx).Info("proposal execution failed", "cause", err, "proposalID", id)
|
||||
} else {
|
||||
proposal.ExecutorResult = group.PROPOSAL_EXECUTOR_RESULT_SUCCESS
|
||||
flush()
|
||||
|
||||
for _, res := range results {
|
||||
// NOTE: The sdk msg handler creates a new EventManager, so events must be correctly propagated back to the current context
|
||||
ctx.EventManager().EmitEvents(res.GetEvents())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user