From 06c515c402ff6499b4da74eeb93825b04e72a5a0 Mon Sep 17 00:00:00 2001 From: Karthik Iyer Date: Sun, 24 Nov 2024 21:12:23 -0800 Subject: [PATCH] Address PR review changes --- ingest/change.go | 16 ++++++++-------- ingest/ledger_transaction.go | 12 ++++++------ ingest/ledger_transaction_reader.go | 4 ++-- ingest/ledger_transaction_test.go | 2 +- .../ingest/processors/operations_processor.go | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/ingest/change.go b/ingest/change.go index 432cadaa9a..7a3c0961e3 100644 --- a/ingest/change.go +++ b/ingest/change.go @@ -62,14 +62,14 @@ import ( // // - LedgerUpgrade: Information about the upgrade, if the change occurred as part of an upgrade. type Change struct { - Type xdr.LedgerEntryType - Pre *xdr.LedgerEntry - Post *xdr.LedgerEntry - Reason LedgerEntryChangeReason - OperationIdx uint32 - Tx *LedgerTransaction - Lcm *xdr.LedgerCloseMeta - LedgerUpgrade *xdr.LedgerUpgrade + Type xdr.LedgerEntryType + Pre *xdr.LedgerEntry + Post *xdr.LedgerEntry + Reason LedgerEntryChangeReason + OperationIndex uint32 + Transaction *LedgerTransaction + LEdger *xdr.LedgerCloseMeta + LedgerUpgrade *xdr.LedgerUpgrade } type LedgerEntryChangeReason uint16 diff --git a/ingest/ledger_transaction.go b/ingest/ledger_transaction.go index 79f7c7b275..3c54cd5764 100644 --- a/ingest/ledger_transaction.go +++ b/ingest/ledger_transaction.go @@ -17,8 +17,8 @@ type LedgerTransaction struct { FeeChanges xdr.LedgerEntryChanges UnsafeMeta xdr.TransactionMeta LedgerVersion uint32 - Lcm *xdr.LedgerCloseMeta // This is read-only and not to be modified by downstream functions - Hash *xdr.Hash + Ledger xdr.LedgerCloseMeta // This is read-only and not to be modified by downstream functions + Hash xdr.Hash } func (t *LedgerTransaction) txInternalError() bool { @@ -31,7 +31,7 @@ func (t *LedgerTransaction) GetFeeChanges() []Change { changes := GetChangesFromLedgerEntryChanges(t.FeeChanges) for _, change := range changes { change.Reason = FeeChange - change.Tx = t + change.Transaction = t } return changes } @@ -40,7 +40,7 @@ func (t *LedgerTransaction) getTransactionChanges(ledgerEntryChanges xdr.LedgerE changes := GetChangesFromLedgerEntryChanges(ledgerEntryChanges) for _, change := range changes { change.Reason = Transaction - change.Tx = t + change.Transaction = t } return changes } @@ -171,8 +171,8 @@ func (t *LedgerTransaction) operationChanges(ops []xdr.OperationMeta, index uint for _, change := range changes { change.Reason = Operation - change.Tx = t - change.OperationIdx = index + change.Transaction = t + change.OperationIndex = index } return changes } diff --git a/ingest/ledger_transaction_reader.go b/ingest/ledger_transaction_reader.go index 42f1363585..bbe11a15b8 100644 --- a/ingest/ledger_transaction_reader.go +++ b/ingest/ledger_transaction_reader.go @@ -94,8 +94,8 @@ func (reader *LedgerTransactionReader) Read() (LedgerTransaction, error) { UnsafeMeta: reader.lcm.TxApplyProcessing(i), FeeChanges: reader.lcm.FeeProcessing(i), LedgerVersion: uint32(reader.lcm.LedgerHeaderHistoryEntry().Header.LedgerVersion), - Lcm: &reader.lcm, - Hash: &hash, + Ledger: reader.lcm, + Hash: hash, }, nil } diff --git a/ingest/ledger_transaction_test.go b/ingest/ledger_transaction_test.go index 545c5c6aee..ced92e6918 100644 --- a/ingest/ledger_transaction_test.go +++ b/ingest/ledger_transaction_test.go @@ -336,7 +336,7 @@ func TestFeeMetaAndOperationsChangesSeparate(t *testing.T) { assert.Equal(t, operationChanges[0].Pre.Data.MustAccount().Balance, xdr.Int64(300)) assert.Equal(t, operationChanges[0].Post.Data.MustAccount().Balance, xdr.Int64(400)) - // Ignore operation meta if Tx result is txInternalError + // Ignore operation meta if tx result is txInternalError // https://github.com/stellar/go/issues/2111 tx.Result.Result.Result.Code = xdr.TransactionResultCodeTxInternalError metaChanges, err = tx.GetChanges() diff --git a/services/horizon/internal/ingest/processors/operations_processor.go b/services/horizon/internal/ingest/processors/operations_processor.go index 80e834df4e..39d09b1608 100644 --- a/services/horizon/internal/ingest/processors/operations_processor.go +++ b/services/horizon/internal/ingest/processors/operations_processor.go @@ -324,7 +324,7 @@ func addAccountAndMuxedAccountDetails(result map[string]interface{}, a xdr.Muxed // _muxed_id fields should had ideally been stored in the DB as a string instead of uint64 // due to Javascript not being able to handle them, see https://github.com/stellar/go/issues/3714 // However, we released this code in the wild before correcting it. Thus, what we do is - // work around it (by preprocessing it into a string) in OperationChange.UnmarshalDetails() + // work around it (by preprocessing it into a string) in Operation.UnmarshalDetails() result[prefix+"_muxed_id"] = uint64(a.Med25519.Id) } }