Fix Pathfinder::getPathsOut to use Issue

This commit is contained in:
Tom Ritchford
2014-08-06 12:33:31 -04:00
committed by Vinnie Falco
parent c841f8b360
commit e3698b2a07
2 changed files with 10 additions and 9 deletions

View File

@@ -490,16 +490,17 @@ int Pathfinder::getPathsOut (
Currency const& currencyID, Account const& accountID,
bool isDstCurrency, Account const& dstAccount)
{
auto currencyAccount = std::make_pair(currencyID, accountID);
auto it = mPOMap.find (currencyAccount);
Issue issue (currencyID, accountID);
auto it = mPathsOutCountMap.find (issue);
if (it != mPOMap.end ())
if (it != mPathsOutCountMap.end ())
return it->second;
auto sleAccount = mLedger->getSLEi(Ledger::getAccountRootIndex(accountID));
auto sleAccount = mLedger->getSLEi (
Ledger::getAccountRootIndex (accountID));
if (!sleAccount)
{
mPOMap[currencyAccount] = 0;
mPathsOutCountMap[issue] = 0;
return 0;
}
@@ -541,7 +542,7 @@ int Pathfinder::getPathsOut (
++count;
}
}
mPOMap[currencyAccount] = count;
mPathsOutCountMap[issue] = count;
return count;
}

View File

@@ -133,11 +133,11 @@ private:
LoadEvent::pointer m_loadEvent;
RippleLineCache::pointer mRLCache;
STPathElement mSource;
STPathSet mCompletePaths;
STPathElement mSource;
STPathSet mCompletePaths;
std::map<PathType_t, STPathSet> mPaths;
hash_map<std::pair<Currency, Account>, int> mPOMap;
hash_map<Issue, int> mPathsOutCountMap;
// Add ripple paths
static std::uint32_t const afADD_ACCOUNTS = 0x001;