Skip to content

Fix VNish get_config for list-based autotune presets response is a list#414

Open
MinersNederland wants to merge 1 commit intoUpstreamData:masterfrom
MinersNederland:fix/vnish-autotune-presets-list
Open

Fix VNish get_config for list-based autotune presets response is a list#414
MinersNederland wants to merge 1 commit intoUpstreamData:masterfrom
MinersNederland:fix/vnish-autotune-presets-list

Conversation

@MinersNederland
Copy link

Summary

This fixes a VNish parsing issue where get_config() assumes autotune_presets() returns a dict and calls .get("presets", []).

Some VNish miners return a list instead, which caused:

  • AttributeError: 'list' object has no attribute 'get'
  • wrapped as APIError: Failed to call config ... while getting data

What changed

  • Updated VNish config handling to support both response shapes:
    • dict response: use response.get("presets", [])
    • list response: use the list directly
    • unexpected type: fallback to empty list

Why

This prevents get_data() from failing on miners that return list-based preset payloads, while preserving existing behavior for dict-based responses.

Validation

  • Reproduced failure on an S19j Pro running VNish v1.2.6 before the change.
  • Re-ran data collection after the fix; config now loads successfully and get_data() completes, reutning a valid pyasic.data.MinerData object containing all expected data

Compatibility

Backward compatible: existing dict-based VNish responses still behave the same.

Human AI Review

This fix was created with Github Copilot and has been human reviewed (albeit by an amateur ;P )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments