diff --git a/doc/rippled-example.cfg b/doc/rippled-example.cfg index bf5644f805..6bbb5b05c2 100644 --- a/doc/rippled-example.cfg +++ b/doc/rippled-example.cfg @@ -527,6 +527,9 @@ # [path_search_max] # When searching for paths, the minimum and maximum search aggressiveness. # +# If you do not need pathfinding, you can set path_search_max to zero to +# disable it and avoid some expensive bookkeeping. +# # The default for 'path_search_fast' is 2. The default for 'path_search_max' is 10. # # [path_search_old] diff --git a/src/ripple/app/ledger/OrderBookDB.cpp b/src/ripple/app/ledger/OrderBookDB.cpp index 8ffff6822c..103c2de2ca 100644 --- a/src/ripple/app/ledger/OrderBookDB.cpp +++ b/src/ripple/app/ledger/OrderBookDB.cpp @@ -66,7 +66,11 @@ void OrderBookDB::setup( mSeq = seq; } - if (app_.config().RUN_STANDALONE) + if (app_.config().PATH_SEARCH_MAX == 0) + { + // nothing to do + } + else if (app_.config().RUN_STANDALONE) update(ledger); else app_.getJobQueue().addJob( @@ -84,6 +88,12 @@ void OrderBookDB::update( JLOG (j_.debug) << "OrderBookDB::update>"; + if (app_.config().PATH_SEARCH_MAX == 0) + { + // pathfinding has been disabled + return; + } + // walk through the entire ledger looking for orderbook entries int books = 0; diff --git a/src/ripple/rpc/handlers/PathFind.cpp b/src/ripple/rpc/handlers/PathFind.cpp index 86a345858e..92fe19db93 100644 --- a/src/ripple/rpc/handlers/PathFind.cpp +++ b/src/ripple/rpc/handlers/PathFind.cpp @@ -32,6 +32,9 @@ namespace ripple { Json::Value doPathFind (RPC::Context& context) { + if (context.app.config().PATH_SEARCH_MAX == 0) + return rpcError (rpcNOT_SUPPORTED); + auto lpLedger = context.ledgerMaster.getClosedLedger(); if (!context.params.isMember (jss::subcommand) || diff --git a/src/ripple/rpc/handlers/RipplePathFind.cpp b/src/ripple/rpc/handlers/RipplePathFind.cpp index 8bca768fb1..272624bc70 100644 --- a/src/ripple/rpc/handlers/RipplePathFind.cpp +++ b/src/ripple/rpc/handlers/RipplePathFind.cpp @@ -70,6 +70,9 @@ buildSrcCurrencies(AccountID const& account, // This interface is deprecated. Json::Value doRipplePathFind (RPC::Context& context) { + if (context.app.config().PATH_SEARCH_MAX == 0) + return rpcError (rpcNOT_SUPPORTED); + RPC::LegacyPathFind lpf (context.role == Role::ADMIN, context.app); if (!lpf.isOk ()) return rpcError (rpcTOO_BUSY);