Browse Source

eth_submitWork's hash rate is now a hex string

cl-refactor
Lefteris Karapetsas 10 years ago
parent
commit
01f4a63bea
  1. 2
      ethminer/FarmClient.h
  2. 2
      ethminer/MinerAux.h
  3. 2
      ethminer/farm.json
  4. 4
      libweb3jsonrpc/WebThreeStubServerBase.cpp
  5. 2
      libweb3jsonrpc/WebThreeStubServerBase.h
  6. 6
      libweb3jsonrpc/abstractwebthreestubserver.h
  7. 2
      libweb3jsonrpc/spec.json
  8. 2
      test/libweb3jsonrpc/webthreestubclient.h

2
ethminer/FarmClient.h

@ -34,7 +34,7 @@ class FarmClient : public jsonrpc::Client
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
bool eth_submitHashrate(int param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
bool eth_submitHashrate(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);

2
ethminer/MinerAux.h

@ -515,7 +515,7 @@ private:
auto rate = mp.rate();
try
{
rpc.eth_submitHashrate((int)rate, "0x" + id.hex());
rpc.eth_submitHashrate(toHex((u256)rate, HexPrefix::Add), "0x" + id.hex());
}
catch (jsonrpc::JsonRpcException const& _e)
{

2
ethminer/farm.json

@ -1,7 +1,7 @@
[
{ "name": "eth_getWork", "params": [], "order": [], "returns": []},
{ "name": "eth_submitWork", "params": ["", "", ""], "order": [], "returns": true},
{ "name": "eth_submitHashrate", "params": [0, ""], "order": [], "returns": true},
{ "name": "eth_submitHashrate", "params": ["", ""], "order": [], "returns": true},
{ "name": "eth_awaitNewWork", "params": [], "order": [], "returns": []},
{ "name": "eth_progress", "params": [], "order": [], "returns": true}
]

4
libweb3jsonrpc/WebThreeStubServerBase.cpp

@ -780,9 +780,9 @@ bool WebThreeStubServerBase::eth_submitWork(string const& _nonce, string const&,
}
}
bool WebThreeStubServerBase::eth_submitHashrate(int _hashes, string const& _id)
bool WebThreeStubServerBase::eth_submitHashrate(std::string const& _hashes, string const& _id)
{
client()->submitExternalHashrate(_hashes, jsToFixed<32>(_id));
client()->submitExternalHashrate(std::stoi(_hashes, nullptr, 0), jsToFixed<32>(_id));
return true;
}

2
libweb3jsonrpc/WebThreeStubServerBase.h

@ -139,7 +139,7 @@ public:
virtual Json::Value eth_getLogsEx(Json::Value const& _json);
virtual Json::Value eth_getWork();
virtual bool eth_submitWork(std::string const& _nonce, std::string const&, std::string const& _mixHash);
virtual bool eth_submitHashrate(int _hashes, std::string const& _id);
virtual bool eth_submitHashrate(std::string const& _hashes, std::string const& _id);
virtual std::string eth_register(std::string const& _address);
virtual bool eth_unregister(std::string const& _accountId);
virtual Json::Value eth_fetchQueuedTransactions(std::string const& _accountId);

6
libweb3jsonrpc/abstractwebthreestubserver.h

@ -60,7 +60,7 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServer<AbstractWebThr
this->bindAndAddMethod(jsonrpc::Procedure("eth_getLogsEx", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::eth_getLogsExI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_getWork", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, NULL), &AbstractWebThreeStubServer::eth_getWorkI);
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);
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);
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);
this->bindAndAddMethod(jsonrpc::Procedure("eth_register", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_registerI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_unregister", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_unregisterI);
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
}
inline virtual void eth_submitHashrateI(const Json::Value &request, Json::Value &response)
{
response = this->eth_submitHashrate(request[0u].asInt(), request[1u].asString());
response = this->eth_submitHashrate(request[0u].asString(), request[1u].asString());
}
inline virtual void eth_registerI(const Json::Value &request, Json::Value &response)
{
@ -534,7 +534,7 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServer<AbstractWebThr
virtual Json::Value eth_getLogsEx(const Json::Value& param1) = 0;
virtual Json::Value eth_getWork() = 0;
virtual bool eth_submitWork(const std::string& param1, const std::string& param2, const std::string& param3) = 0;
virtual bool eth_submitHashrate(int param1, const std::string& param2) = 0;
virtual bool eth_submitHashrate(const std::string& param1, const std::string& param2) = 0;
virtual std::string eth_register(const std::string& param1) = 0;
virtual bool eth_unregister(const std::string& param1) = 0;
virtual Json::Value eth_fetchQueuedTransactions(const std::string& param1) = 0;

2
libweb3jsonrpc/spec.json

@ -49,7 +49,7 @@
{ "name": "eth_getLogsEx", "params": [{}], "order": [], "returns": []},
{ "name": "eth_getWork", "params": [], "order": [], "returns": []},
{ "name": "eth_submitWork", "params": ["", "", ""], "order": [], "returns": true},
{ "name": "eth_submitHashrate", "params": [0, ""], "order": [], "returns": true},
{ "name": "eth_submitHashrate", "params": ["", ""], "order": [], "returns": true},
{ "name": "eth_register", "params": [""], "order": [], "returns": ""},
{ "name": "eth_unregister", "params": [""], "order": [], "returns": true},
{ "name": "eth_fetchQueuedTransactions", "params": [""], "order": [], "returns": []},

2
test/libweb3jsonrpc/webthreestubclient.h

@ -506,7 +506,7 @@ class WebThreeStubClient : public jsonrpc::Client
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
bool eth_submitHashrate(int param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
bool eth_submitHashrate(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);

Loading…
Cancel
Save