From ecf0a9e894fb939217e74830e622d31d0272fd81 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Wed, 6 Mar 2013 03:58:13 -0800 Subject: [PATCH] Fix a major pathfinding bug. This improves pathfinding performance by a factor of three, fixes many invalid paths and fixes redundant paths. --- src/cpp/ripple/Pathfinder.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cpp/ripple/Pathfinder.cpp b/src/cpp/ripple/Pathfinder.cpp index d42e58ac8..1426d5e3b 100644 --- a/src/cpp/ripple/Pathfinder.cpp +++ b/src/cpp/ripple/Pathfinder.cpp @@ -413,7 +413,12 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax RippleState* rspEntry = (RippleState*) item.get(); const uint160& uPeerID = rspEntry->getAccountIDPeer(); - if (spPath.hasSeen(uPeerID, speEnd.mCurrencyID, uPeerID)) + if (speEnd.mCurrencyID != rspEntry->getLimit().getCurrency()) + { + // wrong currency + nothing(); + } + else if (spPath.hasSeen(uPeerID, speEnd.mCurrencyID, uPeerID)) { // Peer is in path already. Ignore it to avoid a loop. cLog(lsTRACE) <<