From 5928b3dcbfcb9a6f0bdfe98f7590d689f50e3651 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sun, 7 Apr 2013 23:34:37 -0700 Subject: [PATCH] Off by one error. Thank you unit tests. --- src/cpp/ripple/Pathfinder.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cpp/ripple/Pathfinder.cpp b/src/cpp/ripple/Pathfinder.cpp index 3943271e09..1118a2fb6f 100644 --- a/src/cpp/ripple/Pathfinder.cpp +++ b/src/cpp/ripple/Pathfinder.cpp @@ -481,10 +481,14 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax std::sort(candidates.begin(), candidates.end(), BIND_TYPE(candCmp, mLedger->getLedgerSeq(), P_1, P_2)); int count = candidates.size(); - if (count > 10) + + if (count > 30) count /= 3; + else if (count > 10) + count /= 2; + std::vector< std::pair >::iterator it = candidates.begin(); - while (--count != 0) + while (count-- != 0) { STPath spNew(spPath); STPathElement speNew(it->second, speEnd.mCurrencyID, it->second);