diff --git a/cmd/soroban-rpc/internal/methods/get_transactions.go b/cmd/soroban-rpc/internal/methods/get_transactions.go index 2792db40..f8c38dd8 100644 --- a/cmd/soroban-rpc/internal/methods/get_transactions.go +++ b/cmd/soroban-rpc/internal/methods/get_transactions.go @@ -139,16 +139,16 @@ LedgerLoop: for ledgerSeq := start.LedgerSequence; ledgerSeq <= int32(ledgerRange.LastLedger.Sequence); ledgerSeq++ { // Get ledger close meta from db ledger, found, err := h.ledgerReader.GetLedger(ctx, uint32(ledgerSeq)) - if !found { - return GetTransactionsResponse{}, &jrpc2.Error{ - Code: jrpc2.InvalidParams, - Message: errors.Errorf("ledger close meta not found: %d", ledgerSeq).Error(), - } - } else if err != nil { + if err != nil { return GetTransactionsResponse{}, &jrpc2.Error{ Code: jrpc2.InternalError, Message: err.Error(), } + } else if !found { + return GetTransactionsResponse{}, &jrpc2.Error{ + Code: jrpc2.InvalidParams, + Message: errors.Errorf("ledger close meta not found: %d", ledgerSeq).Error(), + } } // Initialise tx reader.