From d487fc7655c4cb3b62fbaa75d5a9255af14fbd6a Mon Sep 17 00:00:00 2001 From: Kyoto Date: Sun, 25 May 2025 11:34:48 +0200 Subject: [PATCH] fix: monero rewards amount rounded --- qubipy/core/core_client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qubipy/core/core_client.py b/qubipy/core/core_client.py index bec2d72..8cdbeee 100644 --- a/qubipy/core/core_client.py +++ b/qubipy/core/core_client.py @@ -563,10 +563,12 @@ def get_monero_mining_stats(self) -> Dict[str, Any]: response cannot be parsed as valid JSON). """ try: + REWARD_PER_MONERO_BLOCK = 0.6 response = requests.get(f'{MONERO_URL}{MONERO_MINING_STATS}', headers=HEADERS, timeout=self.timeout) response.raise_for_status() # Raise an exception for bad HTTP status codes data = response.json() - data['monero_amount_rewards'] = data['pool_blocks_found'] * 0.6 + raw_rewards = data.get('pool_blocks_found', 0) * REWARD_PER_MONERO_BLOCK + data['monero_amount_rewards'] = round(raw_rewards, 8) return data except requests.RequestException as E: raise QubiPy_Exceptions(f"Error when getting the monero mining stats: {str(E)}") from None