mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Pathfinding improvements:
* Make each path request track whether it needs updating. * Improve new request handling, reverse order for processing requests. * Break to handle new requests immediately. * Make mPathFindThread an integer rather than a bool. Allow two threads. * For old pathfinding, if the ledger is unspecified, use the PathRequest's RippleLineCache. * Log new pathfinding request latencies. * Suspend processing requests if server is backed up.
This commit is contained in:
@@ -1479,12 +1479,7 @@ Json::Value RPCHandler::doPathFind (Json::Value params, Resource::Charge& loadTy
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
}
|
||||
|
||||
// TODO:
|
||||
// - Add support for specifying non-endpoint issuer.
|
||||
// - Return fully expanded path with proof.
|
||||
// - Allows clients to verify path exists.
|
||||
// - Return canonicalized path.
|
||||
// - From a trusted server, allows clients to use path without manipulation.
|
||||
// This interface is deprecated.
|
||||
Json::Value RPCHandler::doRipplePathFind (Json::Value params, Resource::Charge& loadType, Application::ScopedLockType& masterLockHolder)
|
||||
{
|
||||
int jc = getApp().getJobQueue ().getJobCountGE (jtCLIENT);
|
||||
@@ -1500,10 +1495,15 @@ Json::Value RPCHandler::doRipplePathFind (Json::Value params, Resource::Charge&
|
||||
RippleAddress raDst;
|
||||
STAmount saDstAmount;
|
||||
Ledger::pointer lpLedger;
|
||||
Json::Value jvResult = lookupLedger (params, lpLedger);
|
||||
|
||||
if (!lpLedger)
|
||||
return jvResult;
|
||||
Json::Value jvResult;
|
||||
|
||||
if (getConfig().RUN_STANDALONE || params.isMember("ledger") || params.isMember("ledger_index") || params.isMember("ledger_hash"))
|
||||
{ // The caller specified a ledger
|
||||
jvResult = lookupLedger (params, lpLedger);
|
||||
if (!lpLedger)
|
||||
return jvResult;
|
||||
}
|
||||
|
||||
if (!params.isMember ("source_account"))
|
||||
{
|
||||
@@ -1546,7 +1546,18 @@ Json::Value RPCHandler::doRipplePathFind (Json::Value params, Resource::Charge&
|
||||
else
|
||||
{
|
||||
loadType = Resource::feeHighBurdenRPC;
|
||||
Ledger::pointer lSnapShot = boost::make_shared<Ledger> (boost::ref (*lpLedger), false);
|
||||
RippleLineCache::pointer cache;
|
||||
|
||||
if (lpLedger)
|
||||
{ // The caller specified a ledger
|
||||
lpLedger = boost::make_shared<Ledger> (boost::ref (*lpLedger), false);
|
||||
cache = boost::make_shared<RippleLineCache>(lpLedger);
|
||||
}
|
||||
else
|
||||
{ // Use the default ledger and cache
|
||||
lpLedger = mNetOps->getValidatedLedger();
|
||||
cache = PathRequest::getLineCache(lpLedger, false);
|
||||
}
|
||||
|
||||
masterLockHolder.unlock (); // As long as we have a locked copy of the ledger, we can unlock.
|
||||
|
||||
@@ -1583,7 +1594,6 @@ Json::Value RPCHandler::doRipplePathFind (Json::Value params, Resource::Charge&
|
||||
jvResult["destination_account"] = raDst.humanAccountID ();
|
||||
|
||||
Json::Value jvArray (Json::arrayValue);
|
||||
RippleLineCache::pointer cache = boost::make_shared<RippleLineCache> (lSnapShot);
|
||||
|
||||
for (unsigned int i = 0; i != jvSrcCurrencies.size (); ++i)
|
||||
{
|
||||
@@ -1646,7 +1656,7 @@ Json::Value RPCHandler::doRipplePathFind (Json::Value params, Resource::Charge&
|
||||
1);
|
||||
saMaxAmount.negate ();
|
||||
|
||||
LedgerEntrySet lesSandbox (lSnapShot, tapNONE);
|
||||
LedgerEntrySet lesSandbox (lpLedger, tapNONE);
|
||||
|
||||
TER terResult =
|
||||
RippleCalc::rippleCalc (
|
||||
|
||||
Reference in New Issue
Block a user