From a8794de98715cea70487a3356b8817de567d1245 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Tue, 16 Jul 2013 15:53:56 -0700 Subject: [PATCH 1/4] Check the correct account's auth required flag --- src/cpp/ripple/ripple_Pathfinder.cpp | 15 ++++++++++----- src/cpp/ripple/ripple_Pathfinder.h | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/cpp/ripple/ripple_Pathfinder.cpp b/src/cpp/ripple/ripple_Pathfinder.cpp index d81091a72e..a2fa47d717 100644 --- a/src/cpp/ripple/ripple_Pathfinder.cpp +++ b/src/cpp/ripple/ripple_Pathfinder.cpp @@ -508,10 +508,12 @@ bool Pathfinder::findPaths (const unsigned int iMaxSteps, const unsigned int iMa else { // save this candidate - int out = getPathsOut (speEnd.mCurrencyID, uPeerID, bRequireAuth, dstCurrency, mDstAccountID); + int out = getPathsOut (speEnd.mCurrencyID, uPeerID, dstCurrency, mDstAccountID); 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, - bool authRequired, bool isDstCurrency, const uint160& dstAccount) + bool isDstCurrency, const uint160& dstAccount) { #ifdef C11X std::pair accountCurrency (currencyID, accountID); @@ -815,6 +817,9 @@ int Pathfinder::getPathsOut (const uint160& currencyID, const uint160& accountID if (it != mPOMap.end ()) return it->second; + int aFlags = mLedger->getSLEi(Ledger::getAccountRootIndex(accountID))->getFieldU32(sfFlags); + bool bAuthRequired = aFlags & lsfRequireAuth; + int count = 0; AccountItems& rippleLines (mRLCache->getRippleLines (accountID)); 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 () && (!rspEntry->getLimitPeer () || -rspEntry->getBalance () >= rspEntry->getLimitPeer () - || (authRequired && !rspEntry->getAuth ()))) + || (bAuthRequired && !rspEntry->getAuth ()))) nothing (); 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 ++count; } diff --git a/src/cpp/ripple/ripple_Pathfinder.h b/src/cpp/ripple/ripple_Pathfinder.h index a706bcc433..9a5f03ba89 100644 --- a/src/cpp/ripple/ripple_Pathfinder.h +++ b/src/cpp/ripple/ripple_Pathfinder.h @@ -62,7 +62,7 @@ private: bool matchesOrigin (const uint160& currency, const uint160& issuer); int getPathsOut (const uint160& currency, const uint160& accountID, - bool isAuthRequired, bool isDestCurrency, const uint160& dest); + bool isDestCurrency, const uint160& dest); private: uint160 mSrcAccountID; From af1fb12962dc4e2530b5f5cf6f2feb488da540fb Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Tue, 16 Jul 2013 16:02:43 -0700 Subject: [PATCH 2/4] Fix for auth required blocking payments. --- src/cpp/ripple/ripple_PathState.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cpp/ripple/ripple_PathState.cpp b/src/cpp/ripple/ripple_PathState.cpp index 9f9c2ae95b..5b3a4cf056 100644 --- a/src/cpp/ripple/ripple_PathState.cpp +++ b/src/cpp/ripple/ripple_PathState.cpp @@ -295,8 +295,9 @@ TER PathState::pushNode ( terResult = terNO_ACCOUNT; } - else if (isSetBit (sleBck->getFieldU32 (sfFlags), lsfRequireAuth) + else if ((isSetBit (sleBck->getFieldU32 (sfFlags), lsfRequireAuth) && !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."; From 92f56aa2e1467483dba48ac6df9f614b4aa8c1d3 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Tue, 16 Jul 2013 21:43:36 -0700 Subject: [PATCH 3/4] Fix race condition rotating log files. --- modules/ripple_basics/utility/ripple_Log.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/ripple_basics/utility/ripple_Log.cpp b/modules/ripple_basics/utility/ripple_Log.cpp index 348d252329..06e71dd6f0 100644 --- a/modules/ripple_basics/utility/ripple_Log.cpp +++ b/modules/ripple_basics/utility/ripple_Log.cpp @@ -145,6 +145,8 @@ void Log::print (std::string const& text, bool toStdErr) std::string Log::rotateLog () { + boost::recursive_mutex::scoped_lock sl (s_lock); + bool const wasOpened = s_logFile.closeAndReopen (); if (wasOpened) From 335f2e6b3e002ed5543add388c590b6390bd8537 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Wed, 17 Jul 2013 06:52:00 -0700 Subject: [PATCH 4/4] Should not be a warning --- src/cpp/ripple/OfferCancelTransactor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/ripple/OfferCancelTransactor.cpp b/src/cpp/ripple/OfferCancelTransactor.cpp index a623ae2109..d61a95206e 100644 --- a/src/cpp/ripple/OfferCancelTransactor.cpp +++ b/src/cpp/ripple/OfferCancelTransactor.cpp @@ -36,7 +36,7 @@ TER OfferCancelTransactor::doApply () if (sleOffer) { - WriteLog (lsWARNING, OfferCancelTransactor) << "OfferCancel: uOfferSequence=" << uOfferSequence; + WriteLog (lsDEBUG, OfferCancelTransactor) << "OfferCancel: uOfferSequence=" << uOfferSequence; terResult = mEngine->getNodes ().offerDelete (sleOffer, uOfferIndex, mTxnAccountID); }