diff --git a/config/versions/v3.go b/config/versions/v3.go index 374da12bca3..bd830927083 100644 --- a/config/versions/v3.go +++ b/config/versions/v3.go @@ -16,7 +16,7 @@ func init() { Manager.registerVersion(3, &Version3{}) } -// // Exchanges returns all exchanges: "*" +// Exchanges returns all exchanges: "*" func (v *Version3) Exchanges() []string { return []string{"*"} } // UpgradeExchange will remove the orderbook and publishPeriod from the exchange config @@ -30,7 +30,7 @@ var defaultOrderbookPublishPeriod = time.Second * 10 // DowngradeExchange will downgrade the exchange config with the default orderbook publish period func (v *Version3) DowngradeExchange(_ context.Context, e []byte) ([]byte, error) { if _, _, _, err := jsonparser.Get(e, "orderbook"); err != nil { - return e, nil + return e, nil //nolint:nilerr // No error, just return the original config } out, err := json.Marshal(defaultOrderbookPublishPeriod) if err != nil { diff --git a/config/versions/v3_test.go b/config/versions/v3_test.go index bc47d7a036e..e816effc4b9 100644 --- a/config/versions/v3_test.go +++ b/config/versions/v3_test.go @@ -1,6 +1,7 @@ package versions import ( + "context" "testing" "github.com/stretchr/testify/require" @@ -9,29 +10,29 @@ import ( func TestVersion3UpgradeExchange(t *testing.T) { t.Parallel() - got, err := (&Version3{}).UpgradeExchange(nil, nil) + got, err := (&Version3{}).UpgradeExchange(context.Background(), nil) require.NoError(t, err) require.Nil(t, got) payload := []byte(`{"orderbook": {"verificationBypass": false,"websocketBufferLimit": 5,"websocketBufferEnabled": false,"publishPeriod": 10000000000}}`) expected := []byte(`{"orderbook": {"verificationBypass": false,"websocketBufferLimit": 5,"websocketBufferEnabled": false}}`) - got, err = (&Version3{}).UpgradeExchange(nil, payload) + got, err = (&Version3{}).UpgradeExchange(context.Background(), payload) require.NoError(t, err) - require.Equal(t, got, expected) + require.Equal(t, expected, got) } func TestVersion3DowngradeExchange(t *testing.T) { t.Parallel() - got, err := (&Version3{}).DowngradeExchange(nil, nil) + got, err := (&Version3{}).DowngradeExchange(context.Background(), nil) require.NoError(t, err) require.Nil(t, got) payload := []byte(`{"orderbook": {"verificationBypass": false,"websocketBufferLimit": 5,"websocketBufferEnabled": false}}`) expected := []byte(`{"orderbook": {"verificationBypass": false,"websocketBufferLimit": 5,"websocketBufferEnabled": false,"publishPeriod":10000000000}}`) - got, err = (&Version3{}).DowngradeExchange(nil, payload) + got, err = (&Version3{}).DowngradeExchange(context.Background(), payload) require.NoError(t, err) - require.Equal(t, got, expected) + require.Equal(t, expected, got) } func TestVersion3Exchanges(t *testing.T) {