Skip to content

Commit

Permalink
Address PR review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikiyer56 committed Nov 25, 2024
1 parent fe7cef8 commit 06c515c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions ingest/change.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions ingest/ledger_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
Expand All @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions ingest/ledger_transaction_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion ingest/ledger_transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 06c515c

Please sign in to comment.