From 74e43cfb57da0638219016e1b15a81f3be68347f Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Thu, 23 Oct 2014 17:12:04 +0200 Subject: [PATCH] jsonrpc library dependency made mandatory --- CMakeLists.txt | 2 -- eth/CMakeLists.txt | 3 --- eth/main.cpp | 20 ++------------------ libethrpc/CMakeLists.txt | 2 -- libethrpc/WebThreeStubServer.cpp | 6 +----- libqethereum/QEthereum.cpp | 2 +- neth/CMakeLists.txt | 3 --- neth/main.cpp | 24 +++--------------------- test/CMakeLists.txt | 3 --- test/jsonrpc.cpp | 2 +- 10 files changed, 8 insertions(+), 59 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86c8c687a..7fddc36c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,9 +117,7 @@ endif() add_subdirectory(lllc) add_subdirectory(sc) -if(JSONRPC_LS) add_subdirectory(libethrpc) -endif() if (NOT LANGUAGES) add_subdirectory(secp256k1) add_subdirectory(libp2p) diff --git a/eth/CMakeLists.txt b/eth/CMakeLists.txt index cc08d1ac9..56f78d347 100644 --- a/eth/CMakeLists.txt +++ b/eth/CMakeLists.txt @@ -19,10 +19,7 @@ if(MINIUPNPC_LS) endif() target_link_libraries(${EXECUTABLE} ${LEVELDB_LS}) target_link_libraries(${EXECUTABLE} ${CRYPTOPP_LS}) -if(JSONRPC_LS) -target_link_libraries(${EXECUTABLE} ${JSONRPC_LS}) target_link_libraries(${EXECUTABLE} ethrpc) -endif() if(READLINE_LS) target_link_libraries(${EXECUTABLE} ${READLINE_LS}) endif() diff --git a/eth/main.cpp b/eth/main.cpp index 21fc7f200..215ac9539 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -27,10 +27,9 @@ #include #include #include -#if ETH_JSONRPC -#include +#include #include -#endif +#include #include #include #include @@ -40,9 +39,6 @@ #include #include #endif -#if ETH_JSONRPC -#include -#endif #include "BuildInfo.h" using namespace std; using namespace dev; @@ -108,10 +104,8 @@ void help() << " -f,--force-mining Mine even when there are no transaction to mine (Default: off)" << endl << " -h,--help Show this help message and exit." << endl << " -i,--interactive Enter interactive mode (default: non-interactive)." << endl -#if ETH_JSONRPC << " -j,--json-rpc Enable JSON-RPC server (default: off)." << endl << " --json-rpc-port Specify JSON-RPC server port (implies '-j', default: 8080)." << endl -#endif << " -l,--listen Listen on the given port for incoming connected (default: 30303)." << endl << " -m,--mining Enable mining, optionally for a specified number of blocks (Default: off)" << endl << " -n,--upnp Use upnp for NAT (default: on)." << endl @@ -185,9 +179,7 @@ int main(int argc, char** argv) NodeMode mode = NodeMode::Full; unsigned peers = 5; bool interactive = false; -#if ETH_JSONRPC int jsonrpc = -1; -#endif string publicIP; bool bootstrap = false; bool upnp = true; @@ -272,12 +264,10 @@ int main(int argc, char** argv) forceMining = true; else if (arg == "-i" || arg == "--interactive") interactive = true; -#if ETH_JSONRPC else if ((arg == "-j" || arg == "--json-rpc")) jsonrpc = jsonrpc == -1 ? 8080 : jsonrpc; else if (arg == "--json-rpc-port" && i + 1 < argc) jsonrpc = atoi(argv[++i]); -#endif else if ((arg == "-v" || arg == "--verbosity") && i + 1 < argc) g_logVerbosity = atoi(argv[++i]); else if ((arg == "-x" || arg == "--peers") && i + 1 < argc) @@ -336,14 +326,12 @@ int main(int argc, char** argv) if (remoteHost.size()) web3.connect(remoteHost, remotePort); -#if ETH_JSONRPC auto_ptr jsonrpcServer; if (jsonrpc > -1) { jsonrpcServer = auto_ptr(new WebThreeStubServer(new jsonrpc::CorsHttpServer(jsonrpc), web3, {us})); jsonrpcServer->StartListening(); } -#endif signal(SIGABRT, &sighandler); signal(SIGTERM, &sighandler); @@ -416,7 +404,6 @@ int main(int argc, char** argv) iss >> g_logVerbosity; cout << "Verbosity: " << g_logVerbosity << endl; } -#if ETH_JSONRPC else if (cmd == "jsonport") { if (iss.peek() != -1) @@ -436,7 +423,6 @@ int main(int argc, char** argv) jsonrpcServer->StopListening(); jsonrpcServer.reset(); } -#endif else if (cmd == "address") { cout << "Current address:" << endl; @@ -769,10 +755,8 @@ int main(int argc, char** argv) else cout << "Unrecognised command. Type 'help' for help in interactive mode." << endl; } -#if ETH_JSONRPC if (jsonrpcServer.get()) jsonrpcServer->StopListening(); -#endif } else if (c) { diff --git a/libethrpc/CMakeLists.txt b/libethrpc/CMakeLists.txt index c2f0cbaae..60c6c6d5e 100644 --- a/libethrpc/CMakeLists.txt +++ b/libethrpc/CMakeLists.txt @@ -23,9 +23,7 @@ if(MINIUPNPC_LS) endif() target_link_libraries(${EXECUTABLE} ${LEVELDB_LS}) target_link_libraries(${EXECUTABLE} ${CRYPTOPP_LS}) -if(JSONRPC_LS) target_link_libraries(${EXECUTABLE} ${JSONRPC_LS}) -endif() if(READLINE_LS) target_link_libraries(${EXECUTABLE} ${READLINE_LS}) endif() diff --git a/libethrpc/WebThreeStubServer.cpp b/libethrpc/WebThreeStubServer.cpp index 69cd5205e..7be77c6d4 100644 --- a/libethrpc/WebThreeStubServer.cpp +++ b/libethrpc/WebThreeStubServer.cpp @@ -21,7 +21,6 @@ * @date 2014 */ -#if ETH_JSONRPC #include "WebThreeStubServer.h" #include #include @@ -173,7 +172,7 @@ Json::Value WebThreeStubServer::accounts() std::string WebThreeStubServer::balanceAt(string const& _address) { - int block = 0; // temporarily + int block = 0; return toJS(client()->balanceAt(jsToAddress(_address), block)); } @@ -264,7 +263,6 @@ bool WebThreeStubServer::changed(int const& _id) std::string WebThreeStubServer::codeAt(string const& _address) { - // temp int block = 0; return client() ? jsFromBinary(client()->codeAt(jsToAddress(_address), block)) : ""; } @@ -372,7 +370,6 @@ bool WebThreeStubServer::setMining(bool const& _mining) std::string WebThreeStubServer::stateAt(string const& _address, string const& _storage) { - // temp int block = 0; return client() ? toJS(client()->stateAt(jsToAddress(_address), jsToU256(_storage), block)) : ""; } @@ -447,4 +444,3 @@ bool WebThreeStubServer::uninstallFilter(int const& _id) return true; } -#endif diff --git a/libqethereum/QEthereum.cpp b/libqethereum/QEthereum.cpp index f22f0ab6e..a43d8ec98 100644 --- a/libqethereum/QEthereum.cpp +++ b/libqethereum/QEthereum.cpp @@ -82,8 +82,8 @@ void QWebThree::clearWatches() void QWebThree::clientDieing() { - clearWatches(); this->disconnect(); + clearWatches(); } static QString formatInput(QJsonObject const& _object) diff --git a/neth/CMakeLists.txt b/neth/CMakeLists.txt index ddd0d9752..12a56f0fc 100644 --- a/neth/CMakeLists.txt +++ b/neth/CMakeLists.txt @@ -20,10 +20,7 @@ target_link_libraries(${EXECUTABLE} ${MINIUPNPC_LS}) endif() target_link_libraries(${EXECUTABLE} ${LEVELDB_LS}) target_link_libraries(${EXECUTABLE} ${CRYPTOPP_LS}) -if(JSONRPC_LS) -target_link_libraries(${EXECUTABLE} ${JSONRPC_LS}) target_link_libraries(${EXECUTABLE} ethrpc) -endif() if ("${TARGET_PLATFORM}" STREQUAL "w64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") diff --git a/neth/main.cpp b/neth/main.cpp index 6d39db847..969282ea0 100644 --- a/neth/main.cpp +++ b/neth/main.cpp @@ -26,17 +26,13 @@ #include #include #include -#if ETH_JSONRPC #include -#endif -#include -#include -#include -#if ETH_JSONRPC #include #include #include -#endif +#include +#include +#include #include #include "BuildInfo.h" @@ -73,10 +69,8 @@ void help() << " -d,--db-path Load database from path (default: ~/.ethereum " << endl << " /Etherum or Library/Application Support/Ethereum)." << endl << " -h,--help Show this help message and exit." << endl -#if ETH_JSONRPC << " -j,--json-rpc Enable JSON-RPC server (default: off)." << endl << " --json-rpc-port Specify JSON-RPC server port (implies '-j', default: 8080)." << endl -#endif << " -l,--listen Listen on the given port for incoming connected (default: 30303)." << endl << " -m,--mining Enable mining (default: off)" << endl << " -n,--upnp Use upnp for NAT (default: on)." << endl @@ -97,10 +91,8 @@ void interactiveHelp() << "Commands:" << endl << " netstart Starts the network sybsystem on a specific port." << endl << " netstop Stops the network subsystem." << endl -#if ETH_JSONRPC << " jsonstart Starts the JSON-RPC server." << endl << " jsonstop Stops the JSON-RPC server." << endl -#endif << " connect Connects to a specific peer." << endl << " minestart Starts mining." << endl << " minestop Stops mining." << endl @@ -304,9 +296,7 @@ int main(int argc, char** argv) string dbPath; bool mining = false; unsigned peers = 5; -#if ETH_JSONRPC int jsonrpc = 8080; -#endif string publicIP; bool upnp = true; string clientName; @@ -377,12 +367,10 @@ int main(int argc, char** argv) cerr << "Unknown mining option: " << m << endl; } } -#if ETH_JSONRPC else if ((arg == "-j" || arg == "--json-rpc")) jsonrpc = jsonrpc ? jsonrpc : 8080; else if (arg == "--json-rpc-port" && i + 1 < argc) jsonrpc = atoi(argv[++i]); -#endif else if ((arg == "-v" || arg == "--verbosity") && i + 1 < argc) g_logVerbosity = atoi(argv[++i]); else if ((arg == "-x" || arg == "--peers") && i + 1 < argc) @@ -474,14 +462,12 @@ int main(int argc, char** argv) if (mining) c.startMining(); -#if ETH_JSONRPC auto_ptr jsonrpcServer; if (jsonrpc > -1) { jsonrpcServer = auto_ptr(new WebThreeStubServer(new jsonrpc::HttpServer(jsonrpc), web3, {us})); jsonrpcServer->StartListening(); } -#endif while (true) { @@ -540,7 +526,6 @@ int main(int argc, char** argv) { c.stopMining(); } -#if ETH_JSONRPC else if (cmd == "jsonport") { if (iss.peek() != -1) @@ -560,7 +545,6 @@ int main(int argc, char** argv) jsonrpcServer->StopListening(); jsonrpcServer.reset(); } -#endif else if (cmd == "address") { ccout << "Current address:" << endl; @@ -1002,10 +986,8 @@ int main(int argc, char** argv) endwin(); refresh(); -#if ETH_JSONRPC if (jsonrpcServer.get()) jsonrpcServer->StopListening(); -#endif return 0; } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2a6ee0c86..3f783516b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -17,10 +17,7 @@ target_link_libraries(testeth secp256k1) target_link_libraries(testeth gmp) target_link_libraries(testeth ${CRYPTOPP_LS}) target_link_libraries(testeth webthree) - -if(JSONRPC_LS) target_link_libraries(testeth ethrpc) -endif() target_link_libraries(createRandomTest ethereum) target_link_libraries(createRandomTest ethcore) diff --git a/test/jsonrpc.cpp b/test/jsonrpc.cpp index 1320846d4..ff2e3a5b4 100644 --- a/test/jsonrpc.cpp +++ b/test/jsonrpc.cpp @@ -19,7 +19,7 @@ * @date 2014 */ -#if ETH_JSONRPC && 1 +#if 1 #include #include