Merge branch 'hotfix-pf' into develop

This commit is contained in:
JoelKatz
2013-07-17 13:47:05 -07:00
5 changed files with 16 additions and 8 deletions

View File

@@ -145,6 +145,8 @@ void Log::print (std::string const& text, bool toStdErr)
std::string Log::rotateLog () std::string Log::rotateLog ()
{ {
boost::recursive_mutex::scoped_lock sl (s_lock);
bool const wasOpened = s_logFile.closeAndReopen (); bool const wasOpened = s_logFile.closeAndReopen ();
if (wasOpened) if (wasOpened)

View File

@@ -36,7 +36,7 @@ TER OfferCancelTransactor::doApply ()
if (sleOffer) if (sleOffer)
{ {
WriteLog (lsWARNING, OfferCancelTransactor) << "OfferCancel: uOfferSequence=" << uOfferSequence; WriteLog (lsDEBUG, OfferCancelTransactor) << "OfferCancel: uOfferSequence=" << uOfferSequence;
terResult = mEngine->getNodes ().offerDelete (sleOffer, uOfferIndex, mTxnAccountID); terResult = mEngine->getNodes ().offerDelete (sleOffer, uOfferIndex, mTxnAccountID);
} }

View File

@@ -295,8 +295,9 @@ TER PathState::pushNode (
terResult = terNO_ACCOUNT; terResult = terNO_ACCOUNT;
} }
else if (isSetBit (sleBck->getFieldU32 (sfFlags), lsfRequireAuth) else if ((isSetBit (sleBck->getFieldU32 (sfFlags), lsfRequireAuth)
&& !isSetBit (sleRippleState->getFieldU32 (sfFlags), (bHigh ? lsfHighAuth : lsfLowAuth))) && !isSetBit (sleRippleState->getFieldU32 (sfFlags), (bHigh ? lsfHighAuth : lsfLowAuth)))
&& sleRippleState->getFieldAmount(sfBalance).isZero()) // CHECKME
{ {
WriteLog (lsWARNING, RippleCalc) << "pushNode: delay: can't receive IOUs from issuer without auth."; WriteLog (lsWARNING, RippleCalc) << "pushNode: delay: can't receive IOUs from issuer without auth.";

View File

@@ -508,10 +508,12 @@ bool Pathfinder::findPaths (const unsigned int iMaxSteps, const unsigned int iMa
else else
{ {
// save this candidate // save this candidate
int out = getPathsOut (speEnd.mCurrencyID, uPeerID, bRequireAuth, dstCurrency, mDstAccountID); int out = getPathsOut (speEnd.mCurrencyID, uPeerID, dstCurrency, mDstAccountID);
if (out != 0) if (out != 0)
candidates.push_back (std::make_pair (out, uPeerID)); candidates.push_back (std::make_pair (out, uPeerID));
else
WriteLog(lsTRACE, Pathfinder) << "findPaths: " << RippleAddress::createHumanAccountID(uPeerID) << " has no paths out";
} }
} }
@@ -803,7 +805,7 @@ bool Pathfinder::matchesOrigin (const uint160& currency, const uint160& issuer)
} }
int Pathfinder::getPathsOut (const uint160& currencyID, const uint160& accountID, int Pathfinder::getPathsOut (const uint160& currencyID, const uint160& accountID,
bool authRequired, bool isDstCurrency, const uint160& dstAccount) bool isDstCurrency, const uint160& dstAccount)
{ {
#ifdef C11X #ifdef C11X
std::pair<const uint160&, const uint160&> accountCurrency (currencyID, accountID); std::pair<const uint160&, const uint160&> accountCurrency (currencyID, accountID);
@@ -815,6 +817,9 @@ int Pathfinder::getPathsOut (const uint160& currencyID, const uint160& accountID
if (it != mPOMap.end ()) if (it != mPOMap.end ())
return it->second; return it->second;
int aFlags = mLedger->getSLEi(Ledger::getAccountRootIndex(accountID))->getFieldU32(sfFlags);
bool bAuthRequired = aFlags & lsfRequireAuth;
int count = 0; int count = 0;
AccountItems& rippleLines (mRLCache->getRippleLines (accountID)); AccountItems& rippleLines (mRLCache->getRippleLines (accountID));
BOOST_FOREACH (AccountItem::ref item, rippleLines.getItems ()) BOOST_FOREACH (AccountItem::ref item, rippleLines.getItems ())
@@ -826,10 +831,10 @@ int Pathfinder::getPathsOut (const uint160& currencyID, const uint160& accountID
else if (!rspEntry->getBalance ().isPositive () && else if (!rspEntry->getBalance ().isPositive () &&
(!rspEntry->getLimitPeer () (!rspEntry->getLimitPeer ()
|| -rspEntry->getBalance () >= rspEntry->getLimitPeer () || -rspEntry->getBalance () >= rspEntry->getLimitPeer ()
|| (authRequired && !rspEntry->getAuth ()))) || (bAuthRequired && !rspEntry->getAuth ())))
nothing (); nothing ();
else if (isDstCurrency && (dstAccount == rspEntry->getAccountIDPeer ())) else if (isDstCurrency && (dstAccount == rspEntry->getAccountIDPeer ()))
count += 100; // count a path to the destination extra count += 10000; // count a path to the destination extra
else else
++count; ++count;
} }

View File

@@ -62,7 +62,7 @@ private:
bool matchesOrigin (const uint160& currency, const uint160& issuer); bool matchesOrigin (const uint160& currency, const uint160& issuer);
int getPathsOut (const uint160& currency, const uint160& accountID, int getPathsOut (const uint160& currency, const uint160& accountID,
bool isAuthRequired, bool isDestCurrency, const uint160& dest); bool isDestCurrency, const uint160& dest);
private: private:
uint160 mSrcAccountID; uint160 mSrcAccountID;