Skip to content

Commit 01f4a63

Browse files
committed
eth_submitWork's hash rate is now a hex string
1 parent d7743b9 commit 01f4a63

8 files changed

+11
-11
lines changed

ethminer/FarmClient.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class FarmClient : public jsonrpc::Client
3434
else
3535
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
3636
}
37-
bool eth_submitHashrate(int param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
37+
bool eth_submitHashrate(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
3838
{
3939
Json::Value p;
4040
p.append(param1);

ethminer/MinerAux.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ class MinerCLI
515515
auto rate = mp.rate();
516516
try
517517
{
518-
rpc.eth_submitHashrate((int)rate, "0x" + id.hex());
518+
rpc.eth_submitHashrate(toHex((u256)rate, HexPrefix::Add), "0x" + id.hex());
519519
}
520520
catch (jsonrpc::JsonRpcException const& _e)
521521
{

ethminer/farm.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{ "name": "eth_getWork", "params": [], "order": [], "returns": []},
33
{ "name": "eth_submitWork", "params": ["", "", ""], "order": [], "returns": true},
4-
{ "name": "eth_submitHashrate", "params": [0, ""], "order": [], "returns": true},
4+
{ "name": "eth_submitHashrate", "params": ["", ""], "order": [], "returns": true},
55
{ "name": "eth_awaitNewWork", "params": [], "order": [], "returns": []},
66
{ "name": "eth_progress", "params": [], "order": [], "returns": true}
77
]

libweb3jsonrpc/WebThreeStubServerBase.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -780,9 +780,9 @@ bool WebThreeStubServerBase::eth_submitWork(string const& _nonce, string const&,
780780
}
781781
}
782782

783-
bool WebThreeStubServerBase::eth_submitHashrate(int _hashes, string const& _id)
783+
bool WebThreeStubServerBase::eth_submitHashrate(std::string const& _hashes, string const& _id)
784784
{
785-
client()->submitExternalHashrate(_hashes, jsToFixed<32>(_id));
785+
client()->submitExternalHashrate(std::stoi(_hashes, nullptr, 0), jsToFixed<32>(_id));
786786
return true;
787787
}
788788

libweb3jsonrpc/WebThreeStubServerBase.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class WebThreeStubServerBase: public AbstractWebThreeStubServer
139139
virtual Json::Value eth_getLogsEx(Json::Value const& _json);
140140
virtual Json::Value eth_getWork();
141141
virtual bool eth_submitWork(std::string const& _nonce, std::string const&, std::string const& _mixHash);
142-
virtual bool eth_submitHashrate(int _hashes, std::string const& _id);
142+
virtual bool eth_submitHashrate(std::string const& _hashes, std::string const& _id);
143143
virtual std::string eth_register(std::string const& _address);
144144
virtual bool eth_unregister(std::string const& _accountId);
145145
virtual Json::Value eth_fetchQueuedTransactions(std::string const& _accountId);

libweb3jsonrpc/abstractwebthreestubserver.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServer<AbstractWebThr
6060
this->bindAndAddMethod(jsonrpc::Procedure("eth_getLogsEx", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::eth_getLogsExI);
6161
this->bindAndAddMethod(jsonrpc::Procedure("eth_getWork", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, NULL), &AbstractWebThreeStubServer::eth_getWorkI);
6262
this->bindAndAddMethod(jsonrpc::Procedure("eth_submitWork", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_submitWorkI);
63-
this->bindAndAddMethod(jsonrpc::Procedure("eth_submitHashrate", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_submitHashrateI);
63+
this->bindAndAddMethod(jsonrpc::Procedure("eth_submitHashrate", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_submitHashrateI);
6464
this->bindAndAddMethod(jsonrpc::Procedure("eth_register", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_registerI);
6565
this->bindAndAddMethod(jsonrpc::Procedure("eth_unregister", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_unregisterI);
6666
this->bindAndAddMethod(jsonrpc::Procedure("eth_fetchQueuedTransactions", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_fetchQueuedTransactionsI);
@@ -315,7 +315,7 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServer<AbstractWebThr
315315
}
316316
inline virtual void eth_submitHashrateI(const Json::Value &request, Json::Value &response)
317317
{
318-
response = this->eth_submitHashrate(request[0u].asInt(), request[1u].asString());
318+
response = this->eth_submitHashrate(request[0u].asString(), request[1u].asString());
319319
}
320320
inline virtual void eth_registerI(const Json::Value &request, Json::Value &response)
321321
{
@@ -534,7 +534,7 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServer<AbstractWebThr
534534
virtual Json::Value eth_getLogsEx(const Json::Value& param1) = 0;
535535
virtual Json::Value eth_getWork() = 0;
536536
virtual bool eth_submitWork(const std::string& param1, const std::string& param2, const std::string& param3) = 0;
537-
virtual bool eth_submitHashrate(int param1, const std::string& param2) = 0;
537+
virtual bool eth_submitHashrate(const std::string& param1, const std::string& param2) = 0;
538538
virtual std::string eth_register(const std::string& param1) = 0;
539539
virtual bool eth_unregister(const std::string& param1) = 0;
540540
virtual Json::Value eth_fetchQueuedTransactions(const std::string& param1) = 0;

libweb3jsonrpc/spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
{ "name": "eth_getLogsEx", "params": [{}], "order": [], "returns": []},
5050
{ "name": "eth_getWork", "params": [], "order": [], "returns": []},
5151
{ "name": "eth_submitWork", "params": ["", "", ""], "order": [], "returns": true},
52-
{ "name": "eth_submitHashrate", "params": [0, ""], "order": [], "returns": true},
52+
{ "name": "eth_submitHashrate", "params": ["", ""], "order": [], "returns": true},
5353
{ "name": "eth_register", "params": [""], "order": [], "returns": ""},
5454
{ "name": "eth_unregister", "params": [""], "order": [], "returns": true},
5555
{ "name": "eth_fetchQueuedTransactions", "params": [""], "order": [], "returns": []},

test/libweb3jsonrpc/webthreestubclient.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ class WebThreeStubClient : public jsonrpc::Client
506506
else
507507
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
508508
}
509-
bool eth_submitHashrate(int param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
509+
bool eth_submitHashrate(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
510510
{
511511
Json::Value p;
512512
p.append(param1);

0 commit comments

Comments
 (0)