diff --git a/Builds/VisualStudio2012/RippleD.vcxproj b/Builds/VisualStudio2012/RippleD.vcxproj
index 2736a26f66..d43197f18d 100644
--- a/Builds/VisualStudio2012/RippleD.vcxproj
+++ b/Builds/VisualStudio2012/RippleD.vcxproj
@@ -1762,7 +1762,7 @@
-
+
diff --git a/Builds/VisualStudio2012/RippleD.vcxproj.filters b/Builds/VisualStudio2012/RippleD.vcxproj.filters
index d75c96911a..bde464967b 100644
--- a/Builds/VisualStudio2012/RippleD.vcxproj.filters
+++ b/Builds/VisualStudio2012/RippleD.vcxproj.filters
@@ -600,9 +600,6 @@
1. Modules\ripple_app\refactored
-
- 1. Modules\ripple_app\refactored
-
1. Modules\ripple_app\refactored
@@ -900,6 +897,9 @@
1. Modules\ripple_core\functional
+
+ 1. Modules\ripple_app\refactored
+
@@ -1409,9 +1409,6 @@
1. Modules\ripple_app\refactored
-
- 1. Modules\ripple_app\refactored
-
1. Modules\ripple_app\refactored
@@ -1725,6 +1722,9 @@
1. Modules\ripple_core\functional
+
+ 1. Modules\ripple_app\refactored
+
diff --git a/modules/ripple_app/ripple_app.cpp b/modules/ripple_app/ripple_app.cpp
index ba89ab17bf..5856c38bb2 100644
--- a/modules/ripple_app/ripple_app.cpp
+++ b/modules/ripple_app/ripple_app.cpp
@@ -135,7 +135,7 @@
#include "src/cpp/ripple/Ledger.h"
#include "src/cpp/ripple/SerializedValidation.h"
-#include "src/cpp/ripple/ripple_LoadManager.h"
+#include "src/cpp/ripple/ripple_ILoadManager.h"
// These have few dependencies
#include "src/cpp/ripple/ripple_DatabaseCon.h"
diff --git a/modules/ripple_client/ripple_client.cpp b/modules/ripple_client/ripple_client.cpp
index e4d438f9c5..e626a4d7a2 100644
--- a/modules/ripple_client/ripple_client.cpp
+++ b/modules/ripple_client/ripple_client.cpp
@@ -10,6 +10,7 @@
@ingroup ripple_client
*/
+/*
#include
#include
@@ -22,6 +23,8 @@
#include "../ripple_data/ripple_data.h"
+*/
+
/*
#include "src/cpp/ripple/ripple_InfoSub.h"
@@ -44,7 +47,7 @@
#include "src/cpp/ripple/Ledger.h"
#include "src/cpp/ripple/ripple_LedgerEntrySet.h"
#include "src/cpp/ripple/TransactionEngine.h"
-#include "src/cpp/ripple/ripple_LoadManager.h"
+#include "src/cpp/ripple/ripple_ILoadManager.h"
#include "src/cpp/ripple/ripple_Peer.h"
#include "src/cpp/ripple/ripple_PeerSet.h"
#include "src/cpp/ripple/ripple_InboundLedger.h"
diff --git a/src/cpp/ripple/NetworkOPs.cpp b/src/cpp/ripple/NetworkOPs.cpp
index 0ffd9e0fa5..a9e7f51965 100644
--- a/src/cpp/ripple/NetworkOPs.cpp
+++ b/src/cpp/ripple/NetworkOPs.cpp
@@ -616,6 +616,9 @@ void NetworkOPs::checkState (const boost::system::error_code& result)
if ((result == boost::asio::error::operation_aborted) || theConfig.RUN_STANDALONE)
{
+ // VFALCO NOTE Should never get here. This is probably dead code.
+ // If RUN_STANDALONE is set then this function isn't called.
+ //
WriteLog (lsFATAL, NetworkOPs) << "Network state timer error: " << result;
return;
}
@@ -623,7 +626,7 @@ void NetworkOPs::checkState (const boost::system::error_code& result)
{
ScopedLock sl (theApp->getMasterLock ());
- theApp->getLoadManager ().noDeadLock ();
+ theApp->getLoadManager ().resetDeadlockDetector ();
std::vector peerList = theApp->getPeers ().getPeerVector ();
diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp
index f333559719..991fe22357 100644
--- a/src/cpp/ripple/RPCHandler.cpp
+++ b/src/cpp/ripple/RPCHandler.cpp
@@ -10,21 +10,17 @@
SETUP_LOG (RPCHandler)
-static const int rpcCOST_DEFAULT = 10;
-static const int rpcCOST_EXCEPTION = 20;
-static const int rpcCOST_EXPENSIVE = 50;
-
-int iAdminGet (const Json::Value& jvRequest, const std::string& strRemoteIp)
+int iAdminGet (const Json::Value& params, const std::string& strRemoteIp)
{
int iRole;
- bool bPasswordSupplied = jvRequest.isMember ("admin_user") || jvRequest.isMember ("admin_password");
+ bool bPasswordSupplied = params.isMember ("admin_user") || params.isMember ("admin_password");
bool bPasswordRequired = !theConfig.RPC_ADMIN_USER.empty () || !theConfig.RPC_ADMIN_PASSWORD.empty ();
bool bPasswordWrong = bPasswordSupplied
? bPasswordRequired
// Supplied, required, and incorrect.
- ? theConfig.RPC_ADMIN_USER != (jvRequest.isMember ("admin_user") ? jvRequest["admin_user"].asString () : "")
- || theConfig.RPC_ADMIN_PASSWORD != (jvRequest.isMember ("admin_user") ? jvRequest["admin_password"].asString () : "")
+ ? theConfig.RPC_ADMIN_USER != (params.isMember ("admin_user") ? params["admin_user"].asString () : "")
+ || theConfig.RPC_ADMIN_PASSWORD != (params.isMember ("admin_user") ? params["admin_password"].asString () : "")
// Supplied and not required.
: true
: false;
@@ -32,7 +28,7 @@ int iAdminGet (const Json::Value& jvRequest, const std::string& strRemoteIp)
bool bAdminIP = false;
BOOST_FOREACH (const std::string & strAllowIp, theConfig.RPC_ADMIN_ALLOW)
-{
+ {
if (strAllowIp == strRemoteIp)
bAdminIP = true;
}
@@ -62,28 +58,28 @@ RPCHandler::RPCHandler (NetworkOPs* netOps, InfoSub::pointer infoSub) : mNetOps
;
}
-Json::Value RPCHandler::transactionSign (Json::Value jvRequest, bool bSubmit, bool bFailHard, ScopedLock& mlh)
+Json::Value RPCHandler::transactionSign (Json::Value params, bool bSubmit, bool bFailHard, ScopedLock& mlh)
{
Json::Value jvResult;
RippleAddress naSeed;
RippleAddress raSrcAddressID;
- bool bOffline = jvRequest.isMember ("offline") && jvRequest["offline"].asBool ();
+ bool bOffline = params.isMember ("offline") && params["offline"].asBool ();
- WriteLog (lsDEBUG, RPCHandler) << boost::str (boost::format ("transactionSign: %s") % jvRequest);
+ WriteLog (lsDEBUG, RPCHandler) << boost::str (boost::format ("transactionSign: %s") % params);
- if (!jvRequest.isMember ("secret") || !jvRequest.isMember ("tx_json"))
+ if (!params.isMember ("secret") || !params.isMember ("tx_json"))
{
return rpcError (rpcINVALID_PARAMS);
}
- Json::Value txJSON = jvRequest["tx_json"];
+ Json::Value txJSON = params["tx_json"];
if (!txJSON.isObject ())
{
return rpcError (rpcINVALID_PARAMS);
}
- if (!naSeed.setSeedGeneric (jvRequest["secret"].asString ()))
+ if (!naSeed.setSeedGeneric (params["secret"].asString ()))
{
return rpcError (rpcBAD_SEED);
}
@@ -137,13 +133,13 @@ Json::Value RPCHandler::transactionSign (Json::Value jvRequest, bool bSubmit, bo
txJSON["Fee"] = (int) theConfig.FEE_DEFAULT;
}
- if (txJSON.isMember ("Paths") && jvRequest.isMember ("build_path"))
+ if (txJSON.isMember ("Paths") && params.isMember ("build_path"))
{
// Asking to build a path when providing one is an error.
return rpcError (rpcINVALID_PARAMS);
}
- if (!txJSON.isMember ("Paths") && txJSON.isMember ("Amount") && jvRequest.isMember ("build_path"))
+ if (!txJSON.isMember ("Paths") && txJSON.isMember ("Amount") && params.isMember ("build_path"))
{
// Need a ripple path.
STPathSet spsPaths;
@@ -241,7 +237,7 @@ Json::Value RPCHandler::transactionSign (Json::Value jvRequest, bool bSubmit, bo
bool bHaveAuthKey = false;
RippleAddress naAuthorizedPublic;
- RippleAddress naSecret = RippleAddress::createSeedGeneric (jvRequest["secret"].asString ());
+ RippleAddress naSecret = RippleAddress::createSeedGeneric (params["secret"].asString ());
RippleAddress naMasterGenerator = RippleAddress::createGeneratorPublic (naSecret);
// Find the index of Account from the master generator, so we can generate the public and private keys.
@@ -316,7 +312,7 @@ Json::Value RPCHandler::transactionSign (Json::Value jvRequest, bool bSubmit, bo
return jvResult;
}
- if (jvRequest.isMember ("debug_signing"))
+ if (params.isMember ("debug_signing"))
{
jvResult["tx_unsigned"] = strHex (stpTrans->getSerializer ().peekData ());
jvResult["tx_signing_hash"] = stpTrans->getSigningHash ().ToString ();
@@ -592,21 +588,21 @@ Json::Value RPCHandler::accountFromString (Ledger::ref lrLedger, RippleAddress&
// ledger_hash :
// ledger_index :
// }
-Json::Value RPCHandler::doAccountInfo (Json::Value jvRequest, int& cost, ScopedLock& MasterLockHolder)
+Json::Value RPCHandler::doAccountInfo (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
{
Ledger::pointer lpLedger;
- Json::Value jvResult = lookupLedger (jvRequest, lpLedger);
+ Json::Value jvResult = lookupLedger (params, lpLedger);
if (!lpLedger)
return jvResult;
- if (!jvRequest.isMember ("account") && !jvRequest.isMember ("ident"))
+ if (!params.isMember ("account") && !params.isMember ("ident"))
return rpcError (rpcINVALID_PARAMS);
- std::string strIdent = jvRequest.isMember ("account") ? jvRequest["account"].asString () : jvRequest["ident"].asString ();
+ std::string strIdent = params.isMember ("account") ? params["account"].asString () : params["ident"].asString ();
bool bIndex;
- int iIndex = jvRequest.isMember ("account_index") ? jvRequest["account_index"].asUInt () : 0;
- bool bStrict = jvRequest.isMember ("strict") && jvRequest["strict"].asBool ();
+ int iIndex = params.isMember ("account_index") ? params["account_index"].asUInt () : 0;
+ bool bStrict = params.isMember ("strict") && params["strict"].asBool ();
RippleAddress naAccount;
// Get info on account.
@@ -637,16 +633,16 @@ Json::Value RPCHandler::doAccountInfo (Json::Value jvRequest, int& cost, ScopedL
// port:
// }
// XXX Might allow domain for manual connections.
-Json::Value RPCHandler::doConnect (Json::Value jvRequest, int& cost, ScopedLock& MasterLockHolder)
+Json::Value RPCHandler::doConnect (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
{
if (theConfig.RUN_STANDALONE)
return "cannot connect in standalone mode";
- if (!jvRequest.isMember ("ip"))
+ if (!params.isMember ("ip"))
return rpcError (rpcINVALID_PARAMS);
- std::string strIp = jvRequest["ip"].asString ();
- int iPort = jvRequest.isMember ("port") ? jvRequest["port"].asInt () : -1;
+ std::string strIp = params["ip"].asString ();
+ int iPort = params.isMember ("port") ? params["port"].asInt () : -1;
// XXX Validate legal IP and port
theApp->getPeers ().connectTo (strIp, iPort);
@@ -658,12 +654,12 @@ Json::Value RPCHandler::doConnect (Json::Value jvRequest, int& cost, ScopedLock&
// {
// key:
// }
-Json::Value RPCHandler::doDataDelete (Json::Value jvRequest, int& cost, ScopedLock& MasterLockHolder)
+Json::Value RPCHandler::doDataDelete (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
{
- if (!jvRequest.isMember ("key"))
+ if (!params.isMember ("key"))
return rpcError (rpcINVALID_PARAMS);
- std::string strKey = jvRequest["key"].asString ();
+ std::string strKey = params["key"].asString ();
Json::Value ret = Json::Value (Json::objectValue);
@@ -684,12 +680,12 @@ Json::Value RPCHandler::doDataDelete (Json::Value jvRequest, int& cost, ScopedLo
// {
// key:
// }
-Json::Value RPCHandler::doDataFetch (Json::Value jvRequest, int& cost, ScopedLock& MasterLockHolder)
+Json::Value RPCHandler::doDataFetch (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
{
- if (!jvRequest.isMember ("key"))
+ if (!params.isMember ("key"))
return rpcError (rpcINVALID_PARAMS);
- std::string strKey = jvRequest["key"].asString ();
+ std::string strKey = params["key"].asString ();
std::string strValue;
Json::Value ret = Json::Value (Json::objectValue);
@@ -708,14 +704,14 @@ Json::Value RPCHandler::doDataFetch (Json::Value jvRequest, int& cost, ScopedLoc
// key:
// value:
// }
-Json::Value RPCHandler::doDataStore (Json::Value jvRequest, int& cost, ScopedLock& MasterLockHolder)
+Json::Value RPCHandler::doDataStore (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
{
- if (!jvRequest.isMember ("key")
- || !jvRequest.isMember ("value"))
+ if (!params.isMember ("key")
+ || !params.isMember ("value"))
return rpcError (rpcINVALID_PARAMS);
- std::string strKey = jvRequest["key"].asString ();
- std::string strValue = jvRequest["value"].asString ();
+ std::string strKey = params["key"].asString ();
+ std::string strValue = params["value"].asString ();
Json::Value ret = Json::Value (Json::objectValue);
@@ -769,14 +765,14 @@ Json::Value RPCHandler::doNicknameInfo (Json::Value params)
// 'account_index' : // optional
// }
// XXX This would be better if it took the ledger.
-Json::Value RPCHandler::doOwnerInfo (Json::Value jvRequest, int& cost, ScopedLock& MasterLockHolder)
+Json::Value RPCHandler::doOwnerInfo (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
{
- if (!jvRequest.isMember ("account") && !jvRequest.isMember ("ident"))
+ if (!params.isMember ("account") && !params.isMember ("ident"))
return rpcError (rpcINVALID_PARAMS);
- std::string strIdent = jvRequest.isMember ("account") ? jvRequest["account"].asString () : jvRequest["ident"].asString ();
+ std::string strIdent = params.isMember ("account") ? params["account"].asString () : params["ident"].asString ();
bool bIndex;
- int iIndex = jvRequest.isMember ("account_index") ? jvRequest["account_index"].asUInt () : 0;
+ int iIndex = params.isMember ("account_index") ? params["account_index"].asUInt () : 0;
RippleAddress raAccount;
Json::Value ret;
@@ -794,7 +790,7 @@ Json::Value RPCHandler::doOwnerInfo (Json::Value jvRequest, int& cost, ScopedLoc
return ret;
}
-Json::Value RPCHandler::doPeers (Json::Value, int& cost, ScopedLock& MasterLockHolder)
+Json::Value RPCHandler::doPeers (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
{
Json::Value jvResult (Json::objectValue);
@@ -803,7 +799,7 @@ Json::Value RPCHandler::doPeers (Json::Value, int& cost, ScopedLock& MasterLockH
return jvResult;
}
-Json::Value RPCHandler::doPing (Json::Value, int& cost, ScopedLock& MasterLockHolder)
+Json::Value RPCHandler::doPing (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
{
return Json::Value (Json::objectValue);
}
@@ -813,10 +809,10 @@ Json::Value RPCHandler::doPing (Json::Value, int& cost, ScopedLock& MasterLockHo
// issuer is the offering account
// --> submit: 'submit|true|false': defaults to false
// Prior to running allow each to have a credit line of what they will be getting from the other account.
-Json::Value RPCHandler::doProfile (Json::Value jvRequest, int& cost, ScopedLock& MasterLockHolder)
+Json::Value RPCHandler::doProfile (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
{
/* need to fix now that sharedOfferCreate is gone
- int iArgs = jvRequest.size();
+ int iArgs = params.size();
RippleAddress naSeedA;
RippleAddress naAccountA;
uint160 uCurrencyOfferA;
@@ -826,26 +822,26 @@ Json::Value RPCHandler::doProfile (Json::Value jvRequest, int& cost, ScopedLock&
uint32 iCount = 100;
bool bSubmit = false;
- if (iArgs < 6 || "offers" != jvRequest[0u].asString())
+ if (iArgs < 6 || "offers" != params[0u].asString())
{
return rpcError(rpcINVALID_PARAMS);
}
- if (!naSeedA.setSeedGeneric(jvRequest[1u].asString())) //
+ if (!naSeedA.setSeedGeneric(params[1u].asString())) //
return rpcError(rpcINVALID_PARAMS);
- naAccountA.setAccountID(jvRequest[2u].asString()); //
+ naAccountA.setAccountID(params[2u].asString()); //
- if (!STAmount::currencyFromString(uCurrencyOfferA, jvRequest[3u].asString())) //
+ if (!STAmount::currencyFromString(uCurrencyOfferA, params[3u].asString())) //
return rpcError(rpcINVALID_PARAMS);
- naAccountB.setAccountID(jvRequest[4u].asString()); //
- if (!STAmount::currencyFromString(uCurrencyOfferB, jvRequest[5u].asString())) //
+ naAccountB.setAccountID(params[4u].asString()); //
+ if (!STAmount::currencyFromString(uCurrencyOfferB, params[5u].asString())) //
return rpcError(rpcINVALID_PARAMS);
- iCount = lexical_cast_s(jvRequest[6u].asString());
+ iCount = lexical_cast_s(params[6u].asString());
- if (iArgs >= 8 && "false" != jvRequest[7u].asString())
+ if (iArgs >= 8 && "false" != params[7u].asString())
bSubmit = true;
Log::setMinSeverity(lsFATAL,true);
@@ -905,24 +901,24 @@ Json::Value RPCHandler::doProfile (Json::Value jvRequest, int& cost, ScopedLock&
// difficulty: // optional
// secret: // optional
// }
-Json::Value RPCHandler::doProofCreate (Json::Value jvRequest, int& cost, ScopedLock& MasterLockHolder)
+Json::Value RPCHandler::doProofCreate (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
{
MasterLockHolder.unlock ();
// XXX: Add ability to create proof with arbitrary time
Json::Value jvResult (Json::objectValue);
- if (jvRequest.isMember ("difficulty") || jvRequest.isMember ("secret"))
+ if (params.isMember ("difficulty") || params.isMember ("secret"))
{
// VFALCO TODO why aren't we using the app's factory?
beast::ScopedPointer pgGen (IProofOfWorkFactory::New ());
- if (jvRequest.isMember ("difficulty"))
+ if (params.isMember ("difficulty"))
{
- if (!jvRequest["difficulty"].isIntegral ())
+ if (!params["difficulty"].isIntegral ())
return rpcError (rpcINVALID_PARAMS);
- int iDifficulty = jvRequest["difficulty"].asInt ();
+ int iDifficulty = params["difficulty"].asInt ();
if (iDifficulty < 0 || iDifficulty > ProofOfWork::sMaxDifficulty)
return rpcError (rpcINVALID_PARAMS);
@@ -930,9 +926,9 @@ Json::Value RPCHandler::doProofCreate (Json::Value jvRequest, int& cost, ScopedL
pgGen->setDifficulty (iDifficulty);
}
- if (jvRequest.isMember ("secret"))
+ if (params.isMember ("secret"))
{
- uint256 uSecret (jvRequest["secret"].asString ());
+ uint256 uSecret (params["secret"].asString ());
pgGen->setSecret (uSecret);
}
@@ -950,16 +946,16 @@ Json::Value RPCHandler::doProofCreate (Json::Value jvRequest, int& cost, ScopedL
// {
// token:
// }
-Json::Value RPCHandler::doProofSolve (Json::Value jvRequest, int& cost, ScopedLock& MasterLockHolder)
+Json::Value RPCHandler::doProofSolve (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
{
MasterLockHolder.unlock ();
Json::Value jvResult;
- if (!jvRequest.isMember ("token"))
+ if (!params.isMember ("token"))
return rpcError (rpcINVALID_PARAMS);
- std::string strToken = jvRequest["token"].asString ();
+ std::string strToken = params["token"].asString ();
if (!ProofOfWork::validateToken (strToken))
return rpcError (rpcINVALID_PARAMS);
@@ -980,35 +976,35 @@ Json::Value RPCHandler::doProofSolve (Json::Value jvRequest, int& cost, ScopedLo
// difficulty: // optional
// secret: // optional
// }
-Json::Value RPCHandler::doProofVerify (Json::Value jvRequest, int& cost, ScopedLock& MasterLockHolder)
+Json::Value RPCHandler::doProofVerify (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
{
MasterLockHolder.unlock ();
// XXX Add ability to check proof against arbitrary time
Json::Value jvResult;
- if (!jvRequest.isMember ("token"))
+ if (!params.isMember ("token"))
return rpcError (rpcINVALID_PARAMS);
- if (!jvRequest.isMember ("solution"))
+ if (!params.isMember ("solution"))
return rpcError (rpcINVALID_PARAMS);
- std::string strToken = jvRequest["token"].asString ();
- uint256 uSolution (jvRequest["solution"].asString ());
+ std::string strToken = params["token"].asString ();
+ uint256 uSolution (params["solution"].asString ());
POWResult prResult;
- if (jvRequest.isMember ("difficulty") || jvRequest.isMember ("secret"))
+ if (params.isMember ("difficulty") || params.isMember ("secret"))
{
// VFALCO TODO why aren't we using the app's factory?
beast::ScopedPointer pgGen (IProofOfWorkFactory::New ());
- if (jvRequest.isMember ("difficulty"))
+ if (params.isMember ("difficulty"))
{
- if (!jvRequest["difficulty"].isIntegral ())
+ if (!params["difficulty"].isIntegral ())
return rpcError (rpcINVALID_PARAMS);
- int iDifficulty = jvRequest["difficulty"].asInt ();
+ int iDifficulty = params["difficulty"].asInt ();
if (iDifficulty < 0 || iDifficulty > ProofOfWork::sMaxDifficulty)
return rpcError (rpcINVALID_PARAMS);
@@ -1016,9 +1012,9 @@ Json::Value RPCHandler::doProofVerify (Json::Value jvRequest, int& cost, ScopedL
pgGen->setDifficulty (iDifficulty);
}
- if (jvRequest.isMember ("secret"))
+ if (params.isMember ("secret"))
{
- uint256 uSecret (jvRequest["secret"].asString ());
+ uint256 uSecret (params["secret"].asString ());
pgGen->setSecret (uSecret);
}
@@ -1050,10 +1046,10 @@ Json::Value RPCHandler::doProofVerify (Json::Value jvRequest, int& cost, ScopedL
// ledger_hash :
// ledger_index :
// }
-Json::Value RPCHandler::doAccountLines (Json::Value jvRequest, int& cost, ScopedLock& MasterLockHolder)
+Json::Value RPCHandler::doAccountLines (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
{
Ledger::pointer lpLedger;
- Json::Value jvResult = lookupLedger (jvRequest, lpLedger);
+ Json::Value jvResult = lookupLedger (params, lpLedger);
if (!lpLedger)
return jvResult;
@@ -1066,12 +1062,12 @@ Json::Value RPCHandler::doAccountLines (Json::Value jvRequest, int& cost, Scoped
bUnlocked = true;
}
- if (!jvRequest.isMember ("account"))
+ if (!params.isMember ("account"))
return rpcError (rpcINVALID_PARAMS);
- std::string strIdent = jvRequest["account"].asString ();
- bool bIndex = jvRequest.isMember ("account_index");
- int iIndex = bIndex ? jvRequest["account_index"].asUInt () : 0;
+ std::string strIdent = params["account"].asString ();
+ bool bIndex = params.isMember ("account_index");
+ int iIndex = bIndex ? params["account_index"].asUInt () : 0;
RippleAddress raAccount;
@@ -1080,9 +1076,9 @@ Json::Value RPCHandler::doAccountLines (Json::Value jvRequest, int& cost, Scoped
if (!jvResult.empty ())
return jvResult;
- std::string strPeer = jvRequest.isMember ("peer") ? jvRequest["peer"].asString () : "";
- bool bPeerIndex = jvRequest.isMember ("peer_index");
- int iPeerIndex = bIndex ? jvRequest["peer_index"].asUInt () : 0;
+ std::string strPeer = params.isMember ("peer") ? params["peer"].asString () : "";
+ bool bPeerIndex = params.isMember ("peer_index");
+ int iPeerIndex = bIndex ? params["peer_index"].asUInt () : 0;
RippleAddress raPeer;
@@ -1172,10 +1168,10 @@ static void offerAdder (Json::Value& jvLines, SLE::ref offer)
// ledger_hash :
// ledger_index :
// }
-Json::Value RPCHandler::doAccountOffers (Json::Value jvRequest, int& cost, ScopedLock& MasterLockHolder)
+Json::Value RPCHandler::doAccountOffers (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
{
Ledger::pointer lpLedger;
- Json::Value jvResult = lookupLedger (jvRequest, lpLedger);
+ Json::Value jvResult = lookupLedger (params, lpLedger);
if (!lpLedger)
return jvResult;
@@ -1188,12 +1184,12 @@ Json::Value RPCHandler::doAccountOffers (Json::Value jvRequest, int& cost, Scope
bUnlocked = true;
}
- if (!jvRequest.isMember ("account"))
+ if (!params.isMember ("account"))
return rpcError (rpcINVALID_PARAMS);
- std::string strIdent = jvRequest["account"].asString ();
- bool bIndex = jvRequest.isMember ("account_index");
- int iIndex = bIndex ? jvRequest["account_index"].asUInt () : 0;
+ std::string strIdent = params["account"].asString ();
+ bool bIndex = params.isMember ("account_index");
+ int iIndex = bIndex ? params["account_index"].asUInt () : 0;
RippleAddress raAccount;
@@ -1240,7 +1236,7 @@ Json::Value RPCHandler::doAccountOffers (Json::Value jvRequest, int& cost, Scope
// "limit" : integer, // Optional.
// "proof" : boolean // Defaults to false.
// }
-Json::Value RPCHandler::doBookOffers (Json::Value jvRequest, int& cost, ScopedLock& MasterLockHolder)
+Json::Value RPCHandler::doBookOffers (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
{
if (theApp->getJobQueue ().getJobCountGE (jtCLIENT) > 200)
{
@@ -1248,7 +1244,7 @@ Json::Value RPCHandler::doBookOffers (Json::Value jvRequest, int& cost, ScopedLo
}
Ledger::pointer lpLedger;
- Json::Value jvResult = lookupLedger (jvRequest, lpLedger);
+ Json::Value jvResult = lookupLedger (params, lpLedger);
if (!lpLedger)
return jvResult;
@@ -1256,12 +1252,12 @@ Json::Value RPCHandler::doBookOffers (Json::Value jvRequest, int& cost, ScopedLo
if (lpLedger->isImmutable ())
MasterLockHolder.unlock ();
- if (!jvRequest.isMember ("taker_pays") || !jvRequest.isMember ("taker_gets") || !jvRequest["taker_pays"].isObject () || !jvRequest["taker_gets"].isObject ())
+ if (!params.isMember ("taker_pays") || !params.isMember ("taker_gets") || !params["taker_pays"].isObject () || !params["taker_gets"].isObject ())
return rpcError (rpcINVALID_PARAMS);
uint160 uTakerPaysCurrencyID;
uint160 uTakerPaysIssuerID;
- const Json::Value& jvTakerPays = jvRequest["taker_pays"];
+ const Json::Value& jvTakerPays = params["taker_pays"];
// Parse mandatory currency.
if (!jvTakerPays.isMember ("currency")
@@ -1286,7 +1282,7 @@ Json::Value RPCHandler::doBookOffers (Json::Value jvRequest, int& cost, ScopedLo
uint160 uTakerGetsCurrencyID;
uint160 uTakerGetsIssuerID;
- const Json::Value& jvTakerGets = jvRequest["taker_gets"];
+ const Json::Value& jvTakerGets = params["taker_gets"];
// Parse mandatory currency.
if (!jvTakerGets.isMember ("currency")
@@ -1319,18 +1315,18 @@ Json::Value RPCHandler::doBookOffers (Json::Value jvRequest, int& cost, ScopedLo
RippleAddress raTakerID;
- if (!jvRequest.isMember ("taker"))
+ if (!params.isMember ("taker"))
{
raTakerID.setAccountID (ACCOUNT_ONE);
}
- else if (!raTakerID.setAccountID (jvRequest["taker"].asString ()))
+ else if (!raTakerID.setAccountID (params["taker"].asString ()))
{
return rpcError (rpcBAD_ISSUER);
}
- const bool bProof = jvRequest.isMember ("proof");
- const unsigned int iLimit = jvRequest.isMember ("limit") ? jvRequest["limit"].asUInt () : 0;
- const Json::Value jvMarker = jvRequest.isMember ("marker") ? jvRequest["marker"] : Json::Value (Json::nullValue);
+ const bool bProof = params.isMember ("proof");
+ const unsigned int iLimit = params.isMember ("limit") ? params["limit"].asUInt () : 0;
+ const Json::Value jvMarker = params.isMember ("marker") ? params["marker"] : Json::Value (Json::nullValue);
mNetOps->getBookPage (lpLedger, uTakerPaysCurrencyID, uTakerPaysIssuerID, uTakerGetsCurrencyID, uTakerGetsIssuerID, raTakerID.getAccountID (), bProof, iLimit, jvMarker, jvResult);
@@ -1341,7 +1337,7 @@ Json::Value RPCHandler::doBookOffers (Json::Value jvRequest, int& cost, ScopedLo
// {
// random:
// }
-Json::Value RPCHandler::doRandom (Json::Value jvRequest, int& cost, ScopedLock& MasterLockHolder)
+Json::Value RPCHandler::doRandom (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
{
MasterLockHolder.unlock ();
uint256 uRandom;
@@ -1362,21 +1358,21 @@ Json::Value RPCHandler::doRandom (Json::Value jvRequest, int& cost, ScopedLock&
}
}
-Json::Value RPCHandler::doPathFind (Json::Value jvRequest, int& cost, ScopedLock& MasterLockHolder)
+Json::Value RPCHandler::doPathFind (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
{
- if (!jvRequest.isMember ("subcommand") || !jvRequest["subcommand"].isString ())
+ if (!params.isMember ("subcommand") || !params["subcommand"].isString ())
return rpcError (rpcINVALID_PARAMS);
if (!mInfoSub)
return rpcError (rpcNO_EVENTS);
- std::string sSubCommand = jvRequest["subcommand"].asString ();
+ std::string sSubCommand = params["subcommand"].asString ();
if (sSubCommand == "create")
{
mInfoSub->clearPathRequest ();
PathRequest::pointer request = boost::make_shared (mInfoSub);
- Json::Value result = request->doCreate (mNetOps->getClosedLedger (), jvRequest);
+ Json::Value result = request->doCreate (mNetOps->getClosedLedger (), params);
if (request->isValid ())
{
@@ -1395,7 +1391,7 @@ Json::Value RPCHandler::doPathFind (Json::Value jvRequest, int& cost, ScopedLock
return rpcError (rpcNO_PF_REQUEST);
mInfoSub->clearPathRequest ();
- return request->doClose (jvRequest);
+ return request->doClose (params);
}
if (sSubCommand == "status")
@@ -1405,7 +1401,7 @@ Json::Value RPCHandler::doPathFind (Json::Value jvRequest, int& cost, ScopedLock
if (!request)
return rpcNO_PF_REQUEST;
- return request->doStatus (jvRequest);
+ return request->doStatus (params);
}
return rpcError (rpcINVALID_PARAMS);
@@ -1417,7 +1413,7 @@ Json::Value RPCHandler::doPathFind (Json::Value jvRequest, int& cost, ScopedLock
// - Allows clients to verify path exists.
// - Return canonicalized path.
// - From a trusted server, allows clients to use path without manipulation.
-Json::Value RPCHandler::doRipplePathFind (Json::Value jvRequest, int& cost, ScopedLock& MasterLockHolder)
+Json::Value RPCHandler::doRipplePathFind (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
{
int jc = theApp->getJobQueue ().getJobCountGE (jtCLIENT);
@@ -1431,33 +1427,33 @@ Json::Value RPCHandler::doRipplePathFind (Json::Value jvRequest, int& cost, Scop
RippleAddress raDst;
STAmount saDstAmount;
Ledger::pointer lpLedger;
- Json::Value jvResult = lookupLedger (jvRequest, lpLedger);
+ Json::Value jvResult = lookupLedger (params, lpLedger);
if (!lpLedger)
return jvResult;
- if (!jvRequest.isMember ("source_account"))
+ if (!params.isMember ("source_account"))
{
jvResult = rpcError (rpcSRC_ACT_MISSING);
}
- else if (!jvRequest["source_account"].isString ()
- || !raSrc.setAccountID (jvRequest["source_account"].asString ()))
+ else if (!params["source_account"].isString ()
+ || !raSrc.setAccountID (params["source_account"].asString ()))
{
jvResult = rpcError (rpcSRC_ACT_MALFORMED);
}
- else if (!jvRequest.isMember ("destination_account"))
+ else if (!params.isMember ("destination_account"))
{
jvResult = rpcError (rpcDST_ACT_MISSING);
}
- else if (!jvRequest["destination_account"].isString ()
- || !raDst.setAccountID (jvRequest["destination_account"].asString ()))
+ else if (!params["destination_account"].isString ()
+ || !raDst.setAccountID (params["destination_account"].asString ()))
{
jvResult = rpcError (rpcDST_ACT_MALFORMED);
}
else if (
// Parse saDstAmount.
- !jvRequest.isMember ("destination_amount")
- || !saDstAmount.bSetJson (jvRequest["destination_amount"])
+ !params.isMember ("destination_amount")
+ || !saDstAmount.bSetJson (params["destination_amount"])
|| (!!saDstAmount.getCurrency () && (!saDstAmount.getIssuer () || ACCOUNT_ONE == saDstAmount.getIssuer ())))
{
WriteLog (lsINFO, RPCHandler) << "Bad destination_amount.";
@@ -1465,9 +1461,9 @@ Json::Value RPCHandler::doRipplePathFind (Json::Value jvRequest, int& cost, Scop
}
else if (
// Checks on source_currencies.
- jvRequest.isMember ("source_currencies")
- && (!jvRequest["source_currencies"].isArray ()
- || !jvRequest["source_currencies"].size ()) // Don't allow empty currencies.
+ params.isMember ("source_currencies")
+ && (!params["source_currencies"].isArray ()
+ || !params["source_currencies"].size ()) // Don't allow empty currencies.
)
{
WriteLog (lsINFO, RPCHandler) << "Bad source_currencies.";
@@ -1477,9 +1473,9 @@ Json::Value RPCHandler::doRipplePathFind (Json::Value jvRequest, int& cost, Scop
{
Json::Value jvSrcCurrencies;
- if (jvRequest.isMember ("source_currencies"))
+ if (params.isMember ("source_currencies"))
{
- jvSrcCurrencies = jvRequest["source_currencies"];
+ jvSrcCurrencies = params["source_currencies"];
}
else
{
@@ -1497,7 +1493,7 @@ Json::Value RPCHandler::doRipplePathFind (Json::Value jvRequest, int& cost, Scop
}
}
- cost = rpcCOST_EXPENSIVE;
+ *loadType = LT_RPCBurden;
Ledger::pointer lSnapShot = boost::make_shared (boost::ref (*lpLedger), false);
MasterLockHolder.unlock (); // As long as we have a locked copy of the ledger, we can unlock.
@@ -1649,35 +1645,35 @@ Json::Value RPCHandler::doRipplePathFind (Json::Value jvRequest, int& cost, Scop
// tx_json: