From 05b37a9a3bc2133d8944d6e70c0f35fa0e1c57d9 Mon Sep 17 00:00:00 2001 From: Simon Chow Date: Tue, 26 Mar 2024 11:21:58 -0400 Subject: [PATCH] Fix operation trace code bug --- internal/transform/operation.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/internal/transform/operation.go b/internal/transform/operation.go index 5a6d1463..f42bbf06 100644 --- a/internal/transform/operation.go +++ b/internal/transform/operation.go @@ -66,18 +66,17 @@ func TransformOperation(operation xdr.Operation, operationIndex int32, transacti return OperationOutput{}, err } - outputOperationResults, ok := transaction.Result.Result.OperationResults() - if !ok { - return OperationOutput{}, err - } - - outputOperationResultCode := outputOperationResults[operationIndex].Code.String() + var outputOperationResultCode string var outputOperationTraceCode string - operationResultTr, ok := outputOperationResults[operationIndex].GetTr() + outputOperationResults, ok := transaction.Result.Result.OperationResults() if ok { - outputOperationTraceCode, err = mapOperationTrace(operationResultTr) - if err != nil { - return OperationOutput{}, err + outputOperationResultCode = outputOperationResults[operationIndex].Code.String() + operationResultTr, ok := outputOperationResults[operationIndex].GetTr() + if ok { + outputOperationTraceCode, err = mapOperationTrace(operationResultTr) + if err != nil { + return OperationOutput{}, err + } } }