diff --git a/eth/main.cpp b/eth/main.cpp index 9ec6dec98..761f7a9fd 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -44,6 +44,7 @@ #include #include #endif +#include #include "BuildInfo.h" using namespace std; using namespace dev; @@ -112,6 +113,7 @@ void help() << " -c,--client-name Add a name to your client's version string (default: blank)." << endl << " -d,--db-path Load database from path (default: ~/.ethereum " << endl << " /Etherum or Library/Application Support/Ethereum)." << endl + << " -D,--initdag Initialize DAG for mining and exit." << endl << " -e,--ether-price Set the ether price in the reference unit e.g. ¢ (Default: 30.679)." << endl << " -f,--force-mining Mine even when there are no transaction to mine (Default: off)" << endl << " -h,--help Show this help message and exit." << endl @@ -200,6 +202,7 @@ enum class NodeMode int main(int argc, char** argv) { + bool initDAG = false; string listenIP; unsigned short listenPort = 30303; string publicIP; @@ -304,6 +307,8 @@ int main(int argc, char** argv) structuredLogging = true; else if ((arg == "-d" || arg == "--path" || arg == "--db-path") && i + 1 < argc) dbPath = argv[++i]; + else if (arg == "-D" || arg == "--initdag") + initDAG = true; else if ((arg == "-B" || arg == "--block-fees") && i + 1 < argc) { try @@ -436,6 +441,14 @@ int main(int argc, char** argv) &nodesState, miners ); + + if (initDAG) + { + cout << "Initializing DAG. (This will take awhile)" << endl; + Ethasher::get()->full(web3.ethereum()->blockChain().info()); + return 0; + } + web3.setIdealPeerCount(peers); std::shared_ptr gasPricer = make_shared(u256(double(ether / 1000) / etherPrice), u256(blockFees * 1000)); eth::Client* c = mode == NodeMode::Full ? web3.ethereum() : nullptr; diff --git a/neth/main.cpp b/neth/main.cpp index 7ee4962e9..d295dfb39 100644 --- a/neth/main.cpp +++ b/neth/main.cpp @@ -40,6 +40,7 @@ #include #include #endif +#include #include "BuildInfo.h" #undef KEY_EVENT // from windows.h @@ -76,6 +77,7 @@ void help() << " -c,--client-name Add a name to your client's version string (default: blank)." << endl << " -d,--db-path Load database from path (default: ~/.ethereum " << endl << " /Etherum or Library/Application Support/Ethereum)." << endl + << " -D,--initdag Initialize DAG for mining and exit." << endl << " -e,--ether-price Set the ether price in the reference unit e.g. ¢ (Default: 30.679)." << endl << " -f,--force-mining Mine even when there are no transaction to mine (Default: off)" << endl << " -h,--help Show this help message and exit." << endl @@ -424,6 +426,8 @@ int main(int argc, char** argv) structuredLogging = true; else if ((arg == "-d" || arg == "--path" || arg == "--db-path") && i + 1 < argc) dbPath = argv[++i]; + else if (arg == "-D" || arg == "--initdag") + initDAG = true; else if ((arg == "-B" || arg == "--block-fees") && i + 1 < argc) { try @@ -556,6 +560,14 @@ int main(int argc, char** argv) &nodesState, miners ); + + if (initDAG) + { + cout << "Initialize DAG. (This will take awhile)" << endl; + Ethasher::get()->full(web3.ethereum()->blockChain().info()); + return 0; + } + web3.setIdealPeerCount(peers); std::shared_ptr gasPricer = make_shared(u256(double(ether / 1000) / etherPrice), u256(blockFees * 1000)); eth::Client* c = mode == NodeMode::Full ? web3.ethereum() : nullptr;