From 44883ab59c45b4d25384181962b83279e9a897e1 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Tue, 25 Jun 2013 17:20:02 -0700 Subject: [PATCH] Disable the JSON cache due to issue 99. --- src/cpp/ripple/RPCHandler.cpp | 62 +++++++++++------------------------ 1 file changed, 20 insertions(+), 42 deletions(-) diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index 991fe22357..395fc71d3c 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -1098,49 +1098,36 @@ Json::Value RPCHandler::doAccountLines (Json::Value params, LoadType* loadType, if (lpLedger->hasAccount (raAccount)) { jvResult["account"] = raAccount.humanAccountID (); + Json::Value& jsonLines = (jvResult["lines"] = Json::arrayValue); - boost::shared_ptr jvsLines = - theApp->getOPs ().getJSONCache (JSONCache::kindLines, lpLedger->getHash (), raAccount.getAccountID ()); + AccountItems rippleLines (raAccount.getAccountID (), lpLedger, AccountItem::pointer (new RippleState ())); - if (!jvsLines) + BOOST_FOREACH (AccountItem::ref item, rippleLines.getItems ()) { - jvsLines = boost::make_shared (Json::arrayValue); - Json::Value& jsonLines = *jvsLines; + RippleState* line = (RippleState*)item.get (); - AccountItems rippleLines (raAccount.getAccountID (), lpLedger, AccountItem::pointer (new RippleState ())); - - BOOST_FOREACH (AccountItem::ref item, rippleLines.getItems ()) + if (!raPeer.isValid () || raPeer.getAccountID () == line->getAccountIDPeer ()) { - RippleState* line = (RippleState*)item.get (); + const STAmount& saBalance = line->getBalance (); + const STAmount& saLimit = line->getLimit (); + const STAmount& saLimitPeer = line->getLimitPeer (); - if (!raPeer.isValid () || raPeer.getAccountID () == line->getAccountIDPeer ()) - { - const STAmount& saBalance = line->getBalance (); - const STAmount& saLimit = line->getLimit (); - const STAmount& saLimitPeer = line->getLimitPeer (); + Json::Value& jPeer = jsonLines.append (Json::objectValue); - Json::Value& jPeer = jsonLines.append (Json::objectValue); - - jPeer["account"] = RippleAddress::createHumanAccountID (line->getAccountIDPeer ()); - // Amount reported is positive if current account holds other account's IOUs. - // Amount reported is negative if other account holds current account's IOUs. - jPeer["balance"] = saBalance.getText (); - jPeer["currency"] = saBalance.getHumanCurrency (); - jPeer["limit"] = saLimit.getText (); - jPeer["limit_peer"] = saLimitPeer.getText (); - jPeer["quality_in"] = static_cast (line->getQualityIn ()); - jPeer["quality_out"] = static_cast (line->getQualityOut ()); - } + jPeer["account"] = RippleAddress::createHumanAccountID (line->getAccountIDPeer ()); + // Amount reported is positive if current account holds other account's IOUs. + // Amount reported is negative if other account holds current account's IOUs. + jPeer["balance"] = saBalance.getText (); + jPeer["currency"] = saBalance.getHumanCurrency (); + jPeer["limit"] = saLimit.getText (); + jPeer["limit_peer"] = saLimitPeer.getText (); + jPeer["quality_in"] = static_cast (line->getQualityIn ()); + jPeer["quality_out"] = static_cast (line->getQualityOut ()); } - - theApp->getOPs ().storeJSONCache (JSONCache::kindLines, lpLedger->getHash (), - raAccount.getAccountID (), jvsLines); } if (!bUnlocked) MasterLockHolder.unlock (); - - jvResult["lines"] = *jvsLines; } else { @@ -1208,21 +1195,12 @@ Json::Value RPCHandler::doAccountOffers (Json::Value params, LoadType* loadType, if (!lpLedger->hasAccount (raAccount)) return rpcError (rpcACT_NOT_FOUND); - boost::shared_ptr jvsOffers = - theApp->getOPs ().getJSONCache (JSONCache::kindOffers, lpLedger->getHash (), raAccount.getAccountID ()); - - if (!jvsOffers) - { - jvsOffers = boost::make_shared (Json::arrayValue); - lpLedger->visitAccountItems (raAccount.getAccountID (), BIND_TYPE (&offerAdder, boost::ref (*jvsOffers), P_1)); - theApp->getOPs ().storeJSONCache (JSONCache::kindOffers, lpLedger->getHash (), raAccount.getAccountID (), jvsOffers); - } + Json::Value& jvsOffers = (jvResult["offers"] = Json::arrayValue); + lpLedger->visitAccountItems (raAccount.getAccountID (), BIND_TYPE (&offerAdder, boost::ref (jvsOffers), P_1)); if (!bUnlocked) MasterLockHolder.unlock (); - jvResult["offers"] = *jvsOffers; - return jvResult; }