Skip to content

Commit

Permalink
fixes after self review
Browse files Browse the repository at this point in the history
  • Loading branch information
axenteoctavian committed Nov 4, 2024
1 parent 3392ef8 commit 79c816a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion server/txSender/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
8 changes: 4 additions & 4 deletions server/txSender/txSender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions testscommon/txNonceHandlerMock.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 79c816a

Please sign in to comment.