From 27d830cf7a13d1f46dc3cbf0adc3e0e68a6afddc Mon Sep 17 00:00:00 2001 From: beer-1 Date: Fri, 4 Oct 2024 16:49:43 +0900 Subject: [PATCH] fix condition --- x/move/keeper/handler.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/x/move/keeper/handler.go b/x/move/keeper/handler.go index 4a042f59..a61a3c32 100644 --- a/x/move/keeper/handler.go +++ b/x/move/keeper/handler.go @@ -438,17 +438,17 @@ func (k Keeper) dispatchMessage(parentCtx sdk.Context, message vmtypes.CosmosMes sdk.NewAttribute(types.AttributeKeySuccess, fmt.Sprintf("%v", success)), ) - // return error if failed and not allowed to fail - if !success && !allowFailure { - // emit failed reason event + if !success { + // return error if failed and not allowed to fail + if !allowFailure { + return + } + + // emit failed reason event if failed and allowed to fail event.AppendAttributes(sdk.NewAttribute(types.AttributeKeyReason, err.Error())) parentCtx.EventManager().EmitEvent(event) - - return - } - - // commit if success - if success { + } else { + // commit if success commit() }