From 2b98842f8dcd61b9f052451fc782773d47ce6aa7 Mon Sep 17 00:00:00 2001 From: sowle Date: Mon, 28 Nov 2022 21:17:59 +0100 Subject: [PATCH] stratum: handle_method_eth_submitHashrate now supports parameter of any length (should be helpful for odd miners) --- src/stratum/stratum_server.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/stratum/stratum_server.cpp b/src/stratum/stratum_server.cpp index 8ec41088..f100efef 100644 --- a/src/stratum/stratum_server.cpp +++ b/src/stratum/stratum_server.cpp @@ -951,14 +951,14 @@ namespace bool r = params_array != nullptr && ps.get_next_value(params_array, rate_submit_id_str); CHECK_AND_ASSERT_MES(r, false, "Incorrect parameters"); - struct { uint64_t low, high; } rate_128 = { 0 }; - CHECK_AND_ASSERT_MES(pod_from_net_format_reverse(rate_str, rate_128, true), false, "Can't parse rate from " << rate_str); - CHECK_AND_ASSERT_MES(rate_128.high == 0, false, "rate overflow, rate str: " << rate_str); + struct { uint64_t low, high, higher, highest; } rate_256 = { 0 }; // this will allow any length of data from 64 to 256 bits (helpful for odd miners) + CHECK_AND_ASSERT_MES(pod_from_net_format_reverse(rate_str, rate_256, true), false, "Can't parse rate from " << rate_str); + CHECK_AND_ASSERT_MES(rate_256.high == 0 && rate_256.higher == 0 && rate_256.highest == 0, false, "rate overflow, rate str: " << rate_str); crypto::hash rate_submit_id = null_hash; CHECK_AND_ASSERT_MES(pod_from_net_format(rate_submit_id_str, rate_submit_id), false, "Can't parse rate_submit_id from " << rate_submit_id_str); - m_last_reported_hashrate = rate_128.low; - return m_config.handle_submit_hashrate(this, rate_128.low, rate_submit_id); + m_last_reported_hashrate = rate_256.low; + return m_config.handle_submit_hashrate(this, rate_256.low, rate_submit_id); } bool handle_method_eth_submitWork(const jsonrpc_id_t& id, epee::serialization::portable_storage& ps, epee::serialization::portable_storage::hsection params_section)