From 79c816afd642054bebeba2ba57366c9490afbb1d Mon Sep 17 00:00:00 2001 From: axenteoctavian Date: Mon, 4 Nov 2024 10:31:38 +0200 Subject: [PATCH] fixes after self review --- server/txSender/interface.go | 2 +- server/txSender/txSender_test.go | 8 ++++---- testscommon/txNonceHandlerMock.go | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/txSender/interface.go b/server/txSender/interface.go index f5500fd..5be037e 100644 --- a/server/txSender/interface.go +++ b/server/txSender/interface.go @@ -30,7 +30,7 @@ type DataFormatter interface { // TxNonceSenderHandler should handle nonce management and tx interactions type TxNonceSenderHandler interface { - ApplyNonceAndGasPrice(ctx context.Context, tx ...*transaction.FrontendTransaction) error + ApplyNonceAndGasPrice(ctx context.Context, txs ...*transaction.FrontendTransaction) error SendTransactions(ctx context.Context, txs ...*transaction.FrontendTransaction) ([]string, error) IsInterfaceNil() bool } diff --git a/server/txSender/txSender_test.go b/server/txSender/txSender_test.go index f33f389..0bc240d 100644 --- a/server/txSender/txSender_test.go +++ b/server/txSender/txSender_test.go @@ -127,8 +127,8 @@ func TestTxSender_SendTxs(t *testing.T) { }, } args.TxNonceHandler = &testscommon.TxNonceSenderHandlerMock{ - ApplyNonceAndGasPriceCalled: func(ctx context.Context, tx ...*transaction.FrontendTransaction) error { - require.Len(t, tx, 1) // we update nonce one at a time + ApplyNonceAndGasPriceCalled: func(ctx context.Context, txs ...*transaction.FrontendTransaction) error { + require.Len(t, txs, 1) // we update transactions one at a time require.Equal(t, &transaction.FrontendTransaction{ Nonce: 0, Value: "0", @@ -139,10 +139,10 @@ func TestTxSender_SendTxs(t *testing.T) { Data: expectedTxsData[expectedDataIdx], ChainID: expectedNetworkConfig.ChainID, Version: expectedNetworkConfig.MinTransactionVersion, - }, tx[0]) + }, txs[0]) expectedNonce++ - tx[0].Nonce = uint64(expectedNonce) + txs[0].Nonce = uint64(expectedNonce) return nil }, SendTransactionsCalled: func(ctx context.Context, txs ...*transaction.FrontendTransaction) ([]string, error) { diff --git a/testscommon/txNonceHandlerMock.go b/testscommon/txNonceHandlerMock.go index 91a30f0..33de072 100644 --- a/testscommon/txNonceHandlerMock.go +++ b/testscommon/txNonceHandlerMock.go @@ -13,9 +13,9 @@ type TxNonceSenderHandlerMock struct { } // ApplyNonceAndGasPrice mocks the ApplyNonceAndGasPrice method -func (mock *TxNonceSenderHandlerMock) ApplyNonceAndGasPrice(ctx context.Context, tx ...*transaction.FrontendTransaction) error { +func (mock *TxNonceSenderHandlerMock) ApplyNonceAndGasPrice(ctx context.Context, txs ...*transaction.FrontendTransaction) error { if mock.ApplyNonceAndGasPriceCalled != nil { - return mock.ApplyNonceAndGasPriceCalled(ctx, tx...) + return mock.ApplyNonceAndGasPriceCalled(ctx, txs...) } return nil }