Skip to content

Commit

Permalink
changes based on comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gouthamp-stellar committed Oct 15, 2024
1 parent f63304b commit 0957985
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 11 deletions.
1 change: 0 additions & 1 deletion cmd/ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ func (c *ingestCmd) Command() *cobra.Command {
Use: "ingest",
Short: "Run Ingestion service",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
// SET UP WEBHOOK CHANNEL HERE
if err := cfgOpts.RequireE(); err != nil {
return fmt.Errorf("requiring values of config options: %w", err)
}
Expand Down
1 change: 0 additions & 1 deletion internal/services/ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ func (m *ingestService) ingestPayments(ctx context.Context, ledgerTransactions [
if txMemo != nil {
*txMemo = utils.SanitizeUTF8(*txMemo)
}
txEnvelopeXDR.SourceAccount()
for idx, op := range txEnvelopeXDR.Operations() {
opIdx := idx + 1

Expand Down
6 changes: 3 additions & 3 deletions internal/services/ingest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestGetLedgerTransactions(t *testing.T) {
txns, err := ingestService.GetLedgerTransactions(1)
assert.Equal(t, 1, len(txns))
assert.Equal(t, txns[0].Hash, "hash1")
assert.Empty(t, err)
assert.NoError(t, err)
})

t.Run("ledger_transactions_split_between_multiple_gettransactions_calls", func(t *testing.T) {
Expand Down Expand Up @@ -105,7 +105,7 @@ func TestGetLedgerTransactions(t *testing.T) {
assert.Equal(t, txns[0].Hash, "hash1")
assert.Equal(t, txns[1].Hash, "hash2")
assert.Equal(t, txns[2].Hash, "hash3")
assert.Empty(t, err)
assert.NoError(t, err)
})

}
Expand Down Expand Up @@ -150,7 +150,7 @@ func TestProcessTSSTransactions(t *testing.T) {
Once()

err := ingestService.processTSSTransactions(context.Background(), transactions)
assert.Empty(t, err)
assert.NoError(t, err)

updatedTX, _ := tssStore.GetTransaction(context.Background(), "hash")
assert.Equal(t, string(entities.SuccessStatus), updatedTX.Status)
Expand Down
2 changes: 1 addition & 1 deletion internal/services/rpc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (r *rpcService) GetTransaction(transactionHash string) (entities.RPCGetTran

func (r *rpcService) GetTransactions(startLedger int64, startCursor string, limit int) (entities.RPCGetTransactionsResult, error) {
if limit > PageLimit {
return entities.RPCGetTransactionsResult{}, fmt.Errorf("limit cannot exceed")
return entities.RPCGetTransactionsResult{}, fmt.Errorf("limit cannot exceed %d", PageLimit)
}
params := entities.RPCParams{}
if startCursor != "" {
Expand Down
2 changes: 1 addition & 1 deletion internal/tss/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (r *router) Route(payload tss.Payload) error {
channel = r.ErrorJitterChannel
} else if slices.Contains(tss.NonJitterErrorCodes, payload.RpcSubmitTxResponse.Code.TxResultCode) {
channel = r.ErrorNonJitterChannel
} else if slices.Contains(tss.FinalErrorCodes, payload.RpcSubmitTxResponse.Code.TxResultCode) {
} else if slices.Contains(tss.FinalCodes, payload.RpcSubmitTxResponse.Code.TxResultCode) {
channel = r.WebhookChannel
}
}
Expand Down
4 changes: 2 additions & 2 deletions internal/tss/router/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func TestRouter(t *testing.T) {
}
})
t.Run("status_error_routes_to_webhook_channel", func(t *testing.T) {
for _, code := range tss.FinalErrorCodes {
for _, code := range tss.FinalCodes {
payload := tss.Payload{
RpcSubmitTxResponse: tss.RPCSendTxResponse{
Status: tss.RPCTXStatus{
Expand All @@ -123,7 +123,7 @@ func TestRouter(t *testing.T) {
RpcGetIngestTxResponse: tss.RPCGetIngestTxResponse{
Status: entities.SuccessStatus,
Code: tss.RPCTXCode{
TxResultCode: tss.FinalErrorCodes[0],
TxResultCode: tss.FinalCodes[0],
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/tss/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (c RPCTXCode) Code() int {
return int(c.TxResultCode)
}

var FinalErrorCodes = []xdr.TransactionResultCode{
var FinalCodes = []xdr.TransactionResultCode{
xdr.TransactionResultCodeTxSuccess,
xdr.TransactionResultCodeTxFailed,
xdr.TransactionResultCodeTxMissingOperation,
Expand Down
1 change: 0 additions & 1 deletion internal/utils/ingestion_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ func SourceAccount(op xdr.Operation, txEnvelope xdr.TransactionEnvelope) string
if account != nil {
return account.ToAccountId().Address()
}
txEnvelope.SourceAccount()
return txEnvelope.SourceAccount().ToAccountId().Address()
}

Expand Down

0 comments on commit 0957985

Please sign in to comment.