From 975226830816443bfab7ff93f7e076d01cfd0e8a Mon Sep 17 00:00:00 2001 From: Edward Hennis Date: Wed, 18 May 2016 14:26:40 -0400 Subject: [PATCH] Standalone mode uses temp DB files by default (RIPD-1129): * If a [database_path] is configured, it will always be used, and tables will be upgraded on startup. --- src/ripple/app/ledger/OrderBookDB.cpp | 2 +- .../app/ledger/impl/LedgerConsensusImp.cpp | 2 +- src/ripple/app/ledger/impl/LedgerMaster.cpp | 4 +- src/ripple/app/main/Application.cpp | 23 ++-- src/ripple/app/main/Main.cpp | 18 +--- src/ripple/app/misc/SHAMapStoreImp.cpp | 2 +- src/ripple/app/misc/impl/TxQ.cpp | 2 +- src/ripple/core/Config.h | 37 ++++--- src/ripple/core/impl/Config.cpp | 35 ++++-- src/ripple/core/impl/DatabaseCon.cpp | 2 +- src/ripple/core/tests/Config.test.cpp | 101 +++++++++++++++++- src/ripple/net/impl/RPCCall.cpp | 2 +- src/ripple/overlay/impl/OverlayImpl.cpp | 4 +- src/ripple/rpc/handlers/Connect.cpp | 2 +- src/ripple/rpc/handlers/LedgerAccept.cpp | 2 +- src/ripple/rpc/handlers/RipplePathFind.cpp | 2 +- src/ripple/rpc/impl/LookupLedger.cpp | 4 +- src/ripple/rpc/impl/RPCHandler.cpp | 2 +- src/ripple/rpc/impl/TransactionSign.cpp | 2 +- src/ripple/server/impl/ServerHandlerImp.cpp | 2 +- src/ripple/test/jtx/impl/Env.cpp | 4 +- 21 files changed, 183 insertions(+), 71 deletions(-) diff --git a/src/ripple/app/ledger/OrderBookDB.cpp b/src/ripple/app/ledger/OrderBookDB.cpp index 1d14118492..fe01ed84fb 100644 --- a/src/ripple/app/ledger/OrderBookDB.cpp +++ b/src/ripple/app/ledger/OrderBookDB.cpp @@ -70,7 +70,7 @@ void OrderBookDB::setup( { // nothing to do } - else if (app_.config().RUN_STANDALONE) + else if (app_.config().standalone()) update(ledger); else app_.getJobQueue().addJob( diff --git a/src/ripple/app/ledger/impl/LedgerConsensusImp.cpp b/src/ripple/app/ledger/impl/LedgerConsensusImp.cpp index 51982f1ab2..3a331f2f12 100644 --- a/src/ripple/app/ledger/impl/LedgerConsensusImp.cpp +++ b/src/ripple/app/ledger/impl/LedgerConsensusImp.cpp @@ -1433,7 +1433,7 @@ void LedgerConsensusImp::takeInitialPosition ( SHAMapItem (tx.first->getTransactionID(), std::move (s)), true, false); } - if ((app_.config().RUN_STANDALONE || (mProposing && mHaveCorrectLCL)) + if ((app_.config().standalone() || (mProposing && mHaveCorrectLCL)) && ((mPreviousLedger->info().seq % 256) == 0)) { // previous ledger was flag ledger, add pseudo-transactions diff --git a/src/ripple/app/ledger/impl/LedgerMaster.cpp b/src/ripple/app/ledger/impl/LedgerMaster.cpp index 500eefa6b9..e7eb812ba5 100644 --- a/src/ripple/app/ledger/impl/LedgerMaster.cpp +++ b/src/ripple/app/ledger/impl/LedgerMaster.cpp @@ -86,7 +86,7 @@ LedgerMaster::LedgerMaster (Application& app, Stopwatch& stopwatch, , mValidLedgerSign (0) , mValidLedgerSeq (0) , mBuildingLedgerSeq (0) - , standalone_ (app_.config().RUN_STANDALONE) + , standalone_ (app_.config().standalone()) , fetch_depth_ (app_.getSHAMapStore ().clampFetchDepth ( app_.config().FETCH_DEPTH)) , ledger_history_ (app_.config().LEDGER_HISTORY) @@ -209,7 +209,7 @@ LedgerMaster::setValidLedger( { std::vector times; - if (! app_.config().RUN_STANDALONE) + if (! standalone_) { times = app_.getValidations().getValidationTimes( l->info().hash); diff --git a/src/ripple/app/main/Application.cpp b/src/ripple/app/main/Application.cpp index 134e653bbf..068cf3ea43 100644 --- a/src/ripple/app/main/Application.cpp +++ b/src/ripple/app/main/Application.cpp @@ -466,7 +466,7 @@ public: logs_->journal("TaggedCache")) , m_networkOPs (make_NetworkOPs (*this, stopwatch(), - config_->RUN_STANDALONE, config_->NETWORK_QUORUM, config_->START_VALID, + config_->standalone(), config_->NETWORK_QUORUM, config_->START_VALID, *m_jobQueue, *m_ledgerMaster, *m_jobQueue, logs_->journal("NetworkOPs"))) @@ -882,7 +882,7 @@ public: { // VFALCO TODO Move all this into doSweep - if (! config_->RUN_STANDALONE) + if (! config_->standalone()) { boost::filesystem::space_info space = boost::filesystem::space (config_->legacy ("database_path")); @@ -951,7 +951,7 @@ private: void ApplicationImp::setup() { // VFALCO NOTE: 0 means use heuristics to determine the thread count. - m_jobQueue->setThreadCount (0, config_->RUN_STANDALONE); + m_jobQueue->setThreadCount (0, config_->standalone()); // We want to intercept and wait for CTRL-C to terminate the process m_signals.add (SIGINT); @@ -976,9 +976,9 @@ void ApplicationImp::setup() logs_->threshold (kDebug); } - logs_->silent (config_->SILENT); + logs_->silent (config_->silent()); - if (!config_->RUN_STANDALONE) + if (!config_->standalone()) timeKeeper_->run(config_->SNTP_SERVERS); if (!initSqliteDbs ()) @@ -998,8 +998,7 @@ void ApplicationImp::setup() mTxnDB->setupCheckpointing (m_jobQueue.get(), logs()); mLedgerDB->setupCheckpointing (m_jobQueue.get(), logs()); - if (!config_->RUN_STANDALONE) - updateTables (); + updateTables (); // Configure the amendments the server supports { @@ -1049,7 +1048,7 @@ void ApplicationImp::setup() else if (startUp == Config::NETWORK) { // This should probably become the default once we have a stable network. - if (!config_->RUN_STANDALONE) + if (!config_->standalone()) m_networkOPs->needNetworkLedger (); startGenesisLedger (); @@ -1075,7 +1074,7 @@ void ApplicationImp::setup() Throw(); } - if (validators_->size () == 0 && !config_->RUN_STANDALONE) + if (validators_->size () == 0 && !config_->standalone()) { JLOG(m_journal.warn()) << "No validators are configured."; } @@ -1095,7 +1094,7 @@ void ApplicationImp::setup() // foolishly calls overlay(). When this is fixed we can // move the instantiation inside a conditional: // - // if (!config_.RUN_STANDALONE) + // if (!config_.standalone()) m_overlay = make_Overlay (*this, setup_Overlay(*config_), *m_jobQueue, *serverHandler_, *m_resourceManager, *m_resolver, get_io_service(), *config_); @@ -1135,7 +1134,7 @@ void ApplicationImp::setup() //---------------------------------------------------------------------- // Begin connecting to network. - if (!config_->RUN_STANDALONE) + if (!config_->standalone()) { // Should this message be here, conceptually? In theory this sort // of message, if displayed, should be displayed from PeerFinder. @@ -1167,7 +1166,7 @@ ApplicationImp::doStart() void ApplicationImp::run() { - if (!config_->RUN_STANDALONE) + if (!config_->standalone()) { // VFALCO NOTE This seems unnecessary. If we properly refactor the load // manager then the deadlock detector can just always be "armed" diff --git a/src/ripple/app/main/Main.cpp b/src/ripple/app/main/Main.cpp index 362d19f540..b2e80117bf 100644 --- a/src/ripple/app/main/Main.cpp +++ b/src/ripple/app/main/Main.cpp @@ -122,7 +122,7 @@ void startServer (Application& app) { Json::Value const& jvCommand = app.config().RPC_STARTUP[i]; - if (!app.config().QUIET) + if (!app.config().quiet()) std::cerr << "Startup RPC: " << jvCommand << std::endl; Resource::Charge loadType = Resource::feeReferenceRPC; @@ -133,7 +133,7 @@ void startServer (Application& app) Json::Value jvResult; RPC::doCommand (context, jvResult); - if (!app.config().QUIET) + if (!app.config().quiet()) std::cerr << "Result: " << jvResult << std::endl; } } @@ -318,16 +318,8 @@ int run (int argc, char** argv) vm["conf"].as () : std::string(); // config file, quiet flag. - config->setup (configFile, bool (vm.count ("quiet"))); - - if (vm.count ("silent")) - config->SILENT = true; - - if (vm.count ("standalone")) - { - config->RUN_STANDALONE = true; - config->LEDGER_HISTORY = 0; - } + config->setup (configFile, bool (vm.count ("quiet")), + bool(vm.count("silent")), bool(vm.count("standalone"))); { // Stir any previously saved entropy into the pool: @@ -456,7 +448,7 @@ int run (int argc, char** argv) if (!adjustDescriptorLimit(1024, logs->journal("Application"))) return -1; - if (HaveSustain() && !vm.count ("fg") && !config->RUN_STANDALONE) + if (HaveSustain() && !vm.count ("fg") && !config->standalone()) { auto const ret = DoSustain (); diff --git a/src/ripple/app/misc/SHAMapStoreImp.cpp b/src/ripple/app/misc/SHAMapStoreImp.cpp index 9e2381f191..64c1e43736 100644 --- a/src/ripple/app/misc/SHAMapStoreImp.cpp +++ b/src/ripple/app/misc/SHAMapStoreImp.cpp @@ -804,7 +804,7 @@ setup_SHAMapStore (Config const& c) { SHAMapStore::Setup setup; - setup.standalone = c.RUN_STANDALONE; + setup.standalone = c.standalone(); // Get existing settings and add some default values if not specified: setup.nodeDatabase = c.section (ConfigSection::nodeDatabase ()); diff --git a/src/ripple/app/misc/impl/TxQ.cpp b/src/ripple/app/misc/impl/TxQ.cpp index 74240ac42e..27651248dd 100644 --- a/src/ripple/app/misc/impl/TxQ.cpp +++ b/src/ripple/app/misc/impl/TxQ.cpp @@ -1214,7 +1214,7 @@ setup_TxQ(Config const& config) set(setup.zeroBaseFeeTransactionFeeLevel, "zero_basefee_transaction_feelevel", section); - setup.standAlone = config.RUN_STANDALONE; + setup.standAlone = config.standalone(); return setup; } diff --git a/src/ripple/core/Config.h b/src/ripple/core/Config.h index 8703dbc0cf..5b61f827de 100644 --- a/src/ripple/core/Config.h +++ b/src/ripple/core/Config.h @@ -98,10 +98,21 @@ private: void load (); beast::Journal j_; -public: - bool doImport = false; bool QUIET = false; // Minimize logging verbosity. bool SILENT = false; // No output to console after startup. + /** Operate in stand-alone mode. + + In stand alone mode: + + - Peer connections are not attempted or accepted + - The ledger is not advanced automatically. + - If no ledger is loaded, the default ledger with the root + account is created. + */ + bool RUN_STANDALONE = false; + +public: + bool doImport = false; bool ELB_SUPPORT = false; std::vector IPS; // Peer IPs from rippled.cfg. @@ -126,17 +137,6 @@ public: // Network parameters int const TRANSACTION_FEE_BASE = 10; // The number of fee units a reference transaction costs - /** Operate in stand-alone mode. - - In stand alone mode: - - - Peer connections are not attempted or accepted - - The ledger is not advanced automatically. - - If no ledger is loaded, the default ledger with the root - account is created. - */ - bool RUN_STANDALONE = false; - // Note: The following parameters do not relate to the UNL or trust at all std::size_t NETWORK_QUORUM = 0; // Minimum number of nodes to consider the network present int VALIDATION_QUORUM = 1; // Minimum validations to consider ledger authoritative @@ -188,7 +188,12 @@ public: Config() = default; int getSize (SizedItemName) const; - void setup (std::string const& strConf, bool bQuiet); + /* Be very careful to make sure these bool params + are in the right order. */ + void setup (std::string const& strConf, bool bQuiet, + bool bSilent, bool bStandalone); + void setupControl (bool bQuiet, + bool bSilent, bool bStandalone); /** * Load the conig from the contents of the sting. @@ -196,6 +201,10 @@ public: * @param fileContents String representing the config contents. */ void loadFromString (std::string const& fileContents); + + bool quiet() const { return QUIET; } + bool silent() const { return SILENT; } + bool standalone() const { return RUN_STANDALONE; } }; } // ripple diff --git a/src/ripple/core/impl/Config.cpp b/src/ripple/core/impl/Config.cpp index ac758d6cbc..4d2ebf3a4c 100644 --- a/src/ripple/core/impl/Config.cpp +++ b/src/ripple/core/impl/Config.cpp @@ -150,10 +150,18 @@ getEnvVar (char const* name) return value; } -void Config::setup (std::string const& strConf, bool bQuiet) +void Config::setupControl(bool bQuiet, + bool bSilent, bool bStandalone) +{ + QUIET = bQuiet || bSilent; + SILENT = bSilent; + RUN_STANDALONE = bStandalone; +} + +void Config::setup (std::string const& strConf, bool bQuiet, + bool bSilent, bool bStandalone) { boost::filesystem::path dataDir; - boost::system::error_code ec; std::string strDbPath, strConfFile; // Determine the config and data directories. @@ -162,7 +170,7 @@ void Config::setup (std::string const& strConf, bool bQuiet) // config directory and that with "db" as the data // directory. - QUIET = bQuiet; + setupControl(bQuiet, bSilent, bStandalone); strDbPath = databaseDirName; @@ -230,20 +238,27 @@ void Config::setup (std::string const& strConf, bool bQuiet) // load() may have set a new value for the dataDir std::string const dbPath (legacy ("database_path")); if (!dbPath.empty ()) - { dataDir = boost::filesystem::path (dbPath); - } + else if (RUN_STANDALONE) + dataDir.clear(); } - boost::filesystem::create_directories (dataDir, ec); + if (!dataDir.empty()) + { + boost::system::error_code ec; + boost::filesystem::create_directories(dataDir, ec); - if (ec) - Throw ( - boost::str (boost::format ("Can not create %s") % dataDir)); + if (ec) + Throw( + boost::str(boost::format("Can not create %s") % dataDir)); - legacy ("database_path", boost::filesystem::absolute (dataDir).string ()); + legacy("database_path", boost::filesystem::absolute(dataDir).string()); + } HTTPClient::initializeSSLContext(*this); + + if (RUN_STANDALONE) + LEDGER_HISTORY = 0; } void Config::load () diff --git a/src/ripple/core/impl/DatabaseCon.cpp b/src/ripple/core/impl/DatabaseCon.cpp index ec44ed4b2f..878a23bc1b 100644 --- a/src/ripple/core/impl/DatabaseCon.cpp +++ b/src/ripple/core/impl/DatabaseCon.cpp @@ -62,7 +62,7 @@ DatabaseCon::Setup setup_DatabaseCon (Config const& c) DatabaseCon::Setup setup; setup.startUp = c.START_UP; - setup.standAlone = c.RUN_STANDALONE; + setup.standAlone = c.standalone(); setup.dataDir = c.legacy ("database_path"); if (!setup.standAlone && setup.dataDir.empty()) { diff --git a/src/ripple/core/tests/Config.test.cpp b/src/ripple/core/tests/Config.test.cpp index b04ce6a215..9ce4e31a30 100644 --- a/src/ripple/core/tests/Config.test.cpp +++ b/src/ripple/core/tests/Config.test.cpp @@ -223,12 +223,17 @@ public: } rmDataDir_ = !exists (dataDir_); - config_.setup (configFile_.string (), /*bQuiet*/ false); + config_.setup (configFile_.string (), /*bQuiet*/ false, + /* bSilent */ false, /* bStandalone */ false); } Config& config () { return config_; } + std::string configFile() const + { + return configFile_.string(); + } bool dataDirExists () const { return boost::filesystem::is_directory (dataDir_); @@ -448,6 +453,7 @@ port_wss_admin "dbPath No Path"); } } + void testValidatorsFile () { testcase ("validators_file"); @@ -682,11 +688,104 @@ nHUkAWDR4cB8AgPg7VXMX6et8xRTQb2KJfgv1aBEXozwrawRKgMB expect (error == expectedError); } } + + void testSetup(bool explicitPath) + { + detail::RippledCfgGuard cfg(*this, "testSetup", + explicitPath ? "test_db" : "", ""); + /* ConfigGuard has a Config object that gets loaded on construction, + but Config::setup is not reentrant, so we need a fresh config + for every test case, so ignore it. + */ + { + Config config; + config.setup(cfg.configFile(), /*bQuiet*/ false, + /* bSilent */ false, /* bStandalone */ false); + expect(!config.quiet()); + expect(!config.silent()); + expect(!config.standalone()); + expect(config.LEDGER_HISTORY == 256); + expect(!config.legacy("database_path").empty()); + } + { + Config config; + config.setup(cfg.configFile(), /*bQuiet*/ true, + /* bSilent */ false, /* bStandalone */ false); + expect(config.quiet()); + expect(!config.silent()); + expect(!config.standalone()); + expect(config.LEDGER_HISTORY == 256); + expect(!config.legacy("database_path").empty()); + } + { + Config config; + config.setup(cfg.configFile(), /*bQuiet*/ false, + /* bSilent */ true, /* bStandalone */ false); + expect(config.quiet()); + expect(config.silent()); + expect(!config.standalone()); + expect(config.LEDGER_HISTORY == 256); + expect(!config.legacy("database_path").empty()); + } + { + Config config; + config.setup(cfg.configFile(), /*bQuiet*/ true, + /* bSilent */ true, /* bStandalone */ false); + expect(config.quiet()); + expect(config.silent()); + expect(!config.standalone()); + expect(config.LEDGER_HISTORY == 256); + expect(!config.legacy("database_path").empty()); + } + { + Config config; + config.setup(cfg.configFile(), /*bQuiet*/ false, + /* bSilent */ false, /* bStandalone */ true); + expect(!config.quiet()); + expect(!config.silent()); + expect(config.standalone()); + expect(config.LEDGER_HISTORY == 0); + expect(config.legacy("database_path").empty() == !explicitPath); + } + { + Config config; + config.setup(cfg.configFile(), /*bQuiet*/ true, + /* bSilent */ false, /* bStandalone */ true); + expect(config.quiet()); + expect(!config.silent()); + expect(config.standalone()); + expect(config.LEDGER_HISTORY == 0); + expect(config.legacy("database_path").empty() == !explicitPath); + } + { + Config config; + config.setup(cfg.configFile(), /*bQuiet*/ false, + /* bSilent */ true, /* bStandalone */ true); + expect(config.quiet()); + expect(config.silent()); + expect(config.standalone()); + expect(config.LEDGER_HISTORY == 0); + expect(config.legacy("database_path").empty() == !explicitPath); + } + { + Config config; + config.setup(cfg.configFile(), /*bQuiet*/ true, + /* bSilent */ true, /* bStandalone */ true); + expect(config.quiet()); + expect(config.silent()); + expect(config.standalone()); + expect(config.LEDGER_HISTORY == 0); + expect(config.legacy("database_path").empty() == !explicitPath); + } + } + void run () { testLegacy (); testDbPath (); testValidatorsFile (); + testSetup (false); + testSetup (true); } }; diff --git a/src/ripple/net/impl/RPCCall.cpp b/src/ripple/net/impl/RPCCall.cpp index 184cbaa95f..8f28c59db6 100644 --- a/src/ripple/net/impl/RPCCall.cpp +++ b/src/ripple/net/impl/RPCCall.cpp @@ -1208,7 +1208,7 @@ rpcClient(std::vector const& args, ? jvRequest["method"].asString () : args[0], jvParams, // Parsed, execute. setup.client.secure != 0, // Use SSL - config.QUIET, + config.quiet(), logs, std::bind (RPCCallImp::callRPCHandler, &jvOutput, std::placeholders::_1)); diff --git a/src/ripple/overlay/impl/OverlayImpl.cpp b/src/ripple/overlay/impl/OverlayImpl.cpp index cdf3aca897..7a1bfcef31 100644 --- a/src/ripple/overlay/impl/OverlayImpl.cpp +++ b/src/ripple/overlay/impl/OverlayImpl.cpp @@ -548,7 +548,7 @@ OverlayImpl::onPrepare() // if it's a private peer or we are running as standalone // automatic connections would defeat the purpose. config.autoConnect = - !app_.config().RUN_STANDALONE && + !app_.config().standalone() && !app_.config().PEER_PRIVATE; config.listeningPort = port; config.features = ""; @@ -591,7 +591,7 @@ OverlayImpl::onPrepare() }); // Add the ips_fixed from the rippled.cfg file - if (! app_.config().RUN_STANDALONE && !app_.config().IPS_FIXED.empty ()) + if (! app_.config().standalone() && !app_.config().IPS_FIXED.empty ()) { m_resolver.resolve (app_.config().IPS_FIXED, [this]( diff --git a/src/ripple/rpc/handlers/Connect.cpp b/src/ripple/rpc/handlers/Connect.cpp index 005f86a9bc..30ef78ae00 100644 --- a/src/ripple/rpc/handlers/Connect.cpp +++ b/src/ripple/rpc/handlers/Connect.cpp @@ -38,7 +38,7 @@ namespace ripple { Json::Value doConnect (RPC::Context& context) { auto lock = make_lock(context.app.getMasterMutex()); - if (context.app.config().RUN_STANDALONE) + if (context.app.config().standalone()) return "cannot connect in standalone mode"; if (!context.params.isMember (jss::ip)) diff --git a/src/ripple/rpc/handlers/LedgerAccept.cpp b/src/ripple/rpc/handlers/LedgerAccept.cpp index e7fe3eb444..acd1554372 100644 --- a/src/ripple/rpc/handlers/LedgerAccept.cpp +++ b/src/ripple/rpc/handlers/LedgerAccept.cpp @@ -36,7 +36,7 @@ Json::Value doLedgerAccept (RPC::Context& context) auto lock = make_lock(context.app.getMasterMutex()); Json::Value jvResult; - if (!context.app.config().RUN_STANDALONE) + if (!context.app.config().standalone()) { jvResult[jss::error] = "notStandAlone"; } diff --git a/src/ripple/rpc/handlers/RipplePathFind.cpp b/src/ripple/rpc/handlers/RipplePathFind.cpp index f5c1aee433..5d2a90789b 100644 --- a/src/ripple/rpc/handlers/RipplePathFind.cpp +++ b/src/ripple/rpc/handlers/RipplePathFind.cpp @@ -60,7 +60,7 @@ Json::Value doRipplePathFind (RPC::Context& context) std::shared_ptr lpLedger; Json::Value jvResult; - if (! context.app.config().RUN_STANDALONE && + if (! context.app.config().standalone() && ! context.params.isMember(jss::ledger) && ! context.params.isMember(jss::ledger_index) && ! context.params.isMember(jss::ledger_hash)) diff --git a/src/ripple/rpc/impl/LookupLedger.cpp b/src/ripple/rpc/impl/LookupLedger.cpp index b09877a19f..5709850c7e 100644 --- a/src/ripple/rpc/impl/LookupLedger.cpp +++ b/src/ripple/rpc/impl/LookupLedger.cpp @@ -93,7 +93,7 @@ Status ledgerFromRequest (T& ledger, Context& context) return {rpcLGR_NOT_FOUND, "ledgerNotFound"}; if (ledger->info().seq > ledgerMaster.getValidLedgerIndex() && - isValidatedOld(ledgerMaster, context.app.config().RUN_STANDALONE)) + isValidatedOld(ledgerMaster, context.app.config().standalone())) { ledger.reset(); return {rpcNO_NETWORK, "InsufficientNetworkMode"}; @@ -101,7 +101,7 @@ Status ledgerFromRequest (T& ledger, Context& context) } else { - if (isValidatedOld (ledgerMaster, context.app.config().RUN_STANDALONE)) + if (isValidatedOld (ledgerMaster, context.app.config().standalone())) return {rpcNO_NETWORK, "InsufficientNetworkMode"}; auto const index = indexValue.asString (); diff --git a/src/ripple/rpc/impl/RPCHandler.cpp b/src/ripple/rpc/impl/RPCHandler.cpp index 0c65179558..d8679a32fb 100644 --- a/src/ripple/rpc/impl/RPCHandler.cpp +++ b/src/ripple/rpc/impl/RPCHandler.cpp @@ -150,7 +150,7 @@ error_code_i fillHandler (Context& context, return rpcNO_NETWORK; } - if (!context.app.config().RUN_STANDALONE && + if (!context.app.config().standalone() && handler->condition_ & NEEDS_CURRENT_LEDGER) { if (context.ledgerMaster.getValidatedLedgerAge () > diff --git a/src/ripple/rpc/impl/TransactionSign.cpp b/src/ripple/rpc/impl/TransactionSign.cpp index 37b5c75254..35e36e22e6 100644 --- a/src/ripple/rpc/impl/TransactionSign.cpp +++ b/src/ripple/rpc/impl/TransactionSign.cpp @@ -280,7 +280,7 @@ checkTxJsonFields ( } // Check for current ledger. - if (verify && !config.RUN_STANDALONE && + if (verify && !config.standalone() && (validatedLedgerAge > Tuning::maxValidatedLedgerAge)) { ret.first = rpcError (rpcNO_CURRENT); diff --git a/src/ripple/server/impl/ServerHandlerImp.cpp b/src/ripple/server/impl/ServerHandlerImp.cpp index 3103551115..9e2a8b384b 100644 --- a/src/ripple/server/impl/ServerHandlerImp.cpp +++ b/src/ripple/server/impl/ServerHandlerImp.cpp @@ -770,7 +770,7 @@ parse_Ports ( result.push_back(to_Port(parsed, log)); } - if (config.RUN_STANDALONE) + if (config.standalone()) { auto it = result.begin (); diff --git a/src/ripple/test/jtx/impl/Env.cpp b/src/ripple/test/jtx/impl/Env.cpp index c8dfa829e8..a0453f4dc0 100644 --- a/src/ripple/test/jtx/impl/Env.cpp +++ b/src/ripple/test/jtx/impl/Env.cpp @@ -62,9 +62,7 @@ setupConfigForUnitTests (Config& cfg) cfg.overwrite (ConfigSection::nodeDatabase (), "path", "main"); cfg.deprecatedClearSection (ConfigSection::importNodeDatabase ()); cfg.legacy("database_path", ""); - cfg.RUN_STANDALONE = true; - cfg.QUIET = true; - cfg.SILENT = true; + cfg.setupControl(true, true, true); cfg["server"].append("port_peer"); cfg["port_peer"].set("ip", "127.0.0.1"); cfg["port_peer"].set("port", "8080");