diff --git a/src/ripple/app/ledger/OrderBookDB.cpp b/src/ripple/app/ledger/OrderBookDB.cpp index a81331d04e..4b598de1b4 100644 --- a/src/ripple/app/ledger/OrderBookDB.cpp +++ b/src/ripple/app/ledger/OrderBookDB.cpp @@ -62,17 +62,16 @@ OrderBookDB::setup(std::shared_ptr const& ledger) mSeq = seq; } - if (app_.config().PATH_SEARCH_MAX == 0) + if (app_.config().PATH_SEARCH_MAX != 0) { - // nothing to do + if (app_.config().standalone()) + update(ledger); + else + app_.getJobQueue().addJob( + jtUPDATE_PF, "OrderBookDB::update", [this, ledger](Job&) { + update(ledger); + }); } - else if (app_.config().standalone()) - update(ledger); - else - app_.getJobQueue().addJob( - jtUPDATE_PF, "OrderBookDB::update", [this, ledger](Job&) { - update(ledger); - }); } void diff --git a/src/ripple/core/Config.h b/src/ripple/core/Config.h index bd49575849..5a2e8b93aa 100644 --- a/src/ripple/core/Config.h +++ b/src/ripple/core/Config.h @@ -160,7 +160,18 @@ public: std::size_t PEERS_OUT_MAX = 0; std::size_t PEERS_IN_MAX = 0; - // Path searching + // Path searching: these were reasonable default values at some point but + // further research is needed to decide if they still are + // and whether all of them are needed. + // + // The performance and resource consumption of a server can + // be dramatically impacted by changing these configuration + // options; higher values result in exponentially higher + // resource usage. + // + // Servers operating as validators disable path finding by + // default by setting the `PATH_SEARCH_MAX` option to 0 + // unless it is explicitly set in the configuration file. int PATH_SEARCH_OLD = 7; int PATH_SEARCH = 7; int PATH_SEARCH_FAST = 2; diff --git a/src/ripple/core/impl/Config.cpp b/src/ripple/core/impl/Config.cpp index e588553dd1..be8fda31d7 100644 --- a/src/ripple/core/impl/Config.cpp +++ b/src/ripple/core/impl/Config.cpp @@ -615,6 +615,11 @@ Config::loadFromString(std::string const& fileContents) FETCH_DEPTH = 10; } + // By default, validators don't have pathfinding enabled, unless it is + // explicitly requested by the server's admin. + if (exists(SECTION_VALIDATION_SEED) || exists(SECTION_VALIDATOR_TOKEN)) + PATH_SEARCH_MAX = 0; + if (getSingleSection(secConfig, SECTION_PATH_SEARCH_OLD, strTemp, j_)) PATH_SEARCH_OLD = beast::lexicalCastThrow(strTemp); if (getSingleSection(secConfig, SECTION_PATH_SEARCH, strTemp, j_))