Add a check in _parse_type_from_version (#16)

This commit is contained in:
Arceris
2022-08-18 10:12:19 -06:00
committed by GitHub
parent 8e7d6751e2
commit 50ccfec1b3

View File

@@ -570,6 +570,11 @@ class MinerFactory(metaclass=Singleton):
if version.get("Description") and ("whatsminer" in version.get("Description")): if version.get("Description") and ("whatsminer" in version.get("Description")):
api = "BTMiner" api = "BTMiner"
# If version does not exist in the keys, return None (resulting in Unknown).
# Prevents halting on suspended miners that aren't returning valid information.
if "VERSION" not in version.keys():
return None, None, None
# check for avalonminers # check for avalonminers
if version["VERSION"][0].get("PROD"): if version["VERSION"][0].get("PROD"):
_data = version["VERSION"][0]["PROD"].split("-") _data = version["VERSION"][0]["PROD"].split("-")