From fb94fdff2748c2743493a79b8aecc328c08ebf98 Mon Sep 17 00:00:00 2001 From: Karthik Iyer Date: Wed, 20 Nov 2024 19:29:21 -0800 Subject: [PATCH] Fix failing unit test --- ingest/ledger_transaction.go | 6 +++--- xdr/transaction_envelope.go | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ingest/ledger_transaction.go b/ingest/ledger_transaction.go index e2def262fd..d6bf544471 100644 --- a/ingest/ledger_transaction.go +++ b/ingest/ledger_transaction.go @@ -62,7 +62,7 @@ func (t *LedgerTransaction) GetChanges() ([]Change, error) { for _, change := range opChanges { op, found := t.GetOperation(uint32(opIdx)) if !found { - return []Change{}, errors.New("could not find operation") + continue } results, _ := t.Result.OperationResults() operationResult := results[opIdx].MustTr() @@ -115,7 +115,7 @@ func (t *LedgerTransaction) GetChanges() ([]Change, error) { for _, change := range opChanges { op, found := t.GetOperation(uint32(opIdx)) if !found { - return []Change{}, errors.New("could not find operation") + continue } results, _ := t.Result.OperationResults() operationResult := results[opIdx].MustTr() @@ -194,7 +194,7 @@ func (t *LedgerTransaction) operationChanges(ops []xdr.OperationMeta, index uint for _, change := range changes { op, found := t.GetOperation(index) if !found { - return []Change{}, errors.New("could not find operation") + continue } results, _ := t.Result.OperationResults() operationResult := results[index].MustTr() diff --git a/xdr/transaction_envelope.go b/xdr/transaction_envelope.go index 6d513ff342..b2259fedea 100644 --- a/xdr/transaction_envelope.go +++ b/xdr/transaction_envelope.go @@ -215,6 +215,10 @@ func (e TransactionEnvelope) Preconditions() Preconditions { // Note for fee bump transactions, Operations() returns the operations // of the inner transaction func (e TransactionEnvelope) Operations() []Operation { + // This is not expected to happen. + if (e == TransactionEnvelope{}) { + return []Operation{} + } switch e.Type { case EnvelopeTypeEnvelopeTypeTxFeeBump: return e.FeeBump.Tx.InnerTx.V1.Tx.Operations