static void updateHelper (SLE::ref entry, hash_set< uint256 >& seen, OrderBookDB::IssueToOrderBook& destMap, OrderBookDB::IssueToOrderBook& sourceMap, hash_set< Issue >& XDVBooks, int& books) { if (entry->getType () == ltDIR_NODE && entry->isFieldPresent (sfExchangeRate) && entry->getFieldH256 (sfRootIndex) == entry->getIndex()) { Book book; book.in.currency.copyFrom (entry->getFieldH160 (sfTakerPaysCurrency)); book.in.account.copyFrom (entry->getFieldH160 (sfTakerPaysIssuer)); book.out.account.copyFrom (entry->getFieldH160 (sfTakerGetsIssuer)); book.out.currency.copyFrom (entry->getFieldH160 (sfTakerGetsCurrency)); uint256 index = getBookBase (book); if (seen.insert (index).second) { auto orderBook = std::make_shared<OrderBook> (index, book); sourceMap[book.in].push_back (orderBook); destMap[book.out].push_back (orderBook); if (isXDV(book.out)) XDVBooks.insert(book.in); ++books; } } }
static void updateHelper (SLE::ref entry, boost::unordered_set< uint256 >& seen, boost::unordered_map< currencyIssuer_t, std::vector<OrderBook::pointer> >& destMap, boost::unordered_map< currencyIssuer_t, std::vector<OrderBook::pointer> >& sourceMap, boost::unordered_set< currencyIssuer_t >& XRPBooks, int& books) { if ((entry->getType () == ltDIR_NODE) && (entry->isFieldPresent (sfExchangeRate)) && (entry->getFieldH256 (sfRootIndex) == entry->getIndex())) { const uint160& ci = entry->getFieldH160 (sfTakerPaysCurrency); const uint160& co = entry->getFieldH160 (sfTakerGetsCurrency); const uint160& ii = entry->getFieldH160 (sfTakerPaysIssuer); const uint160& io = entry->getFieldH160 (sfTakerGetsIssuer); uint256 index = Ledger::getBookBase (ci, ii, co, io); if (seen.insert (index).second) { // VFALCO TODO Reduce the clunkiness of these parameter wrappers OrderBook::pointer book = boost::make_shared<OrderBook> (boost::cref (index), boost::cref (ci), boost::cref (co), boost::cref (ii), boost::cref (io)); sourceMap[currencyIssuer_ct (ci, ii)].push_back (book); destMap[currencyIssuer_ct (co, io)].push_back (book); if (co.isZero()) XRPBooks.insert(currencyIssuer_ct (ci, ii)); ++books; } } }