mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-01 16:35:53 +00:00
Make getAccountState use getSLEi.
Make getSLEi work against a mutex ledger without holding a master lock.
This commit is contained in:
@@ -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<SerializedLedgerEntry>(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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user