From bb8872a3eed1de54834652cc50c90e1dfb907b8f Mon Sep 17 00:00:00 2001 From: pritsheth Date: Thu, 8 Feb 2024 08:02:21 -0800 Subject: [PATCH] Fix review comments. --- cmd/soroban-rpc/internal/transactions/transactions.go | 8 ++++---- .../internal/transactions/transactions_test.go | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/soroban-rpc/internal/transactions/transactions.go b/cmd/soroban-rpc/internal/transactions/transactions.go index 91f4aaad..f2feef49 100644 --- a/cmd/soroban-rpc/internal/transactions/transactions.go +++ b/cmd/soroban-rpc/internal/transactions/transactions.go @@ -200,18 +200,18 @@ func (m *MemoryStore) GetTransaction(hash xdr.Hash) (Transaction, bool, StoreRan return Transaction{}, false, storeRange } - var tx_meta xdr.TransactionMeta - err := tx_meta.UnmarshalBinary(internalTx.meta) + var txMeta xdr.TransactionMeta + err := txMeta.UnmarshalBinary(internalTx.meta) if err != nil { return Transaction{}, false, storeRange } - txEvents, err := tx_meta.GetDiagnosticEvents() + txEvents, err := txMeta.GetDiagnosticEvents() if err != nil { return Transaction{}, false, storeRange } - var events [][]byte + events := make([][]byte, 0, len(txEvents)) for _, e := range txEvents { diagnosticEventXDR, err := e.MarshalBinary() diff --git a/cmd/soroban-rpc/internal/transactions/transactions_test.go b/cmd/soroban-rpc/internal/transactions/transactions_test.go index 888d5329..c07c6105 100644 --- a/cmd/soroban-rpc/internal/transactions/transactions_test.go +++ b/cmd/soroban-rpc/internal/transactions/transactions_test.go @@ -359,6 +359,7 @@ func TestGetTransactionsWithEventData(t *testing.T) { tx, ok, _ := store.GetTransaction(txHash(1, false)) require.True(t, ok) require.NotNil(t, tx.Events) + require.Equal(t, 1, len(tx.Events)) }