1
0
Fork 0
forked from lthn/blockchain

stratum: handle_method_eth_submitHashrate now supports parameter of any length (should be helpful for odd miners)

This commit is contained in:
sowle 2022-11-28 21:17:59 +01:00
parent e1acf907db
commit 2b98842f8d
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC

View file

@ -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)