From b9f1b0562555f2ee25aff1ad103ea545d8bb66d8 Mon Sep 17 00:00:00 2001 From: Tom Ritchford Date: Wed, 25 Jun 2014 20:19:16 +0000 Subject: [PATCH] Use swapWith to save CPU; edit comment. --- src/ripple_app/paths/RippleCalc.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/ripple_app/paths/RippleCalc.cpp b/src/ripple_app/paths/RippleCalc.cpp index 6967c65aa..f5264d3bc 100644 --- a/src/ripple_app/paths/RippleCalc.cpp +++ b/src/ripple_app/paths/RippleCalc.cpp @@ -2617,7 +2617,7 @@ TER RippleCalc::rippleCalc ( while (temUNCERTAIN == terResult) { int iBest = -1; - const LedgerEntrySet lesCheckpoint = activeLedger; + LedgerEntrySet lesCheckpoint = activeLedger; int iDry = 0; // True, if ever computed multi-quality. @@ -2821,11 +2821,8 @@ TER RippleCalc::rippleCalc ( { // We must restore the activeLedger from lesCheckpoint in the case // when iBest is -1 and just before the result is set to tesSUCCESS. - // There was an issue when not on the first increment and there was - // no best path, where we did not restore the ledger to the last - // checkpoint. - activeLedger = lesCheckpoint.duplicate (); + activeLedger.swapWith (lesCheckpoint); terResult = tesSUCCESS; } }