diff --git a/internal/services/ingest.go b/internal/services/ingest.go index 9d20a9f..a432cf1 100644 --- a/internal/services/ingest.go +++ b/internal/services/ingest.go @@ -161,7 +161,7 @@ func (m *ingestService) ingestPayments(ctx context.Context, ledgerTransactions [ OperationType: op.Body.Type.String(), TransactionID: utils.TransactionID(int32(tx.Ledger), int32(tx.ApplicationOrder)), TransactionHash: tx.Hash, - FromAddress: utils.SourceAccountRPC(op, txEnvelopeXDR), + FromAddress: utils.SourceAccount(op, txEnvelopeXDR), CreatedAt: time.Unix(tx.CreatedAt, 0), Memo: txMemo, MemoType: txMemoType, diff --git a/internal/tss/services/transaction_manager_test.go b/internal/tss/services/transaction_manager_test.go index f094ccb..d8fe1d5 100644 --- a/internal/tss/services/transaction_manager_test.go +++ b/internal/tss/services/transaction_manager_test.go @@ -145,7 +145,7 @@ func TestBuildAndSubmitTransaction(t *testing.T) { _, err := txManager.BuildAndSubmitTransaction(context.Background(), "channel", payload) - assert.Equal(t, "channel: RPC fail: parse error result xdr string: unable to unmarshal errorResultXDR: ABCD", err.Error()) + assert.Equal(t, "channel: RPC fail: parse error result xdr string: unable to parse: unable to unmarshal errorResultXDR: ABCD", err.Error()) var txStatus string err = dbConnectionPool.GetContext(context.Background(), &txStatus, `SELECT current_status FROM tss_transactions WHERE transaction_hash = $1`, payload.TransactionHash) diff --git a/internal/utils/ingestion_utils.go b/internal/utils/ingestion_utils.go index 6fe0ead..1235ce8 100644 --- a/internal/utils/ingestion_utils.go +++ b/internal/utils/ingestion_utils.go @@ -3,7 +3,6 @@ package utils import ( "strconv" - "github.com/stellar/go/ingest" "github.com/stellar/go/toid" "github.com/stellar/go/xdr" ) @@ -58,24 +57,15 @@ func Memo(memo xdr.Memo, txHash string) (*string, string) { return nil, memoType.String() } -func SourceAccountRPC(op xdr.Operation, txEnvelope xdr.TransactionEnvelope) string { +func SourceAccount(op xdr.Operation, txEnvelope xdr.TransactionEnvelope) string { account := op.SourceAccount if account != nil { return account.ToAccountId().Address() } - + txEnvelope.SourceAccount() return txEnvelope.SourceAccount().ToAccountId().Address() } -func SourceAccount(op xdr.Operation, tx ingest.LedgerTransaction) string { - account := op.SourceAccount - if account != nil { - return account.ToAccountId().Address() - } - - return tx.Envelope.SourceAccount().ToAccountId().Address() -} - func AssetCode(asset xdr.Asset) string { if asset.Type == xdr.AssetTypeAssetTypeNative { return "XLM"