Skip to content

Commit

Permalink
Omit encoding txdata on errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Aug 20, 2024
1 parent 6ef7e75 commit 323c21f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions cmd/soroban-rpc/internal/methods/simulate_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,13 +398,15 @@ func NewSimulateTransactionHandler(logger *log.Entry, ledgerEntryReader db.Ledge

switch request.Format {
case FormatJSON:
simResp.TransactionDataJSON, err = xdr2json.ConvertBytes(
xdr.SorobanTransactionData{},
result.TransactionData)
if err != nil {
return SimulateTransactionResponse{
Error: err.Error(),
LatestLedger: latestLedger,
if len(result.TransactionData) > 0 {
simResp.TransactionDataJSON, err = xdr2json.ConvertBytes(
xdr.SorobanTransactionData{},
result.TransactionData)
if err != nil {
return SimulateTransactionResponse{
Error: err.Error(),
LatestLedger: latestLedger,
}
}
}

Expand Down

0 comments on commit 323c21f

Please sign in to comment.