bug: fix BTMiner not responding to pause_mining and resume_mining causing an exception.
This commit is contained in:
@@ -196,14 +196,20 @@ class BTMiner(BaseMiner):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
async def stop_mining(self) -> bool:
|
async def stop_mining(self) -> bool:
|
||||||
data = await self.api.power_off(respbefore=True)
|
try:
|
||||||
|
data = await self.api.power_off(respbefore=True)
|
||||||
|
except APIError:
|
||||||
|
return False
|
||||||
if data.get("Msg"):
|
if data.get("Msg"):
|
||||||
if data["Msg"] == "API command OK":
|
if data["Msg"] == "API command OK":
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
async def resume_mining(self) -> bool:
|
async def resume_mining(self) -> bool:
|
||||||
data = await self.api.power_on()
|
try:
|
||||||
|
data = await self.api.power_on()
|
||||||
|
except APIError:
|
||||||
|
return False
|
||||||
if data.get("Msg"):
|
if data.get("Msg"):
|
||||||
if data["Msg"] == "API command OK":
|
if data["Msg"] == "API command OK":
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user