Merge branch 'master' of https://github.com/jedmccaleb/NewCoin into new_pathfinding

Conflicts:
	src/cpp/ripple/Application.cpp
	src/cpp/ripple/Pathfinder.cpp

Merge.
This commit is contained in:
JoelKatz
2013-03-29 10:27:54 -07:00
47 changed files with 715 additions and 486 deletions

View File

@@ -119,6 +119,10 @@ bool Pathfinder::bDefaultPath(const STPath& spPath)
bool bDefault;
LedgerEntrySet lesActive(mLedger, tapNONE);
cLog(lsTRACE) << boost::str(boost::format("bDefaultPath> mSrcAmount=%s mDstAmount=%s")
% mSrcAmount.getFullText()
% mDstAmount.getFullText());
// Expand the current path.
pspCurrent->setExpanded(lesActive, spPath, mDstAccountID, mSrcAccountID);
@@ -126,8 +130,8 @@ bool Pathfinder::bDefaultPath(const STPath& spPath)
// When path is a default (implied). Don't need to add it to return set.
bDefault = pspCurrent->vpnNodes == mPsDefault->vpnNodes;
cLog(lsTRACE) << "findPaths: expanded path: " << pspCurrent->getJson();
cLog(lsTRACE) << "findPaths: default path: indirect: " << spPath.getJson(0);
cLog(lsTRACE) << "bDefaultPath: expanded path: " << pspCurrent->getJson();
cLog(lsTRACE) << "bDefaultPath: default path: indirect: " << spPath.getJson(0);
return bDefault;
}
@@ -162,6 +166,10 @@ Pathfinder::Pathfinder(Ledger::ref ledger,
LedgerEntrySet lesActive(mLedger, tapNONE);
cLog(lsTRACE) << boost::str(boost::format("Pathfinder> mSrcAmount=%s mDstAmount=%s")
% mSrcAmount.getFullText()
% mDstAmount.getFullText());
psDefault->setExpanded(lesActive, STPath(), mDstAccountID, mSrcAccountID);
if (tesSUCCESS == psDefault->terStatus)
@@ -296,6 +304,12 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax
if (sLog(lsTRACE))
{
cLog(lsTRACE) << boost::str(boost::format("findPaths: spe: %s/%s: %s amt: %s")
% RippleAddress::createHumanAccountID(speEnd.mAccountID)
% RippleAddress::createHumanAccountID(speEnd.mIssuerID)
% RippleAddress::createHumanAccountID(mDstAccountID)
% RippleAddress::createHumanAccountID(mDstAmount.getIssuer()));
cLog(lsTRACE) << "findPaths: finish? account: " << (speEnd.mAccountID == mDstAccountID);
cLog(lsTRACE) << "findPaths: finish? currency: " << (speEnd.mCurrencyID == mDstAmount.getCurrency());
cLog(lsTRACE) << "findPaths: finish? issuer: "
@@ -408,7 +422,7 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax
SLE::pointer sleEnd = lesActive.entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(speEnd.mAccountID));
tLog(!sleEnd, lsDEBUG)
<< boost::str(boost::format("findPaths: order book: %s/%s : ")
<< boost::str(boost::format("findPaths: tail: %s/%s : ")
% RippleAddress::createHumanAccountID(speEnd.mAccountID)
% RippleAddress::createHumanAccountID(speEnd.mIssuerID));
@@ -445,11 +459,14 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax
{
// Path has no credit left. Ignore it.
cLog(lsTRACE) <<
boost::str(boost::format("findPaths: No credit: %s/%s -> %s/%s")
boost::str(boost::format("findPaths: No credit: %s/%s -> %s/%s balance=%s limit=%s")
% RippleAddress::createHumanAccountID(speEnd.mAccountID)
% STAmount::createHumanCurrency(speEnd.mCurrencyID)
% RippleAddress::createHumanAccountID(uPeerID)
% STAmount::createHumanCurrency(speEnd.mCurrencyID));
% STAmount::createHumanCurrency(speEnd.mCurrencyID)
% rspEntry->getBalance().getFullText()
% rspEntry->getLimitPeer().getFullText()
);
}
else
{
@@ -463,19 +480,23 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax
bContinued = true;
cLog(lsTRACE) <<
boost::str(boost::format("findPaths: push explore: %s/%s -> %s/%s")
boost::str(boost::format("findPaths: push explore: %s/%s -> %s/%s balance=%s limit=%s limit_peer=%s")
% STAmount::createHumanCurrency(speEnd.mCurrencyID)
% RippleAddress::createHumanAccountID(speEnd.mAccountID)
% STAmount::createHumanCurrency(speEnd.mCurrencyID)
% RippleAddress::createHumanAccountID(uPeerID));
% RippleAddress::createHumanAccountID(uPeerID)
% rspEntry->getBalance().getFullText()
% rspEntry->getLimit().getFullText()
% rspEntry->getLimitPeer().getFullText());
}
}
}
// XXX Flip argument order to norm.
// XXX Flip argument order to norm. (currency, issuer)
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()))
@@ -533,8 +554,10 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax
TER terResult;
try {
LedgerEntrySet lesSandbox(lesActive.duplicate());
terResult = RippleCalc::rippleCalc(
lesActive,
lesSandbox,
saMaxAmountAct,
saDstAmountAct,
vpsExpanded,