From ee9096a6b4ebb8e8c2024ed559a3a2d403f5a3ff Mon Sep 17 00:00:00 2001 From: sfsf9797 Date: Mon, 29 Jan 2024 16:25:21 +0800 Subject: [PATCH 1/2] use NewLedgerChangeReaderFromLedgerCloseMeta --- internal/input/transactions.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/input/transactions.go b/internal/input/transactions.go index 6f2174c1..d7599a00 100644 --- a/internal/input/transactions.go +++ b/internal/input/transactions.go @@ -33,17 +33,18 @@ func GetTransactions(start, end uint32, limit int64, env utils.EnvironmentDetail err = backend.PrepareRange(ctx, ledgerbackend.BoundedRange(start, end)) panicIf(err) for seq := start; seq <= end; seq++ { - txReader, err := ingest.NewLedgerTransactionReader(ctx, backend, env.NetworkPassphrase, seq) + ledgerCloseMeta, err := backend.GetLedger(ctx, seq) + if err != nil { + return nil, errors.Wrap(err, "error getting ledger from the backend") + } + + txReader, err := ingest.NewLedgerChangeReaderFromLedgerCloseMeta(env.NetworkPassphrase, ledgerCloseMeta) if err != nil { return []LedgerTransformInput{}, err } lhe := txReader.GetHeader() - ledgerCloseMeta, err := backend.GetLedger(ctx, seq) - if err != nil { - return nil, errors.Wrap(err, "error getting ledger from the backend") - } // A negative limit value means that all input should be processed for int64(len(txSlice)) < limit || limit < 0 { tx, err := txReader.Read() From cce2664e180f925f9e730ce164fc80a79c65907f Mon Sep 17 00:00:00 2001 From: sfsf9797 Date: Mon, 29 Jan 2024 16:52:02 +0800 Subject: [PATCH 2/2] fix:NewLedgerTransactionReaderFromLedgerCloseMeta --- internal/input/transactions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/input/transactions.go b/internal/input/transactions.go index d7599a00..8bc79fcd 100644 --- a/internal/input/transactions.go +++ b/internal/input/transactions.go @@ -38,7 +38,7 @@ func GetTransactions(start, end uint32, limit int64, env utils.EnvironmentDetail return nil, errors.Wrap(err, "error getting ledger from the backend") } - txReader, err := ingest.NewLedgerChangeReaderFromLedgerCloseMeta(env.NetworkPassphrase, ledgerCloseMeta) + txReader, err := ingest.NewLedgerTransactionReaderFromLedgerCloseMeta(env.NetworkPassphrase, ledgerCloseMeta) if err != nil { return []LedgerTransformInput{}, err }