Browse Source

Use right scoping.

cl-refactor
Gav Wood 10 years ago
parent
commit
d2780c3d6a
  1. 8
      eth/main.cpp
  2. 3
      libethcore/Common.h
  3. 6
      libethcore/Params.cpp
  4. 7
      libjsconsole/JSConsole.cpp
  5. 7
      libjsconsole/JSConsole.h

8
eth/main.cpp

@ -835,12 +835,12 @@ int main(int argc, char** argv)
cout << "Networking disabled. To start, use netstart or pass -b or a remote host." << endl; cout << "Networking disabled. To start, use netstart or pass -b or a remote host." << endl;
#if ETH_JSONRPC || !ETH_TRUE #if ETH_JSONRPC || !ETH_TRUE
shared_ptr<WebThreeStubServer> jsonrpcServer; shared_ptr<dev::WebThreeStubServer> jsonrpcServer;
unique_ptr<jsonrpc::AbstractServerConnector> jsonrpcConnector; unique_ptr<jsonrpc::AbstractServerConnector> jsonrpcConnector;
if (jsonrpc > -1) if (jsonrpc > -1)
{ {
jsonrpcConnector = unique_ptr<jsonrpc::AbstractServerConnector>(new jsonrpc::HttpServer(jsonrpc, "", "", SensibleHttpThreads)); jsonrpcConnector = unique_ptr<jsonrpc::AbstractServerConnector>(new jsonrpc::HttpServer(jsonrpc, "", "", SensibleHttpThreads));
jsonrpcServer = shared_ptr<WebThreeStubServer>(new WebThreeStubServer(*jsonrpcConnector.get(), web3, make_shared<SimpleAccountHolder>([&](){ return web3.ethereum(); }, getAccountPassword, keyManager), vector<KeyPair>(), keyManager, *gasPricer)); jsonrpcServer = shared_ptr<dev::WebThreeStubServer>(new dev::WebThreeStubServer(*jsonrpcConnector.get(), web3, make_shared<SimpleAccountHolder>([&](){ return web3.ethereum(); }, getAccountPassword, keyManager), vector<KeyPair>(), keyManager, *gasPricer));
jsonrpcServer->setMiningBenefactorChanger([&](Address const& a) { beneficiary = a; }); jsonrpcServer->setMiningBenefactorChanger([&](Address const& a) { beneficiary = a; });
jsonrpcServer->StartListening(); jsonrpcServer->StartListening();
if (jsonAdmin.empty()) if (jsonAdmin.empty())
@ -996,7 +996,7 @@ int main(int argc, char** argv)
if (jsonrpc < 0) if (jsonrpc < 0)
jsonrpc = SensibleHttpPort; jsonrpc = SensibleHttpPort;
jsonrpcConnector = unique_ptr<jsonrpc::AbstractServerConnector>(new jsonrpc::HttpServer(jsonrpc, "", "", SensibleHttpThreads)); jsonrpcConnector = unique_ptr<jsonrpc::AbstractServerConnector>(new jsonrpc::HttpServer(jsonrpc, "", "", SensibleHttpThreads));
jsonrpcServer = shared_ptr<WebThreeStubServer>(new WebThreeStubServer(*jsonrpcConnector.get(), web3, make_shared<SimpleAccountHolder>([&](){ return web3.ethereum(); }, getAccountPassword, keyManager), vector<KeyPair>(), keyManager, *gasPricer)); jsonrpcServer = shared_ptr<dev::WebThreeStubServer>(new dev::WebThreeStubServer(*jsonrpcConnector.get(), web3, make_shared<SimpleAccountHolder>([&](){ return web3.ethereum(); }, getAccountPassword, keyManager), vector<KeyPair>(), keyManager, *gasPricer));
jsonrpcServer->setMiningBenefactorChanger([&](Address const& a) { beneficiary = a; }); jsonrpcServer->setMiningBenefactorChanger([&](Address const& a) { beneficiary = a; });
jsonrpcServer->StartListening(); jsonrpcServer->StartListening();
if (jsonAdmin.empty()) if (jsonAdmin.empty())
@ -1744,7 +1744,7 @@ int main(int argc, char** argv)
JSConsole console(web3, make_shared<SimpleAccountHolder>([&](){return web3.ethereum();}, getAccountPassword, keyManager)); JSConsole console(web3, make_shared<SimpleAccountHolder>([&](){return web3.ethereum();}, getAccountPassword, keyManager));
while (!g_exit) while (!g_exit)
{ {
console.repl(); console.readExpression();
stopMiningAfterXBlocks(c, n, mining); stopMiningAfterXBlocks(c, n, mining);
} }
#endif #endif

3
libethcore/Common.h

@ -47,7 +47,8 @@ extern const unsigned c_databaseVersion;
enum class Network enum class Network
{ {
Olympic = 0, Olympic = 0,
Frontier = 1 Frontier = 1,
Turbo = 2
}; };
extern const Network c_network; extern const Network c_network;

6
libethcore/Params.cpp

@ -31,12 +31,12 @@ namespace eth
//--- BEGIN: AUTOGENERATED FROM github.com/ethereum/common/params.json //--- BEGIN: AUTOGENERATED FROM github.com/ethereum/common/params.json
u256 const c_genesisDifficulty = 131072; u256 const c_genesisDifficulty = 131072;
u256 const c_maximumExtraDataSize = 1024; u256 const c_maximumExtraDataSize = 1024;
u256 const c_genesisGasLimit = 3141592; u256 const c_genesisGasLimit = c_network == Network::Turbo ? 100000000 : 3141592;
u256 const c_minGasLimit = 125000; u256 const c_minGasLimit = c_network == Network::Turbo ? 100000000 : 125000;
u256 const c_gasLimitBoundDivisor = 1024; u256 const c_gasLimitBoundDivisor = 1024;
u256 const c_minimumDifficulty = 131072; u256 const c_minimumDifficulty = 131072;
u256 const c_difficultyBoundDivisor = 2048; u256 const c_difficultyBoundDivisor = 2048;
u256 const c_durationLimit = c_network == Network::Olympic ? 8 : 12; u256 const c_durationLimit = c_network == Network::Turbo ? 2 : c_network == Network::Olympic ? 8 : 12;
//--- END: AUTOGENERATED FROM /feeStructure.json //--- END: AUTOGENERATED FROM /feeStructure.json
} }

7
libjsconsole/JSConsole.cpp

@ -39,12 +39,11 @@ JSConsole::JSConsole(WebThreeDirect& _web3, shared_ptr<AccountHolder> const& _ac
m_printer(m_engine) m_printer(m_engine)
{ {
m_jsonrpcConnector.reset(new JSV8Connector(m_engine)); m_jsonrpcConnector.reset(new JSV8Connector(m_engine));
m_jsonrpcServer.reset(new WebThreeStubServer(*m_jsonrpcConnector.get(), _web3, _accounts, vector<KeyPair>())); (void)_web3; (void)_accounts;
// m_jsonrpcServer.reset(new WebThreeStubServer(*m_jsonrpcConnector.get(), _web3, _accounts, vector<KeyPair>()));
} }
JSConsole::~JSConsole() {} void JSConsole::readExpression() const
void JSConsole::repl() const
{ {
string cmd = ""; string cmd = "";
g_logPost = [](std::string const& a, char const*) { cout << "\r \r" << a << endl << flush; rl_forced_update_display(); }; g_logPost = [](std::string const& a, char const*) { cout << "\r \r" << a << endl << flush; rl_forced_update_display(); };

7
libjsconsole/JSConsole.h

@ -25,7 +25,7 @@
#include <libjsengine/JSV8Engine.h> #include <libjsengine/JSV8Engine.h>
#include <libjsengine/JSV8Printer.h> #include <libjsengine/JSV8Printer.h>
class WebThreeStubServer; namespace dev { class WebThreeStubServer; }
namespace jsonrpc { class AbstractServerConnector; } namespace jsonrpc { class AbstractServerConnector; }
namespace dev namespace dev
@ -39,15 +39,14 @@ class JSConsole
{ {
public: public:
JSConsole(WebThreeDirect& _web3, std::shared_ptr<AccountHolder> const& _accounts); JSConsole(WebThreeDirect& _web3, std::shared_ptr<AccountHolder> const& _accounts);
~JSConsole(); void readExpression() const;
void repl() const;
private: private:
std::string promptForIndentionLevel(int _i) const; std::string promptForIndentionLevel(int _i) const;
JSV8Engine m_engine; JSV8Engine m_engine;
JSV8Printer m_printer; JSV8Printer m_printer;
std::unique_ptr<WebThreeStubServer> m_jsonrpcServer; std::unique_ptr<dev::WebThreeStubServer> m_jsonrpcServer;
std::unique_ptr<jsonrpc::AbstractServerConnector> m_jsonrpcConnector; std::unique_ptr<jsonrpc::AbstractServerConnector> m_jsonrpcConnector;
}; };

Loading…
Cancel
Save