From 7300e803ae4242ea66a35c80040800748a40c9a1 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Thu, 21 Feb 2013 10:09:40 -0800 Subject: [PATCH] Accelerated 'ledger' command. --- src/cpp/ripple/Ledger.cpp | 2 ++ src/cpp/ripple/RPCHandler.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/src/cpp/ripple/Ledger.cpp b/src/cpp/ripple/Ledger.cpp index 5df54ae999..812e0d0a30 100644 --- a/src/cpp/ripple/Ledger.cpp +++ b/src/cpp/ripple/Ledger.cpp @@ -817,6 +817,7 @@ Json::Value Ledger::getJson(int options) { Json::Value txns(Json::arrayValue); SHAMapTreeNode::TNType type; + ScopedLock l(mTransactionMap->Lock()); for (SHAMapItem::pointer item = mTransactionMap->peekFirstItem(type); !!item; item = mTransactionMap->peekNextItem(item->getTag(), type)) { @@ -856,6 +857,7 @@ Json::Value Ledger::getJson(int options) if (mAccountStateMap && (bFull || ((options & LEDGER_JSON_DUMP_STATE) != 0))) { Json::Value state(Json::arrayValue); + ScopedLock l(mAccountStateMap->Lock()); for (SHAMapItem::pointer item = mAccountStateMap->peekFirstItem(); !!item; item = mAccountStateMap->peekNextItem(item->getTag())) { diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index 43ecc71607..68817cc97d 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -1526,6 +1526,7 @@ Json::Value RPCHandler::doLedger(Json::Value jvRequest) Json::Value ret(Json::objectValue); + ScopedUnlock(theApp->getMasterLock()); ledger->addJson(ret, full ? LEDGER_JSON_FULL : 0); return ret;