Cleanups needed to support new code.

This commit is contained in:
JoelKatz
2013-03-14 18:46:52 -07:00
parent be932de252
commit 0baccf10b0
3 changed files with 44 additions and 100 deletions

View File

@@ -363,7 +363,9 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax
else if (!speEnd.mCurrencyID)
{
// Cursor is for XRP, continue with qualifying books: XRP -> non-XRP
BOOST_FOREACH(OrderBook::ref book, theApp->getOrderBookDB().getXRPInBooks())
std::vector<OrderBook::pointer> xrpBooks;
theApp->getOrderBookDB().getBooksByTakerPays(ACCOUNT_XRP, CURRENCY_XRP, xrpBooks);
BOOST_FOREACH(OrderBook::ref book, xrpBooks)
{
// New end is an order book with the currency and issuer.
@@ -470,12 +472,10 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax
}
}
// Every book that wants the source currency.
std::vector<OrderBook::pointer> books;
// XXX Flip argument order to norm.
theApp->getOrderBookDB().getBooks(speEnd.mIssuerID, speEnd.mCurrencyID, books);
std::vector<OrderBook::pointer> books;
theApp->getOrderBookDB().getBooksByTakerPays(speEnd.mIssuerID, speEnd.mCurrencyID, books);
BOOST_FOREACH(OrderBook::ref book, books)
{
if (!spPath.hasSeen(ACCOUNT_XRP, book->getCurrencyOut(), book->getIssuerOut()))
@@ -631,7 +631,9 @@ void Pathfinder::addOptions(PathOption::pointer tail)
{
if (!tail->mCurrencyID)
{ // source XRP
BOOST_FOREACH(OrderBook::ref book, theApp->getOrderBookDB().getXRPInBooks())
std::vector<OrderBook::pointer> xrpBooks;
theApp->getOrderBookDB().getBooksByTakerPays(ISSUER_XRP, CURRENCY_XRP, xrpBooks);
BOOST_FOREACH(OrderBook::ref book, xrpBooks)
{
PathOption::pointer pathOption(new PathOption(tail));
@@ -663,11 +665,10 @@ void Pathfinder::addOptions(PathOption::pointer tail)
}
}
// every offer that wants the source currency
// Every offer that can take this currency in
std::vector<OrderBook::pointer> books;
theApp->getOrderBookDB().getBooks(tail->mCurrentAccount, tail->mCurrencyID, books);
BOOST_FOREACH(OrderBook::ref book,books)
theApp->getOrderBookDB().getBooksByTakerPays(tail->mCurrentAccount, tail->mCurrencyID, books);
BOOST_FOREACH(OrderBook::ref book, books)
{
PathOption::pointer pathOption(new PathOption(tail));