Clean up Pathfinder.

* Restrict to 80-columns and other style cleanups.
* Make pathfinding a free function and hide the class Pathfinder.
* Split off unrelated utility functions into separate files.

Conflicts:
	src/ripple/rpc/handlers/RipplePathFind.cpp
This commit is contained in:
Tom Ritchford
2014-10-09 13:57:22 -04:00
committed by Vinnie Falco
parent b30b2a523f
commit c2f2f83b7c
17 changed files with 1052 additions and 668 deletions

View File

@@ -17,6 +17,7 @@
*/
//==============================================================================
#include <ripple/app/paths/FindPaths.h>
#include <ripple/basics/StringUtilities.h>
#include <ripple/rpc/impl/TransactionSign.h>
#include <beast/unit_test.h>
@@ -151,22 +152,20 @@ static Json::Value signPayment(
if (!lpf.isOk ())
return rpcError (rpcTOO_BUSY);
bool bValid;
auto cache = std::make_shared<RippleLineCache> (lSnapshot);
Pathfinder pf (
STPath fullLiquidityPath;
auto valid = findPathsForOneIssuer (
cache,
raSrcAddressID,
dstAccountID,
saSendMax.getCurrency (),
saSendMax.getIssuer (),
amount, bValid);
raSrcAddressID.getAccountID(),
dstAccountID.getAccountID(),
saSendMax.issue (),
amount,
getConfig ().PATH_SEARCH_OLD,
4, // iMaxPaths
spsPaths,
fullLiquidityPath);
STPath extraPath;
if (!bValid ||
!pf.findPaths (getConfig ().PATH_SEARCH_OLD,
4,
spsPaths,
extraPath))
if (!valid)
{
WriteLog (lsDEBUG, RPCHandler)
<< "transactionSign: build_path: No paths found.";