Skip to content

Commit

Permalink
fix broken test + delete unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
gouthamp-stellar committed Sep 30, 2024
1 parent 43711ca commit 757e6d5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion internal/services/ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion internal/tss/services/transaction_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 2 additions & 12 deletions internal/utils/ingestion_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package utils
import (
"strconv"

"github.com/stellar/go/ingest"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 757e6d5

Please sign in to comment.