Browse Source

listening and mining param names

cl-refactor
Marek Kotewicz 11 years ago
parent
commit
8ccc59343c
  1. 6
      libethrpc/EthStubServer.cpp
  2. 4
      libethrpc/EthStubServer.h
  3. 12
      libethrpc/abstractethstubserver.h
  4. 4
      libethrpc/spec.json
  5. 8
      test/ethstubclient.h

6
libethrpc/EthStubServer.cpp

@ -319,7 +319,7 @@ bool EthStubServer::setCoinbase(const std::string &address)
return true;
}
bool EthStubServer::setListening(const bool &l)
bool EthStubServer::setListening(const bool &listening)
{
if (!client())
return Json::nullValue;
@ -331,12 +331,12 @@ bool EthStubServer::setListening(const bool &l)
return false;
}
bool EthStubServer::setMining(const bool &l)
bool EthStubServer::setMining(const bool &mining)
{
if (!client())
return Json::nullValue;
if (l)
if (mining)
client()->startMining();
else
client()->stopMining();

4
libethrpc/EthStubServer.h

@ -56,8 +56,8 @@ public:
virtual int peerCount();
virtual std::string secretToAddress(const std::string& s);
virtual bool setCoinbase(const std::string& address);
virtual bool setListening(const bool& l);
virtual bool setMining(const bool& l);
virtual bool setListening(const bool& listening);
virtual bool setMining(const bool& mining);
virtual std::string sha3(const std::string& s);
virtual std::string stateAt(const std::string& a, const int& block, const std::string& s);
virtual std::string toAscii(const std::string& s);

12
libethrpc/abstractethstubserver.h

@ -33,8 +33,8 @@ class AbstractEthStubServer : public jsonrpc::AbstractServer<AbstractEthStubServ
this->bindAndAddMethod(new jsonrpc::Procedure("peerCount", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_INTEGER, NULL), &AbstractEthStubServer::peerCountI);
this->bindAndAddMethod(new jsonrpc::Procedure("secretToAddress", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_STRING, "s",jsonrpc::JSON_STRING, NULL), &AbstractEthStubServer::secretToAddressI);
this->bindAndAddMethod(new jsonrpc::Procedure("setCoinbase", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_BOOLEAN, "address",jsonrpc::JSON_STRING, NULL), &AbstractEthStubServer::setCoinbaseI);
this->bindAndAddMethod(new jsonrpc::Procedure("setListening", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_BOOLEAN, "l",jsonrpc::JSON_BOOLEAN, NULL), &AbstractEthStubServer::setListeningI);
this->bindAndAddMethod(new jsonrpc::Procedure("setMining", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_BOOLEAN, "l",jsonrpc::JSON_BOOLEAN, NULL), &AbstractEthStubServer::setMiningI);
this->bindAndAddMethod(new jsonrpc::Procedure("setListening", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_BOOLEAN, "listening",jsonrpc::JSON_BOOLEAN, NULL), &AbstractEthStubServer::setListeningI);
this->bindAndAddMethod(new jsonrpc::Procedure("setMining", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_BOOLEAN, "mining",jsonrpc::JSON_BOOLEAN, NULL), &AbstractEthStubServer::setMiningI);
this->bindAndAddMethod(new jsonrpc::Procedure("sha3", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_STRING, "s",jsonrpc::JSON_STRING, NULL), &AbstractEthStubServer::sha3I);
this->bindAndAddMethod(new jsonrpc::Procedure("stateAt", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_STRING, "a",jsonrpc::JSON_STRING,"block",jsonrpc::JSON_INTEGER,"s",jsonrpc::JSON_STRING, NULL), &AbstractEthStubServer::stateAtI);
this->bindAndAddMethod(new jsonrpc::Procedure("toAscii", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_STRING, "s",jsonrpc::JSON_STRING, NULL), &AbstractEthStubServer::toAsciiI);
@ -149,12 +149,12 @@ class AbstractEthStubServer : public jsonrpc::AbstractServer<AbstractEthStubServ
inline virtual void setListeningI(const Json::Value& request, Json::Value& response)
{
response = this->setListening(request["l"].asBool());
response = this->setListening(request["listening"].asBool());
}
inline virtual void setMiningI(const Json::Value& request, Json::Value& response)
{
response = this->setMining(request["l"].asBool());
response = this->setMining(request["mining"].asBool());
}
inline virtual void sha3I(const Json::Value& request, Json::Value& response)
@ -223,8 +223,8 @@ class AbstractEthStubServer : public jsonrpc::AbstractServer<AbstractEthStubServ
virtual int peerCount() = 0;
virtual std::string secretToAddress(const std::string& s) = 0;
virtual bool setCoinbase(const std::string& address) = 0;
virtual bool setListening(const bool& l) = 0;
virtual bool setMining(const bool& l) = 0;
virtual bool setListening(const bool& listening) = 0;
virtual bool setMining(const bool& mining) = 0;
virtual std::string sha3(const std::string& s) = 0;
virtual std::string stateAt(const std::string& a, const int& block, const std::string& s) = 0;
virtual std::string toAscii(const std::string& s) = 0;

4
libethrpc/spec.json

@ -2,9 +2,9 @@
{ "method": "coinbase", "params": null, "order": [], "returns" : "" },
{ "method": "setCoinbase", "params": { "address": "" }, "order": ["address"], "returns" : true },
{ "method": "listening", "params": null, "order": [], "returns" : false },
{ "method": "setListening", "params": { "l": false }, "order" : ["l"], "returns" : true },
{ "method": "setListening", "params": { "listening": false }, "order" : ["listening"], "returns" : true },
{ "method": "mining", "params": null, "order": [], "returns" : false },
{ "method": "setMining", "params": { "l": false }, "order" : ["l"], "returns" : true },
{ "method": "setMining", "params": { "mining": false }, "order" : ["mining"], "returns" : true },
{ "method": "gasPrice", "params": null, "order": [], "returns" : "" },
{ "method": "key", "params": null, "order": [], "returns" : "" },
{ "method": "keys", "params": null, "order": [], "returns" : [] },

8
test/ethstubclient.h

@ -274,10 +274,10 @@ p["s"] = s;
}
bool setListening(const bool& l) throw (jsonrpc::JsonRpcException)
bool setListening(const bool& listening) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["l"] = l;
p["listening"] = listening;
Json::Value result = this->client->CallMethod("setListening",p);
if (result.isBool())
@ -287,10 +287,10 @@ p["s"] = s;
}
bool setMining(const bool& l) throw (jsonrpc::JsonRpcException)
bool setMining(const bool& mining) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["l"] = l;
p["mining"] = mining;
Json::Value result = this->client->CallMethod("setMining",p);
if (result.isBool())

Loading…
Cancel
Save