Add compile flag to disable compilation of mining code

This commit is contained in:
Jack Grigg
2016-11-06 13:40:34 -06:00
parent ee6d993561
commit 2cc0a252ad
15 changed files with 107 additions and 14 deletions

View File

@@ -137,7 +137,7 @@ Value getnetworkhashps(const Array& params, bool fHelp)
return GetNetworkHashPS(params.size() > 0 ? params[0].get_int() : 120, params.size() > 1 ? params[1].get_int() : -1);
}
#ifdef ENABLE_WALLET
#if defined(ENABLE_WALLET) && defined(ENABLE_MINING)
Value getgenerate(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
@@ -343,7 +343,7 @@ Value getmininginfo(const Array& params, bool fHelp)
obj.push_back(Pair("pooledtx", (uint64_t)mempool.size()));
obj.push_back(Pair("testnet", Params().TestnetToBeDeprecatedFieldRPC()));
obj.push_back(Pair("chain", Params().NetworkIDString()));
#ifdef ENABLE_WALLET
#if defined(ENABLE_WALLET) && defined(ENABLE_MINING)
obj.push_back(Pair("generate", getgenerate(params, false)));
#endif
return obj;
@@ -466,9 +466,10 @@ Value getblocktemplate(const Array& params, bool fHelp)
LOCK(cs_main);
#ifdef ENABLE_WALLET
// Wallet is required because we support coinbasetxn
if (pwalletMain == NULL) {
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found (disabled)");
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found (wallet disabled)");
}
std::string strMode = "template";
@@ -694,6 +695,10 @@ Value getblocktemplate(const Array& params, bool fHelp)
result.push_back(Pair("height", (int64_t)(pindexPrev->nHeight+1)));
return result;
#else // ENABLE_WALLET
// Wallet is required because we support coinbasetxn
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found (wallet support not built)");
#endif // !ENABLE_WALLET
}
#endif