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

This commit is contained in:
Arthur Britto
2013-03-05 17:28:50 -08:00
3 changed files with 12 additions and 11 deletions

View File

@@ -411,7 +411,7 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax
BOOST_FOREACH(AccountItem::ref item, rippleLines.getItems())
{
RippleState* rspEntry = (RippleState*) item.get();
const uint160 uPeerID = rspEntry->getAccountIDPeer();
const uint160& uPeerID = rspEntry->getAccountIDPeer();
if (spPath.hasSeen(uPeerID, speEnd.mCurrencyID, uPeerID))
{
@@ -425,7 +425,7 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax
}
else if (!rspEntry->getBalance().isPositive() // No IOUs to send.
&& (!rspEntry->getLimitPeer() // Peer does not extend credit.
|| *rspEntry->getBalance().negate() >= rspEntry->getLimitPeer() // No credit left.
|| -rspEntry->getBalance() >= rspEntry->getLimitPeer() // No credit left.
|| (bRequireAuth && !rspEntry->getAuth()))) // Not authorized to hold credit.
{
// Path has no credit left. Ignore it.
@@ -469,7 +469,8 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax
{
// A book we haven't seen before. Add it.
STPath spNew(spPath);
STPathElement speBook(ACCOUNT_XRP, book->getCurrencyOut(), book->getIssuerOut());
STPathElement speBook(ACCOUNT_XRP, book->getCurrencyOut(), book->getIssuerOut(),
book->getCurrencyIn() != book->getCurrencyOut());
spNew.mPath.push_back(speBook); // Add the order book.
@@ -701,7 +702,7 @@ boost::unordered_set<uint160> usAccountSourceCurrencies(const RippleAddress& raA
// Filter out non
if (saBalance.isPositive() // Have IOUs to send.
|| (rspEntry->getLimitPeer() // Peer extends credit.
&& *saBalance.negate() < rspEntry->getLimitPeer())) // Credit left.
&& -saBalance < rspEntry->getLimitPeer())) // Credit left.
{
usCurrencies.insert(saBalance.getCurrency());
}

View File

@@ -233,7 +233,7 @@ TER PathState::pushNode(
STAmount saOwed = lesEntries.rippleOwed(pnCur.uAccountID, pnBck.uAccountID, pnCur.uCurrencyID);
if (!saOwed.isPositive() && *saOwed.negate() >= lesEntries.rippleLimit(pnCur.uAccountID, pnBck.uAccountID, pnCur.uCurrencyID))
if (!saOwed.isPositive() && -saOwed >= lesEntries.rippleLimit(pnCur.uAccountID, pnBck.uAccountID, pnCur.uCurrencyID))
{
terResult = tecPATH_DRY;
}

View File

@@ -364,14 +364,14 @@ public:
bool isGEZero() const { return !mIsNegative; }
operator bool() const { return !isZero(); }
STAmount* negate() { if (!isZero()) mIsNegative = !mIsNegative; return this; }
STAmount* zero() { mOffset = mIsNative ? 0 : -100; mValue = 0; mIsNegative = false; return this; }
void negate() { if (!isZero()) mIsNegative = !mIsNegative; }
void zero() { mOffset = mIsNative ? 0 : -100; mValue = 0; mIsNegative = false; }
// Zero while copying currency and issuer.
STAmount* zero(const STAmount& saTmpl)
{ mCurrency = saTmpl.mCurrency; mIssuer = saTmpl.mIssuer; mIsNative = saTmpl.mIsNative; return zero(); }
STAmount* zero(const uint160& uCurrencyID, const uint160& uIssuerID)
{ mCurrency = uCurrencyID; mIssuer = uIssuerID; mIsNative = !uCurrencyID; return zero(); }
void zero(const STAmount& saTmpl)
{ mCurrency = saTmpl.mCurrency; mIssuer = saTmpl.mIssuer; mIsNative = saTmpl.mIsNative; zero(); }
void zero(const uint160& uCurrencyID, const uint160& uIssuerID)
{ mCurrency = uCurrencyID; mIssuer = uIssuerID; mIsNative = !uCurrencyID; zero(); }
int compare(const STAmount&) const;