diff --git a/src/cpp/ripple/Ledger.cpp b/src/cpp/ripple/Ledger.cpp index 26200b78e..a35155a2b 100644 --- a/src/cpp/ripple/Ledger.cpp +++ b/src/cpp/ripple/Ledger.cpp @@ -200,8 +200,8 @@ AccountState::pointer Ledger::getAccountState(const RippleAddress& accountID) // std::cerr << "Ledger:getAccountState(" << accountID.humanAccountID() << ")" << std::endl; #endif - SHAMapItem::pointer item = mAccountStateMap->peekItem(Ledger::getAccountRootIndex(accountID)); - if (!item) + SLE::pointer sle = getSLEi(Ledger::getAccountRootIndex(accountID)); + if (!sle) { cLog(lsDEBUG) << boost::str(boost::format("Ledger:getAccountState: not found: %s: %s") % accountID.humanAccountID() @@ -210,8 +210,6 @@ AccountState::pointer Ledger::getAccountState(const RippleAddress& accountID) return AccountState::pointer(); } - SerializedLedgerEntry::pointer sle = - boost::make_shared(item->peekSerializer(), item->getTag()); if (sle->getType() != ltACCOUNT_ROOT) return AccountState::pointer(); @@ -957,6 +955,9 @@ SLE::pointer Ledger::getSLE(const uint256& uHash) SLE::pointer Ledger::getSLEi(const uint256& uId) { uint256 hash; + + ScopedLock sl(mAccountStateMap->Lock()); + SHAMapItem::pointer node = mAccountStateMap->peekItem(uId, hash); if (!node) return SLE::pointer(); diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index e459457c8..43ecc7160 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -899,7 +899,7 @@ Json::Value RPCHandler::doAccountLines(Json::Value jvRequest) if (!lpLedger) return jvResult; - ScopedUnlock su(theApp->getMasterLock(), lpLedger->isFixed()); + ScopedUnlock su(theApp->getMasterLock()); if (!jvRequest.isMember("account")) return rpcError(rpcINVALID_PARAMS); @@ -980,7 +980,7 @@ Json::Value RPCHandler::doAccountOffers(Json::Value jvRequest) if (!lpLedger) return jvResult; - ScopedUnlock su(theApp->getMasterLock(), lpLedger->isClosed() || lpLedger->isImmutable()); + ScopedUnlock su(theApp->getMasterLock()); if (!jvRequest.isMember("account")) return rpcError(rpcINVALID_PARAMS);