Skip to content

Commit

Permalink
tss: Populate tss worker pools (#49)
Browse files Browse the repository at this point in the history
* tables and interfaces for TSS

* TSS tables and the channel interface

* remove empty lines

* update

* adding semicolons

adding semicolons

* moving all migrations to one file

* make hash primary key instead of xdr

* missing ,

* remove the index on try_transaction_xdr and add column/index on try_transaction_hash

...also remove outgoing/incoming_status and have one status column

* Squashed commit of the following:

commit fb807aa
Author: gouthamp-stellar <[email protected]>
Date:   Tue Sep 3 10:28:49 2024 -0700

    remove the index on try_transaction_xdr and add column/index on try_transaction_hash

    ...also remove outgoing/incoming_status and have one status column

commit 6fc0dc2
Author: gouthamp-stellar <[email protected]>
Date:   Tue Sep 3 08:58:46 2024 -0700

    missing ,

commit a9cf4e3
Author: gouthamp-stellar <[email protected]>
Date:   Tue Sep 3 01:55:23 2024 -0700

    make hash primary key instead of xdr

commit c0f9d32
Author: gouthamp-stellar <[email protected]>
Date:   Fri Aug 30 15:18:27 2024 -0700

    moving all migrations to one file

commit 2de9898
Author: gouthamp-stellar <[email protected]>
Date:   Fri Aug 30 15:16:53 2024 -0700

    adding semicolons

    adding semicolons

commit 373c71a
Author: gouthamp-stellar <[email protected]>
Date:   Fri Aug 30 15:12:24 2024 -0700

    update

commit 3f9f9f0
Author: gouthamp-stellar <[email protected]>
Date:   Fri Aug 30 15:12:00 2024 -0700

    remove empty lines

commit 9920f48
Author: gouthamp-stellar <[email protected]>
Date:   Fri Aug 30 15:06:40 2024 -0700

    TSS tables and the channel interface

commit a58d519
Author: gouthamp-stellar <[email protected]>
Date:   Fri Aug 30 10:55:22 2024 -0700

    tables and interfaces for TSS

* commit #2

* changing from RpcIngestTxResponse ->  RpcGetIngestTxResponse

* latest changes

* add tests for ValidateOptions

* changes based on comments

* latest changes based on changes to interface

* string -> RPCTXStatus

* adding a transaction_builder.go which takes a list of operation xdrs and builds a transaction out of it

* moving transaction_service to the utils dir

* upper case Channel methods

* latest changes

* p.txService.NetworkPassPhrase()

* last commit before writing unit tests

* Making the transaction service more injectible and adding fields to the Payload

* typo

* typo

* Update 2024-08-28.0-tss_transactions.sql

* lint errors

* go mod tidy

* test cases + other changes

* remoce unused mocks

* error handler service returns errorHandlerService

* changes based on comments

* lint deadcode error - suppress for now

* removed deadcode

* changes after comments on transaction service pr

* TSS Error Handler Service

* removing print statements

* Update transaction_service.go

* responding to comments

* remove commented code

* tx service changes

* remove comment

* remove comment

* latest tx service changes

* adding a router + utils file

* removing println

* changed function name

* commit #1

* Code() helper function on RPCTXCode

* Code()

* Delete .env.swp

* adding a helpers file

* removing BuildTestFeeBumpTransaction

* adding to serve.go etc

* casing

* better test for Send

* resolving merge conflicts

* removing mockSleep

* delete channels/mocks.go

* sleep -> time.Sleep

* incorporating Daniel's changes + comments

* delete files

* remove unused code

* name change

* remove commented code

* moving the mocks file inside servicesmocks dir

* name changes

* refactor

* changes to serve.go

* checking error on route.Route

* check error

* merging main

* fixing parsesendresp tests

* commit changes

* merging in changes from eror_handler_service

* delete file

* commit current changes before merging branch

* rpc ingestor

* delete file

* fix lint errors

* remove dead code

* fix broken test + delete unused code

* tidy mod

* remove commented code

* delete file

* changes based on comments

* removing test case that is not relevant anymore

* changes based on prev pr comments

* remove fmt.Println

* merge latest error_handler_service branch + small changes

* %s -> %w

* U -> u

* variable for channel name

* account for NewStore returning an error

* fix build

* commit #1

* tss pool populator

* typo

* typo

* merge main

* merged latest

* typo in desc string

* millisecond wait time

* changes based on comments

* typo

* changes based on comments

* fixing migrations

* compare types directly on route

* assert

* changes based on comments

* renaming tss_options

* oops
  • Loading branch information
gouthamp-stellar authored Oct 23, 2024
1 parent 3123476 commit dd63a2b
Show file tree
Hide file tree
Showing 21 changed files with 870 additions and 172 deletions.
8 changes: 4 additions & 4 deletions cmd/ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ func (c *ingestCmd) Command() *cobra.Command {
utils.RPCURLOption(&cfg.RPCURL),
utils.StartLedgerOption(&cfg.StartLedger),
utils.EndLedgerOption(&cfg.EndLedger),
utils.WebhookHandlerServiceChannelMaxBufferSizeOption(&cfg.WebhookChannelMaxBufferSize),
utils.WebhookHandlerServiceChannelMaxWorkersOptions(&cfg.WebhookChannelMaxWorkers),
utils.WebhookHandlerServiceChannelMaxRetriesOption(&cfg.WebhookChannelMaxRetries),
utils.WebhookHandlerServiceChannelMinWaitBtwnRetriesMSOption(&cfg.WebhookChannelWaitBtwnTriesMS),
utils.WebhookHandlerChannelMaxBufferSizeOption(&cfg.WebhookChannelMaxBufferSize),
utils.WebhookHandlerChannelMaxWorkersOptions(&cfg.WebhookChannelMaxWorkers),
utils.WebhookHandlerChannelMaxRetriesOption(&cfg.WebhookChannelMaxRetries),
utils.WebhookHandlerChannelMinWaitBtwnRetriesMSOption(&cfg.WebhookChannelWaitBtwnTriesMS),
{
Name: "ledger-cursor-name",
Usage: "Name of last synced ledger cursor, used to keep track of the last ledger ingested by the service. When starting up, ingestion will resume from the ledger number stored in this record. It should be an unique name per container as different containers would overwrite the cursor value of its peers when using the same cursor name.",
Expand Down
28 changes: 14 additions & 14 deletions cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ func (c *serveCmd) Command() *cobra.Command {
utils.BaseFeeOption(&cfg.BaseFee),
utils.HorizonClientURLOption(&cfg.HorizonClientURL),
utils.RPCURLOption(&cfg.RPCURL),
utils.RPCCallerServiceChannelBufferSizeOption(&cfg.RPCCallerServiceChannelBufferSize),
utils.RPCCallerServiceMaxWorkersOption(&cfg.RPCCallerServiceChannelMaxWorkers),
utils.RPCCallerChannelBufferSizeOption(&cfg.RPCCallerServiceChannelBufferSize),
utils.RPCCallerChannelMaxWorkersOption(&cfg.RPCCallerServiceChannelMaxWorkers),
utils.ChannelAccountEncryptionPassphraseOption(&cfg.EncryptionPassphrase),
utils.SentryDSNOption(&sentryDSN),
utils.StellarEnvironmentOption(&stellarEnvironment),
utils.ErrorHandlerServiceJitterChannelBufferSizeOption(&cfg.ErrorHandlerServiceJitterChannelBufferSize),
utils.ErrorHandlerServiceJitterChannelMaxWorkersOption(&cfg.ErrorHandlerServiceJitterChannelMaxWorkers),
utils.ErrorHandlerServiceNonJitterChannelBufferSizeOption(&cfg.ErrorHandlerServiceNonJitterChannelBufferSize),
utils.ErrorHandlerServiceNonJitterChannelMaxWorkersOption(&cfg.ErrorHandlerServiceNonJitterChannelMaxWorkers),
utils.ErrorHandlerServiceJitterChannelMinWaitBtwnRetriesMSOption(&cfg.ErrorHandlerServiceJitterChannelMinWaitBtwnRetriesMS),
utils.ErrorHandlerServiceNonJitterChannelWaitBtwnRetriesMSOption(&cfg.ErrorHandlerServiceNonJitterChannelWaitBtwnRetriesMS),
utils.ErrorHandlerServiceJitterChannelMaxRetriesOptions(&cfg.ErrorHandlerServiceJitterChannelMaxRetries),
utils.ErrorHandlerServiceNonJitterChannelMaxRetriesOption(&cfg.ErrorHandlerServiceNonJitterChannelMaxRetries),
utils.WebhookHandlerServiceChannelMaxBufferSizeOption(&cfg.WebhookHandlerServiceChannelMaxBufferSize),
utils.WebhookHandlerServiceChannelMaxWorkersOptions(&cfg.WebhookHandlerServiceChannelMaxWorkers),
utils.WebhookHandlerServiceChannelMaxRetriesOption(&cfg.WebhookHandlerServiceChannelMaxRetries),
utils.WebhookHandlerServiceChannelMinWaitBtwnRetriesMSOption(&cfg.WebhookHandlerServiceChannelMinWaitBtwnRetriesMS),
utils.ErrorHandlerJitterChannelBufferSizeOption(&cfg.ErrorHandlerServiceJitterChannelBufferSize),
utils.ErrorHandlerJitterChannelMaxWorkersOption(&cfg.ErrorHandlerServiceJitterChannelMaxWorkers),
utils.ErrorHandlerNonJitterChannelBufferSizeOption(&cfg.ErrorHandlerServiceNonJitterChannelBufferSize),
utils.ErrorHandlerNonJitterChannelMaxWorkersOption(&cfg.ErrorHandlerServiceNonJitterChannelMaxWorkers),
utils.ErrorHandlerJitterChannelMinWaitBtwnRetriesMSOption(&cfg.ErrorHandlerServiceJitterChannelMinWaitBtwnRetriesMS),
utils.ErrorHandlerNonJitterChannelWaitBtwnRetriesMSOption(&cfg.ErrorHandlerServiceNonJitterChannelWaitBtwnRetriesMS),
utils.ErrorHandlerJitterChannelMaxRetriesOptions(&cfg.ErrorHandlerServiceJitterChannelMaxRetries),
utils.ErrorHandlerNonJitterChannelMaxRetriesOption(&cfg.ErrorHandlerServiceNonJitterChannelMaxRetries),
utils.WebhookHandlerChannelMaxBufferSizeOption(&cfg.WebhookHandlerServiceChannelMaxBufferSize),
utils.WebhookHandlerChannelMaxWorkersOptions(&cfg.WebhookHandlerServiceChannelMaxWorkers),
utils.WebhookHandlerChannelMaxRetriesOption(&cfg.WebhookHandlerServiceChannelMaxRetries),
utils.WebhookHandlerChannelMinWaitBtwnRetriesMSOption(&cfg.WebhookHandlerServiceChannelMinWaitBtwnRetriesMS),

{
Name: "port",
Expand Down
80 changes: 40 additions & 40 deletions cmd/utils/tss_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,53 @@ import (
"github.com/stellar/go/support/config"
)

func RPCCallerServiceChannelBufferSizeOption(configKey *int) *config.ConfigOption {
func RPCCallerChannelBufferSizeOption(configKey *int) *config.ConfigOption {
return &config.ConfigOption{
Name: "tss-rpc-caller-service-channel-buffer-size",
Usage: "Set the buffer size for TSS RPC Caller Service channel.",
Name: "tss-rpc-caller-channel-buffer-size",
Usage: "Set the buffer size for TSS RPC Caller channel.",
OptType: types.Int,
ConfigKey: configKey,
FlagDefault: 1000,
}
}

func RPCCallerServiceMaxWorkersOption(configKey *int) *config.ConfigOption {
func RPCCallerChannelMaxWorkersOption(configKey *int) *config.ConfigOption {
return &config.ConfigOption{
Name: "tss-rpc-caller-service-channel-max-workers",
Usage: "Set the maximum number of workers for TSS RPC Caller Service channel.",
Name: "tss-rpc-caller-channel-max-workers",
Usage: "Set the maximum number of workers for TSS RPC Caller channel.",
OptType: types.Int,
ConfigKey: configKey,
FlagDefault: 100,
}

}

func ErrorHandlerServiceJitterChannelBufferSizeOption(configKey *int) *config.ConfigOption {
func ErrorHandlerJitterChannelBufferSizeOption(configKey *int) *config.ConfigOption {
return &config.ConfigOption{
Name: "error-handler-service-jitter-channel-buffer-size",
Usage: "Set the buffer size of the Error Handler Service Jitter channel.",
Name: "error-handler-jitter-channel-buffer-size",
Usage: "Set the buffer size of the Error Handler Jitter channel.",
OptType: types.Int,
ConfigKey: configKey,
FlagDefault: 100,
Required: true,
}
}

func ErrorHandlerServiceJitterChannelMaxWorkersOption(configKey *int) *config.ConfigOption {
func ErrorHandlerJitterChannelMaxWorkersOption(configKey *int) *config.ConfigOption {
return &config.ConfigOption{
Name: "error-handler-service-jitter-channel-max-workers",
Usage: "Set the maximum number of workers for the Error Handler Service Jitter channel.",
Name: "error-handler-jitter-channel-max-workers",
Usage: "Set the maximum number of workers for the Error Handler Jitter channel.",
OptType: types.Int,
ConfigKey: configKey,
FlagDefault: 10,
Required: true,
}
}

func ErrorHandlerServiceNonJitterChannelBufferSizeOption(configKey *int) *config.ConfigOption {
func ErrorHandlerNonJitterChannelBufferSizeOption(configKey *int) *config.ConfigOption {
return &config.ConfigOption{
Name: "error-handler-service-non-jitter-channel-buffer-size",
Usage: "Set the buffer size of the Error Handler Service Non Jitter channel.",
Name: "error-handler-non-jitter-channel-buffer-size",
Usage: "Set the buffer size of the Error Handler Non Jitter channel.",
OptType: types.Int,
ConfigKey: configKey,
FlagDefault: 100,
Expand All @@ -61,43 +61,43 @@ func ErrorHandlerServiceNonJitterChannelBufferSizeOption(configKey *int) *config

}

func ErrorHandlerServiceNonJitterChannelMaxWorkersOption(configKey *int) *config.ConfigOption {
func ErrorHandlerNonJitterChannelMaxWorkersOption(configKey *int) *config.ConfigOption {
return &config.ConfigOption{
Name: "error-handler-service-non-jitter-channel-max-workers",
Usage: "Set the maximum number of workers for the Error Handler Service Non Jitter channel.",
Name: "error-handler-non-jitter-channel-max-workers",
Usage: "Set the maximum number of workers for the Error Handler Non Jitter channel.",
OptType: types.Int,
ConfigKey: configKey,
FlagDefault: 10,
Required: true,
}
}

func ErrorHandlerServiceJitterChannelMinWaitBtwnRetriesMSOption(configKey *int) *config.ConfigOption {
func ErrorHandlerJitterChannelMinWaitBtwnRetriesMSOption(configKey *int) *config.ConfigOption {
return &config.ConfigOption{
Name: "error-handler-service-jitter-channel-min-wait-between-retries",
Usage: "Set the minimum amount of time in ms between retries for the Error Handler Service Jitter channel.",
Name: "error-handler-jitter-channel-min-wait-between-retries",
Usage: "Set the minimum amount of time in ms between retries for the Error Handler Jitter channel.",
OptType: types.Int,
ConfigKey: configKey,
FlagDefault: 10,
Required: true,
}
}

func ErrorHandlerServiceNonJitterChannelWaitBtwnRetriesMSOption(configKey *int) *config.ConfigOption {
func ErrorHandlerNonJitterChannelWaitBtwnRetriesMSOption(configKey *int) *config.ConfigOption {
return &config.ConfigOption{
Name: "error-handler-service-non-jitter-channel-wait-between-retries",
Usage: "Set the amount of time in ms between retries for the Error Handler Service Non Jitter channel.",
Name: "error-handler-non-jitter-channel-wait-between-retries",
Usage: "Set the amount of time in ms between retries for the Error Handler Non Jitter channel.",
OptType: types.Int,
ConfigKey: configKey,
FlagDefault: 10,
Required: true,
}
}

func ErrorHandlerServiceJitterChannelMaxRetriesOptions(configKey *int) *config.ConfigOption {
func ErrorHandlerJitterChannelMaxRetriesOptions(configKey *int) *config.ConfigOption {
return &config.ConfigOption{
Name: "error-handler-service-jitter-channel-max-retries",
Usage: "Set the number of retries for each task in the Error Handler Service Jitter channel.",
Name: "error-handler-jitter-channel-max-retries",
Usage: "Set the number of retries for each task in the Error Handler Jitter channel.",
OptType: types.Int,
ConfigKey: configKey,
FlagDefault: 10,
Expand All @@ -106,42 +106,42 @@ func ErrorHandlerServiceJitterChannelMaxRetriesOptions(configKey *int) *config.C

}

func ErrorHandlerServiceNonJitterChannelMaxRetriesOption(configKey *int) *config.ConfigOption {
func ErrorHandlerNonJitterChannelMaxRetriesOption(configKey *int) *config.ConfigOption {
return &config.ConfigOption{
Name: "error-handler-service-non-jitter-channel-max-retries",
Usage: "Set the number of retries for each task in the Error Handler Service Non Jitter channel.",
Name: "error-handler-non-jitter-channel-max-retries",
Usage: "Set the number of retries for each task in the Error Handler Service Jitter channel.",
OptType: types.Int,
ConfigKey: configKey,
FlagDefault: 10,
Required: true,
}
}

func WebhookHandlerServiceChannelMaxBufferSizeOption(configKey *int) *config.ConfigOption {
func WebhookHandlerChannelMaxBufferSizeOption(configKey *int) *config.ConfigOption {
return &config.ConfigOption{
Name: "webhook-service-channel-max-buffer-size",
Usage: "Set the buffer size of the webhook serive channel.",
Name: "webhook-channel-max-buffer-size",
Usage: "Set the buffer size of the webhook channel.",
OptType: types.Int,
ConfigKey: configKey,
FlagDefault: 100,
Required: true,
}
}

func WebhookHandlerServiceChannelMaxWorkersOptions(configKey *int) *config.ConfigOption {
func WebhookHandlerChannelMaxWorkersOptions(configKey *int) *config.ConfigOption {
return &config.ConfigOption{
Name: "webhook-service-channel-max-workers",
Usage: "Set the max number of workers for the webhook serive channel.",
Name: "webhook-channel-max-workers",
Usage: "Set the max number of workers for the webhook channel.",
OptType: types.Int,
ConfigKey: configKey,
FlagDefault: 10,
Required: true,
}
}

func WebhookHandlerServiceChannelMaxRetriesOption(configKey *int) *config.ConfigOption {
func WebhookHandlerChannelMaxRetriesOption(configKey *int) *config.ConfigOption {
return &config.ConfigOption{
Name: "webhook-service-channel-max-retries",
Name: "webhook-channel-max-retries",
Usage: "Set the max number of times to ping a webhook before quitting.",
OptType: types.Int,
ConfigKey: configKey,
Expand All @@ -150,9 +150,9 @@ func WebhookHandlerServiceChannelMaxRetriesOption(configKey *int) *config.Config
}
}

func WebhookHandlerServiceChannelMinWaitBtwnRetriesMSOption(configKey *int) *config.ConfigOption {
func WebhookHandlerChannelMinWaitBtwnRetriesMSOption(configKey *int) *config.ConfigOption {
return &config.ConfigOption{
Name: "webhook-service-channel-min-wait-between-retries",
Name: "webhook-channel-min-wait-between-retries",
Usage: "The minumum amout of time to wait before resending the payload to the webhook url",
OptType: types.Int,
ConfigKey: configKey,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- +migrate Up
ALTER TABLE tss_transaction_submission_tries
RENAME COLUMN status TO code;

ALTER TABLE tss_transaction_submission_tries
ADD column status TEXT NOT NULL,
ADD COLUMN result_xdr TEXT NOT NULL;

-- +migrate Down
ALTER TABLE tss_transaction_submission_tries
DROP COLUMN status,
DROP COLUMN result_xdr;

ALTER TABLE tss_transaction_submission_tries
RENAME COLUMN code TO status;
19 changes: 19 additions & 0 deletions internal/serve/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ type handlerDeps struct {
ErrorNonJitterChannel tss.Channel
WebhookChannel tss.Channel
TSSRouter tssrouter.Router
PoolPopulator tssservices.PoolPopulator
// Error Tracker
AppTracker apptracker.AppTracker
}
Expand All @@ -117,6 +118,7 @@ func Serve(cfg Configs) error {
Handler: handler(deps),
OnStarting: func() {
log.Infof("Starting Wallet Backend server on port %d", cfg.Port)
go populatePools(deps.PoolPopulator)
},
OnStopping: func() {
log.Info("Stopping Wallet Backend server")
Expand Down Expand Up @@ -240,6 +242,7 @@ func initHandlerDeps(cfg Configs) (handlerDeps, error) {
httpClient = http.Client{Timeout: time.Duration(30 * time.Second)}
webhookChannel := tsschannel.NewWebhookChannel(tsschannel.WebhookChannelConfigs{
HTTPClient: &httpClient,
Store: store,
MaxBufferSize: cfg.WebhookHandlerServiceChannelMaxBufferSize,
MaxWorkers: cfg.WebhookHandlerServiceChannelMaxWorkers,
MaxRetries: cfg.WebhookHandlerServiceChannelMaxRetries,
Expand All @@ -257,6 +260,11 @@ func initHandlerDeps(cfg Configs) (handlerDeps, error) {
errorJitterChannel.SetRouter(router)
errorNonJitterChannel.SetRouter(router)

poolPopulator, err := tssservices.NewPoolPopulator(router, store, rpcService)
if err != nil {
return handlerDeps{}, fmt.Errorf("instantiating tss pool populator")
}

return handlerDeps{
Models: models,
SignatureVerifier: signatureVerifier,
Expand All @@ -271,9 +279,20 @@ func initHandlerDeps(cfg Configs) (handlerDeps, error) {
ErrorNonJitterChannel: errorNonJitterChannel,
WebhookChannel: webhookChannel,
TSSRouter: router,
PoolPopulator: poolPopulator,
}, nil
}

func populatePools(poolPopulator tssservices.PoolPopulator) {
alertAfter := time.Minute * 10
ticker := time.NewTicker(alertAfter)
ctx := context.Background()

for range ticker.C {
poolPopulator.PopulatePools(ctx)
}
}

func ensureChannelAccounts(channelAccountService services.ChannelAccountService, numberOfChannelAccounts int64) {
ctx := context.Background()
log.Ctx(ctx).Info("Ensuring the number of channel accounts in the database...")
Expand Down
4 changes: 3 additions & 1 deletion internal/services/ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ func (m *ingestService) ingestPayments(ctx context.Context, ledgerTransactions [
Memo: txMemo,
MemoType: txMemoType,
}

switch op.Body.Type {
case xdr.OperationTypePayment:
fillPayment(&payment, op.Body)
Expand All @@ -177,6 +178,7 @@ func (m *ingestService) ingestPayments(ctx context.Context, ledgerTransactions [
default:
continue
}

err = m.models.Payments.AddPayment(ctx, dbTx, payment)
if err != nil {
return fmt.Errorf("adding payment for ledger %d, tx %s (%d), operation %s (%d): %w", tx.Ledger, tx.Hash, tx.ApplicationOrder, payment.OperationID, opIdx, err)
Expand Down Expand Up @@ -210,7 +212,7 @@ func (m *ingestService) processTSSTransactions(ctx context.Context, ledgerTransa
if err != nil {
return fmt.Errorf("error unmarshaling resultxdr: %w", err)
}
err = m.tssStore.UpsertTry(ctx, tssTry.OrigTxHash, tssTry.Hash, tssTry.XDR, code)
err = m.tssStore.UpsertTry(ctx, tssTry.OrigTxHash, tssTry.Hash, tssTry.XDR, status, code, tx.ResultXDR)
if err != nil {
return fmt.Errorf("error updating try: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/ingest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func TestProcessTSSTransactions(t *testing.T) {
}

_ = tssStore.UpsertTransaction(context.Background(), "localhost:8000/webhook", "hash", "xdr", tss.RPCTXStatus{OtherStatus: tss.NewStatus})
_ = tssStore.UpsertTry(context.Background(), "hash", "feebumphash", "feebumpxdr", tss.RPCTXCode{OtherCodes: tss.NewCode})
_ = tssStore.UpsertTry(context.Background(), "hash", "feebumphash", "feebumpxdr", tss.RPCTXStatus{OtherStatus: tss.NewStatus}, tss.RPCTXCode{OtherCodes: tss.NewCode}, "")

mockRouter.
On("Route", mock.AnythingOfType("tss.Payload")).
Expand All @@ -157,6 +157,7 @@ func TestProcessTSSTransactions(t *testing.T) {
updatedTX, _ := tssStore.GetTransaction(context.Background(), "hash")
assert.Equal(t, string(entities.SuccessStatus), updatedTX.Status)
updatedTry, _ := tssStore.GetTry(context.Background(), "feebumphash")
assert.Equal(t, "AAAAAAAAAMj////9AAAAAA==", updatedTry.ResultXDR)
assert.Equal(t, int32(xdr.TransactionResultCodeTxTooLate), updatedTry.Code)
})
}
Expand All @@ -174,7 +175,6 @@ func TestIngestPayments(t *testing.T) {
mockRouter := tssrouter.MockRouter{}
tssStore, _ := tssstore.NewStore(dbConnectionPool)
ingestService, _ := NewIngestService(models, "ingestionLedger", &mockAppTracker, &mockRPCService, &mockRouter, tssStore)
// test these 3 test cases: OperationTypePayment, OperationTypePathPaymentStrictSend, OperationTypePathPaymentStrictReceive
srcAccount := keypair.MustRandom().Address()
destAccount := keypair.MustRandom().Address()
t.Run("test_op_payment", func(t *testing.T) {
Expand Down
Loading

0 comments on commit dd63a2b

Please sign in to comment.