Skip to content

Commit

Permalink
Fix operations trace code
Browse files Browse the repository at this point in the history
  • Loading branch information
chowbao committed Mar 26, 2024
1 parent 585db84 commit 5e8f662
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions internal/transform/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TransformOperation(operation xdr.Operation, operationIndex int32, transacti

outputOperationType := int32(operation.Body.Type)
if outputOperationType < 0 {
return OperationOutput{}, fmt.Errorf("The operation type (%d) is negative for operation %d (operation id=%d)", outputOperationType, operationIndex, outputOperationID)
return OperationOutput{}, fmt.Errorf("the operation type (%d) is negative for operation %d (operation id=%d)", outputOperationType, operationIndex, outputOperationID)
}

outputDetails, err := extractOperationDetails(operation, transaction, operationIndex, network)
Expand All @@ -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
}
}
}

Expand Down

0 comments on commit 5e8f662

Please sign in to comment.