mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-29 15:35:50 +00:00
Correct Pathfinder::getPaths out to handle order books (RIPD-427)
This commit is contained in:
committed by
Vinnie Falco
parent
4b905fe9ff
commit
91a227a475
@@ -173,6 +173,12 @@ OrderBook::List OrderBookDB::getBooksByTakerPays (Issue const& issue)
|
||||
return it == mSourceMap.end () ? OrderBook::List() : it->second;
|
||||
}
|
||||
|
||||
int OrderBookDB::getBookSize(Issue const& issue) {
|
||||
ScopedLockType sl (mLock);
|
||||
auto it = mSourceMap.find (issue);
|
||||
return it == mSourceMap.end () ? 0 : it->second.size();
|
||||
}
|
||||
|
||||
bool OrderBookDB::isBookToXRP(Issue const& issue)
|
||||
{
|
||||
ScopedLockType sl (mLock);
|
||||
|
||||
@@ -37,9 +37,14 @@ public:
|
||||
|
||||
void addOrderBook(Book const&);
|
||||
|
||||
// return list of all orderbooks that want this issuerID and currencyID
|
||||
/** @return a list of all orderbooks that want this issuerID and currencyID.
|
||||
*/
|
||||
OrderBook::List getBooksByTakerPays (Issue const&);
|
||||
|
||||
/** @return a count of all orderbooks that want this issuerID and currencyID.
|
||||
*/
|
||||
int getBookSize(Issue const&);
|
||||
|
||||
bool isBookToXRP (Issue const&);
|
||||
|
||||
BookListeners::pointer getBookListeners (Book const&);
|
||||
|
||||
@@ -486,12 +486,10 @@ bool Pathfinder::matchesOrigin (Issue const& issue)
|
||||
issue.account == mSrcAccountID);
|
||||
}
|
||||
|
||||
// VFALCO TODO Use Currency, RippleAccount, et. al. in argument list here
|
||||
int Pathfinder::getPathsOut (
|
||||
Currency const& currencyID, Account const& accountID,
|
||||
bool isDstCurrency, Account const& dstAccount)
|
||||
{
|
||||
// VFALCO TODO Use Issue here
|
||||
auto currencyAccount = std::make_pair(currencyID, accountID);
|
||||
auto it = mPOMap.find (currencyAccount);
|
||||
|
||||
@@ -513,7 +511,9 @@ int Pathfinder::getPathsOut (
|
||||
|
||||
if (!bFrozen)
|
||||
{
|
||||
for (auto const& item : mRLCache->getRippleLines (accountID).getItems ())
|
||||
count = getApp().getOrderBookDB().getBookSize({currencyID, accountID});
|
||||
AccountItems& rippleLines = mRLCache->getRippleLines (accountID);
|
||||
for (auto const& item : rippleLines.getItems ())
|
||||
{
|
||||
RippleState* rspEntry = (RippleState*) item.get ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user