This commit is contained in:
JoelKatz
2013-04-07 20:46:33 -07:00
parent f405a492a4
commit a47b89422f
2 changed files with 15 additions and 8 deletions

View File

@@ -6,7 +6,6 @@
#include <boost/foreach.hpp>
#include "Application.h"
#include "AccountItems.h"
#include "Log.h"
SETUP_LOG();
@@ -396,12 +395,6 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax
// Last element is for non-XRP, continue by adding ripple lines and order books.
// Create new paths for each outbound account not already in the path.
boost::unordered_map<uint160, AccountItems::pointer>::iterator it = aiMap.find(speEnd.mAccountID);
if (it == aiMap.end())
it = aiMap.insert(std::make_pair(speEnd.mAccountID,
boost::make_shared<AccountItems>(
boost::cref(speEnd.mAccountID), boost::cref(mLedger), AccountItem::pointer(new RippleState())))).first;
AccountItems& rippleLines = *it->second;
SLE::pointer sleEnd = lesActive.entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(speEnd.mAccountID));
@@ -416,7 +409,7 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax
// True, the cursor requires the next node to be authorized.
bool bRequireAuth = isSetBit(sleEnd->getFieldU32(sfFlags), lsfRequireAuth);
BOOST_FOREACH(AccountItem::ref item, rippleLines.getItems())
BOOST_FOREACH(AccountItem::ref item, getRippleLines(speEnd.mAccountID).getItems())
{
RippleState* rspEntry = (RippleState*) item.get();
const uint160& uPeerID = rspEntry->getAccountIDPeer();
@@ -784,6 +777,15 @@ boost::unordered_set<uint160> usAccountSourceCurrencies(const RippleAddress& raA
return usCurrencies;
}
AccountItems& Pathfinder::getRippleLines(const uint160& accountID)
{
boost::unordered_map<uint160, AccountItems::pointer>::iterator it = mRLMap.find(accountID);
if (it == mRLMap.end())
it = mRLMap.insert(std::make_pair(accountID, boost::make_shared<AccountItems>
(boost::cref(accountID), boost::cref(mLedger), AccountItem::pointer(new RippleState())))).first;
return *it->second;
}
bool Pathfinder::matchesOrigin(const uint160& currency, const uint160& issuer)
{
return (currency == mSrcCurrencyID) && (issuer == mSrcIssuerID);

View File

@@ -7,6 +7,7 @@
#include "RippleAddress.h"
#include "RippleCalc.h"
#include "OrderBookDB.h"
#include "AccountItems.h"
#if 0
//
@@ -47,6 +48,8 @@ class Pathfinder
PathState::pointer mPsDefault;
LoadEvent::pointer mLoadMonitor;
boost::unordered_map<uint160, AccountItems::pointer> mRLMap;
// std::list<PathOption::pointer> mBuildingPaths;
// std::list<PathOption::pointer> mCompletePaths;
@@ -59,6 +62,8 @@ class Pathfinder
bool matchesOrigin(const uint160& currency, const uint160& issuer);
AccountItems& getRippleLines(const uint160& accountID);
public:
Pathfinder(Ledger::ref ledger,
const RippleAddress& srcAccountID, const RippleAddress& dstAccountID,