Make pathfinder search size configurable, reduce to 5.

This commit is contained in:
Arthur Britto
2013-02-12 18:41:52 -08:00
parent e5b75c66a1
commit ef5069a706
3 changed files with 13 additions and 2 deletions

View File

@@ -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<uint32>(strTemp);
}
if (sectionSingleB(secConfig, SECTION_PATH_SEARCH_SIZE, strTemp))
PATH_SEARCH_SIZE = boost::lexical_cast<int>(strTemp);
if (sectionSingleB(secConfig, SECTION_ACCOUNT_PROBE_MAX, strTemp))
ACCOUNT_PROBE_MAX = boost::lexical_cast<int>(strTemp);

View File

@@ -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;

View File

@@ -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.";
}