Accelerated 'ledger' command.

This commit is contained in:
JoelKatz
2013-02-21 10:09:40 -08:00
parent 2e12ffac57
commit 7300e803ae
2 changed files with 3 additions and 0 deletions

View File

@@ -817,6 +817,7 @@ Json::Value Ledger::getJson(int options)
{ {
Json::Value txns(Json::arrayValue); Json::Value txns(Json::arrayValue);
SHAMapTreeNode::TNType type; SHAMapTreeNode::TNType type;
ScopedLock l(mTransactionMap->Lock());
for (SHAMapItem::pointer item = mTransactionMap->peekFirstItem(type); !!item; for (SHAMapItem::pointer item = mTransactionMap->peekFirstItem(type); !!item;
item = mTransactionMap->peekNextItem(item->getTag(), type)) 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))) if (mAccountStateMap && (bFull || ((options & LEDGER_JSON_DUMP_STATE) != 0)))
{ {
Json::Value state(Json::arrayValue); Json::Value state(Json::arrayValue);
ScopedLock l(mAccountStateMap->Lock());
for (SHAMapItem::pointer item = mAccountStateMap->peekFirstItem(); !!item; for (SHAMapItem::pointer item = mAccountStateMap->peekFirstItem(); !!item;
item = mAccountStateMap->peekNextItem(item->getTag())) item = mAccountStateMap->peekNextItem(item->getTag()))
{ {

View File

@@ -1526,6 +1526,7 @@ Json::Value RPCHandler::doLedger(Json::Value jvRequest)
Json::Value ret(Json::objectValue); Json::Value ret(Json::objectValue);
ScopedUnlock(theApp->getMasterLock());
ledger->addJson(ret, full ? LEDGER_JSON_FULL : 0); ledger->addJson(ret, full ? LEDGER_JSON_FULL : 0);
return ret; return ret;