diff --git a/core/services/ocrcommon/transmitter.go b/core/services/ocrcommon/transmitter.go index cdbc6444776..02a52938d4d 100644 --- a/core/services/ocrcommon/transmitter.go +++ b/core/services/ocrcommon/transmitter.go @@ -226,7 +226,7 @@ type ocr2FeedsDualTransmission struct { } func (t *ocr2FeedsDualTransmission) CreateEthTransaction(ctx context.Context, toAddress common.Address, payload []byte, txMeta *txmgr.TxMeta) error { - //Primary transmission + // Primary transmission err := t.transmitter.CreateEthTransaction(ctx, toAddress, payload, txMeta) if err != nil { return err @@ -239,7 +239,7 @@ func (t *ocr2FeedsDualTransmission) CreateEthTransaction(ctx context.Context, to txMeta.DualBroadcast = true txMeta.DualBroadcastParams = t.urlParams() - //Secondary transmission + // Secondary transmission _, err = t.transmitter.txm.CreateTransaction(ctx, txmgr.TxRequest{ FromAddress: t.secondaryFromAddress, ToAddress: t.secondaryContractAddress, diff --git a/core/services/ocrcommon/transmitter_test.go b/core/services/ocrcommon/transmitter_test.go index 80f053b26d1..b8755d50c5f 100644 --- a/core/services/ocrcommon/transmitter_test.go +++ b/core/services/ocrcommon/transmitter_test.go @@ -217,23 +217,23 @@ func Test_DualTransmitter(t *testing.T) { require.NoError(t, err) primaryTxConfirmed := false - seconryTxConfirmed := false + secondaryTxConfirmed := false txm.On("CreateTransaction", mock.Anything, mock.MatchedBy(func(tx txmgr.TxRequest) bool { - if tx.FromAddress == fromAddress { - //Primary transmission + switch tx.FromAddress { + case fromAddress: + // Primary transmission assert.Equal(t, tx.ToAddress, toAddress, "unexpected primary toAddress") assert.Nil(t, tx.Meta, "Meta should be empty") primaryTxConfirmed = true - } else if tx.FromAddress == secondaryFromAddress { - //Secondary transmission + case secondaryFromAddress: + // Secondary transmission assert.Equal(t, tx.ToAddress, secondaryContractAddress, "unexpected secondary toAddress") assert.True(t, tx.Meta.DualBroadcast, "DualBroadcast should be true") - assert.Equal(t, tx.Meta.DualBroadcastParams, "key1=value1&key2=value2&key2=value3&key3=value4&key3=value5&key3=value6", "DualBroadcastParams not equal") - seconryTxConfirmed = true - - } else { - //Should never be reached + assert.Equal(t, "key1=value1&key2=value2&key2=value3&key3=value4&key3=value5&key3=value6", tx.Meta.DualBroadcastParams, "DualBroadcastParams not equal") + secondaryTxConfirmed = true + default: + // Should never be reached return false } @@ -243,5 +243,5 @@ func Test_DualTransmitter(t *testing.T) { require.NoError(t, transmitter.CreateEthTransaction(testutils.Context(t), toAddress, payload, nil)) require.True(t, primaryTxConfirmed) - require.True(t, seconryTxConfirmed) + require.True(t, secondaryTxConfirmed) }