From 23eafaab8528b13aaf66419a3fdfe042ed9fbb35 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Tue, 21 May 2013 15:40:44 -0700 Subject: [PATCH] doAccountLines micro-optimization. --- src/cpp/ripple/RPCHandler.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index 0ec133cf74..a790dd4fa8 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -1071,9 +1071,6 @@ Json::Value RPCHandler::doAccountLines(Json::Value jvRequest, int& cost, ScopedL { jvResult["account"] = raAccount.humanAccountID(); - // XXX This is wrong, we do access the current ledger and do need to worry about changes. - // We access a committed ledger and need not worry about changes. - AccountItems rippleLines(raAccount.getAccountID(), lpLedger, AccountItem::pointer(new RippleState())); Json::Value& jsonLines = (jvResult["lines"] = Json::arrayValue); @@ -1083,9 +1080,9 @@ Json::Value RPCHandler::doAccountLines(Json::Value jvRequest, int& cost, ScopedL if (!raPeer.isValid() || raPeer.getAccountID() == line->getAccountIDPeer()) { - STAmount saBalance = line->getBalance(); - STAmount saLimit = line->getLimit(); - STAmount saLimitPeer = line->getLimitPeer(); + const STAmount& saBalance = line->getBalance(); + const STAmount& saLimit = line->getLimit(); + const STAmount& saLimitPeer = line->getLimitPeer(); Json::Value& jPeer = jsonLines.append(Json::objectValue); @@ -2610,6 +2607,7 @@ Json::Value RPCHandler::lookupLedger(Json::Value jvRequest, Ledger::pointer& lpL case LEDGER_CURRENT: lpLedger = mNetOps->getCurrentSnapshot(); iLedgerIndex = lpLedger->getLedgerSeq(); + assert(lpLedger->isImmutable() && !lpLedger->isClosed()); break; case LEDGER_CLOSED: