Make unneeded code a compilation option.

This commit is contained in:
Arthur Britto
2013-01-06 02:15:46 -08:00
parent c728edb1f8
commit 5114790700
3 changed files with 16 additions and 0 deletions

View File

@@ -9,6 +9,8 @@
#include <string> #include <string>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#define ENABLE_INSECURE 0 // 1, to enable unnecessary features.
#define SYSTEM_NAME "ripple" #define SYSTEM_NAME "ripple"
#define SYSTEM_CURRENCY_CODE "XRP" #define SYSTEM_CURRENCY_CODE "XRP"
#define SYSTEM_CURRENCY_PRECISION 6 #define SYSTEM_CURRENCY_PRECISION 6

View File

@@ -304,6 +304,7 @@ Json::Value RPCHandler::doConnect(Json::Value jvRequest)
return "connecting"; return "connecting";
} }
#if ENABLE_INSECURE
// { // {
// key: <string> // key: <string>
// } // }
@@ -327,7 +328,9 @@ Json::Value RPCHandler::doDataDelete(Json::Value jvRequest)
return ret; return ret;
} }
#endif
#if ENABLE_INSECURE
// { // {
// key: <string> // key: <string>
// } // }
@@ -347,7 +350,9 @@ Json::Value RPCHandler::doDataFetch(Json::Value jvRequest)
return ret; return ret;
} }
#endif
#if ENABLE_INSECURE
// { // {
// key: <string> // key: <string>
// value: <string> // value: <string>
@@ -375,6 +380,7 @@ Json::Value RPCHandler::doDataStore(Json::Value jvRequest)
return ret; return ret;
} }
#endif
#if 0 #if 0
// XXX Needs to be revised for new paradigm // XXX Needs to be revised for new paradigm
@@ -1569,6 +1575,7 @@ Json::Value RPCHandler::doWalletSeed(Json::Value jvRequest)
} }
} }
#if ENABLE_INSECURE
// TODO: for now this simply checks if this is the admin account // TODO: for now this simply checks if this is the admin account
// TODO: need to prevent them hammering this over and over // TODO: need to prevent them hammering this over and over
// TODO: maybe a better way is only allow admin from local host // TODO: maybe a better way is only allow admin from local host
@@ -1592,6 +1599,7 @@ Json::Value RPCHandler::doLogin(Json::Value jvRequest)
return "nope"; return "nope";
} }
} }
#endif
// { // {
// min_count: <number> // optional, defaults to 10 // min_count: <number> // optional, defaults to 10
@@ -2456,11 +2464,13 @@ Json::Value RPCHandler::doCommand(Json::Value& jvRequest, int iRole)
{ "wallet_propose", &RPCHandler::doWalletPropose, false, optNone }, { "wallet_propose", &RPCHandler::doWalletPropose, false, optNone },
{ "wallet_seed", &RPCHandler::doWalletSeed, false, optNone }, { "wallet_seed", &RPCHandler::doWalletSeed, false, optNone },
#if ENABLE_INSECURE
// XXX Unnecessary commands which should be removed. // XXX Unnecessary commands which should be removed.
{ "login", &RPCHandler::doLogin, true, optNone }, { "login", &RPCHandler::doLogin, true, optNone },
{ "data_delete", &RPCHandler::doDataDelete, true, optNone }, { "data_delete", &RPCHandler::doDataDelete, true, optNone },
{ "data_fetch", &RPCHandler::doDataFetch, true, optNone }, { "data_fetch", &RPCHandler::doDataFetch, true, optNone },
{ "data_store", &RPCHandler::doDataStore, true, optNone }, { "data_store", &RPCHandler::doDataStore, true, optNone },
#endif
// Evented methods // Evented methods
{ "subscribe", &RPCHandler::doSubscribe, false, optNone }, { "subscribe", &RPCHandler::doSubscribe, false, optNone },

View File

@@ -40,9 +40,11 @@ class RPCHandler
Json::Value doAccountOffers(Json::Value params); Json::Value doAccountOffers(Json::Value params);
Json::Value doAccountTransactions(Json::Value params); Json::Value doAccountTransactions(Json::Value params);
Json::Value doConnect(Json::Value params); Json::Value doConnect(Json::Value params);
#if ENABLE_INSECURE
Json::Value doDataDelete(Json::Value params); Json::Value doDataDelete(Json::Value params);
Json::Value doDataFetch(Json::Value params); Json::Value doDataFetch(Json::Value params);
Json::Value doDataStore(Json::Value params); Json::Value doDataStore(Json::Value params);
#endif
Json::Value doGetCounts(Json::Value params); Json::Value doGetCounts(Json::Value params);
Json::Value doLedger(Json::Value params); Json::Value doLedger(Json::Value params);
Json::Value doLogLevel(Json::Value params); Json::Value doLogLevel(Json::Value params);
@@ -79,7 +81,9 @@ class RPCHandler
Json::Value doWalletUnlock(Json::Value params); Json::Value doWalletUnlock(Json::Value params);
Json::Value doWalletVerify(Json::Value params); Json::Value doWalletVerify(Json::Value params);
#if ENABLE_INSECURE
Json::Value doLogin(Json::Value params); Json::Value doLogin(Json::Value params);
#endif
Json::Value doLedgerAccept(Json::Value params); Json::Value doLedgerAccept(Json::Value params);
Json::Value doLedgerClosed(Json::Value params); Json::Value doLedgerClosed(Json::Value params);