Skip to content

Commit

Permalink
fix hammer test, enforce default hr unit
Browse files Browse the repository at this point in the history
  • Loading branch information
jpcomps authored and b-rowan committed Jan 2, 2025
1 parent 9ee52f7 commit 5236e02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pyasic/miners/backends/hammer.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ async def _get_hashboards(self, rpc_stats: dict = None) -> List[HashBoard]:
hashrate = boards[1].get(f"chain_rate{i}")
if hashrate:
hashboard.hashrate = self.algo.hashrate(
rate=float(hashrate), unit=self.algo.unit.GH
rate=float(hashrate), unit=self.algo.unit.MH
).into(self.algo.unit.default)

chips = boards[1].get(f"chain_acn{i}")
Expand Down Expand Up @@ -358,7 +358,7 @@ async def _get_expected_hashrate(
try:
expected_rate = rpc_stats["STATS"][1].get("total_rateideal")
if expected_rate is None:
return self.sticker_hashrate
return self.sticker_hashrate.into(self.algo.unit.default)
try:
rate_unit = rpc_stats["STATS"][1]["rate_unit"]
except KeyError:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from pyasic import APIError, MinerData
from pyasic.data import Fan, HashBoard
from pyasic.device.algorithm.hashrate.unit.scrypt import ScryptUnit
from pyasic.miners.hammer import HammerD10

POOLS = [
Expand Down Expand Up @@ -398,6 +399,6 @@ async def test_all_data_gathering(self, mock_send_bytes):
self.assertEqual(result.api_ver, "3.1")
self.assertEqual(result.fw_ver, "2023-05-28 17-20-35 CST")
self.assertEqual(result.hostname, "Hammer")
self.assertEqual(round(result.hashrate), 4686)
self.assertEqual(round(result.hashrate.into(ScryptUnit.MH)), 4686)
self.assertEqual(result.fans, [Fan(speed=4650), Fan(speed=4500)])
self.assertEqual(result.total_chips, result.expected_chips)

0 comments on commit 5236e02

Please sign in to comment.