diff --git a/src/cpp/ripple/Config.cpp b/src/cpp/ripple/Config.cpp index 7af7c08242..3d1c9f3ac8 100644 --- a/src/cpp/ripple/Config.cpp +++ b/src/cpp/ripple/Config.cpp @@ -28,6 +28,7 @@ #define SECTION_NETWORK_QUORUM "network_quorum" #define SECTION_NODE_SEED "node_seed" #define SECTION_NODE_SIZE "node_size" +#define SECTION_PATH_SEARCH_SIZE "path_search_size" #define SECTION_PEER_CONNECT_LOW_WATER "peer_connect_low_water" #define SECTION_PEER_IP "peer_ip" #define SECTION_PEER_PORT "peer_port" @@ -219,6 +220,7 @@ Config::Config() LEDGER_HISTORY = 256; + PATH_SEARCH_SIZE = DEFAULT_PATH_SEARCH_SIZE; ACCOUNT_PROBE_MAX = 10; VALIDATORS_SITE = DEFAULT_VALIDATORS_SITE; @@ -445,6 +447,9 @@ void Config::load() LEDGER_HISTORY = boost::lexical_cast(strTemp); } + if (sectionSingleB(secConfig, SECTION_PATH_SEARCH_SIZE, strTemp)) + PATH_SEARCH_SIZE = boost::lexical_cast(strTemp); + if (sectionSingleB(secConfig, SECTION_ACCOUNT_PROBE_MAX, strTemp)) ACCOUNT_PROBE_MAX = boost::lexical_cast(strTemp); diff --git a/src/cpp/ripple/Config.h b/src/cpp/ripple/Config.h index 741e9a7ef0..bff35fcc29 100644 --- a/src/cpp/ripple/Config.h +++ b/src/cpp/ripple/Config.h @@ -50,6 +50,9 @@ const int SYSTEM_WEBSOCKET_PUBLIC_PORT = 6563; // XXX Going away. // Might connect with fewer for testing. #define DEFAULT_PEER_CONNECT_LOW_WATER 4 +// Grows exponentially worse. +#define DEFAULT_PATH_SEARCH_SIZE 5 + enum SizedItemName { siSweepInterval, @@ -142,6 +145,9 @@ public: bool RPC_ALLOW_REMOTE; Json::Value RPC_STARTUP; + // Path searching + int PATH_SEARCH_SIZE; + // Validation RippleAddress VALIDATION_SEED, VALIDATION_PUB, VALIDATION_PRIV; diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index dc0712efe4..1b201f8c21 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -179,7 +179,7 @@ Json::Value RPCHandler::transactionSign(Json::Value jvRequest, bool bSubmit) Pathfinder pf(raSrcAddressID, dstAccountID, saSendMax.getCurrency(), saSendMax.getIssuer(), saSend); - if (!pf.findPaths(7, 3, spsPaths)) + if (!pf.findPaths(theConfig.PATH_SEARCH_SIZE, 3, spsPaths)) { cLog(lsDEBUG) << "transactionSign: build_path: No paths found."; @@ -1150,7 +1150,7 @@ Json::Value RPCHandler::doRipplePathFind(Json::Value jvRequest) STPathSet spsComputed; Pathfinder pf(raSrc, raDst, uSrcCurrencyID, uSrcIssuerID, saDstAmount); - if (!pf.findPaths(7, 3, spsComputed)) + if (!pf.findPaths(theConfig.PATH_SEARCH_SIZE, 3, spsComputed)) { cLog(lsDEBUG) << "ripple_path_find: No paths found."; }