From 23711b25765fb80eea2b9900e10f0b425ecfc4e7 Mon Sep 17 00:00:00 2001 From: Simon Chow Date: Wed, 10 Jul 2024 19:36:33 -0400 Subject: [PATCH 1/2] Add nil sorobanMeta check for transactions --- internal/transform/transaction.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/internal/transform/transaction.go b/internal/transform/transaction.go index f4eb255d..05375791 100644 --- a/internal/transform/transaction.go +++ b/internal/transform/transaction.go @@ -167,11 +167,13 @@ func TransformTransaction(transaction ingest.LedgerTransaction, lhe xdr.LedgerHe if ok { accountBalanceStart, accountBalanceEnd := getAccountBalanceFromLedgerEntryChanges(meta.TxChangesAfter, sourceAccount.Address()) outputResourceFeeRefund = accountBalanceEnd - accountBalanceStart - extV1, ok := meta.SorobanMeta.Ext.GetV1() - if ok { - outputTotalNonRefundableResourceFeeCharged = int64(extV1.TotalNonRefundableResourceFeeCharged) - outputTotalRefundableResourceFeeCharged = int64(extV1.TotalRefundableResourceFeeCharged) - outputRentFeeCharged = int64(extV1.RentFeeCharged) + if meta.SorobanMeta != nil { + extV1, ok := meta.SorobanMeta.Ext.GetV1() + if ok { + outputTotalNonRefundableResourceFeeCharged = int64(extV1.TotalNonRefundableResourceFeeCharged) + outputTotalRefundableResourceFeeCharged = int64(extV1.TotalRefundableResourceFeeCharged) + outputRentFeeCharged = int64(extV1.RentFeeCharged) + } } } @@ -238,8 +240,8 @@ func TransformTransaction(transaction ingest.LedgerTransaction, lhe xdr.LedgerHe if transaction.Envelope.IsFeeBump() { feeBumpAccount := transaction.Envelope.FeeBumpAccount() feeAccount := feeBumpAccount.ToAccountId() - if sourceAccount.Type == xdr.CryptoKeyTypeKeyTypeMuxedEd25519 { - feeAccountMuxed := feeAccount.Address() + if feeBumpAccount.Type == xdr.CryptoKeyTypeKeyTypeMuxedEd25519 { + feeAccountMuxed := feeBumpAccount.Address() transformedTransaction.FeeAccountMuxed = feeAccountMuxed } transformedTransaction.FeeAccount = feeAccount.Address() From 956f19c2b9e0fb676cbe94cb2b00569a37de1512 Mon Sep 17 00:00:00 2001 From: Simon Chow Date: Wed, 10 Jul 2024 19:38:09 -0400 Subject: [PATCH 2/2] remove feebump change --- internal/transform/transaction.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/transform/transaction.go b/internal/transform/transaction.go index 05375791..2ef9cec8 100644 --- a/internal/transform/transaction.go +++ b/internal/transform/transaction.go @@ -240,8 +240,8 @@ func TransformTransaction(transaction ingest.LedgerTransaction, lhe xdr.LedgerHe if transaction.Envelope.IsFeeBump() { feeBumpAccount := transaction.Envelope.FeeBumpAccount() feeAccount := feeBumpAccount.ToAccountId() - if feeBumpAccount.Type == xdr.CryptoKeyTypeKeyTypeMuxedEd25519 { - feeAccountMuxed := feeBumpAccount.Address() + if sourceAccount.Type == xdr.CryptoKeyTypeKeyTypeMuxedEd25519 { + feeAccountMuxed := feeAccount.Address() transformedTransaction.FeeAccountMuxed = feeAccountMuxed } transformedTransaction.FeeAccount = feeAccount.Address()