remove JSON Spirit UniValue wrapper
This commit is contained in:
committed by
Jack Grigg
parent
565d26737a
commit
851f58f94e
@@ -138,7 +138,7 @@ CAmount AmountFromValue(const Value& value)
|
||||
return nAmount;
|
||||
}
|
||||
|
||||
Value ValueFromAmount(const CAmount& amount)
|
||||
UniValue ValueFromAmount(const CAmount& amount)
|
||||
{
|
||||
return (double)amount / (double)COIN;
|
||||
}
|
||||
@@ -199,7 +199,7 @@ string CRPCTable::help(string strCommand) const
|
||||
continue;
|
||||
try
|
||||
{
|
||||
Array params;
|
||||
UniValue params;
|
||||
rpcfn_type pfn = pcmd->actor;
|
||||
if (setDone.insert(pfn).second)
|
||||
(*pfn)(params, true);
|
||||
@@ -232,7 +232,7 @@ string CRPCTable::help(string strCommand) const
|
||||
return strRet;
|
||||
}
|
||||
|
||||
Value help(const Array& params, bool fHelp)
|
||||
UniValue help(const Array& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() > 1)
|
||||
throw runtime_error(
|
||||
@@ -252,7 +252,7 @@ Value help(const Array& params, bool fHelp)
|
||||
}
|
||||
|
||||
|
||||
Value stop(const Array& params, bool fHelp)
|
||||
UniValue stop(const Array& params, bool fHelp)
|
||||
{
|
||||
// Accept the deprecated and ignored 'detach' boolean argument
|
||||
if (fHelp || params.size() > 1)
|
||||
@@ -863,9 +863,9 @@ void RPCRunLater(const std::string& name, boost::function<void(void)> func, int6
|
||||
class JSONRequest
|
||||
{
|
||||
public:
|
||||
Value id;
|
||||
UniValue id;
|
||||
string strMethod;
|
||||
Array params;
|
||||
UniValue params;
|
||||
|
||||
JSONRequest() { id = NullUniValue; }
|
||||
void parse(const Value& valRequest);
|
||||
@@ -882,7 +882,7 @@ void JSONRequest::parse(const Value& valRequest)
|
||||
id = find_value(request, "id");
|
||||
|
||||
// Parse method
|
||||
Value valMethod = find_value(request, "method");
|
||||
UniValue valMethod = find_value(request, "method");
|
||||
if (valMethod.isNull())
|
||||
throw JSONRPCError(RPC_INVALID_REQUEST, "Missing method");
|
||||
if (!valMethod.isStr())
|
||||
@@ -892,7 +892,7 @@ void JSONRequest::parse(const Value& valRequest)
|
||||
LogPrint("rpc", "ThreadRPCServer method=%s\n", SanitizeString(strMethod));
|
||||
|
||||
// Parse params
|
||||
Value valParams = find_value(request, "params");
|
||||
UniValue valParams = find_value(request, "params");
|
||||
if (valParams.isArray())
|
||||
params = valParams.get_array();
|
||||
else if (valParams.isNull())
|
||||
@@ -902,7 +902,7 @@ void JSONRequest::parse(const Value& valRequest)
|
||||
}
|
||||
|
||||
|
||||
static Object JSONRPCExecOne(const Value& req)
|
||||
static UniValue JSONRPCExecOne(const Value& req)
|
||||
{
|
||||
UniValue rpc_result(UniValue::VOBJ);
|
||||
|
||||
@@ -910,7 +910,7 @@ static Object JSONRPCExecOne(const Value& req)
|
||||
try {
|
||||
jreq.parse(req);
|
||||
|
||||
Value result = tableRPC.execute(jreq.strMethod, jreq.params);
|
||||
UniValue result = tableRPC.execute(jreq.strMethod, jreq.params);
|
||||
rpc_result = JSONRPCReplyObj(result, NullUniValue, jreq.id);
|
||||
}
|
||||
catch (const Object& objError)
|
||||
@@ -928,7 +928,7 @@ static Object JSONRPCExecOne(const Value& req)
|
||||
|
||||
static string JSONRPCExecBatch(const Array& vReq)
|
||||
{
|
||||
Array ret;
|
||||
UniValue ret;
|
||||
for (unsigned int reqIdx = 0; reqIdx < vReq.size(); reqIdx++)
|
||||
ret.push_back(JSONRPCExecOne(vReq[reqIdx]));
|
||||
|
||||
@@ -963,7 +963,7 @@ static bool HTTPReq_JSONRPC(AcceptedConnection *conn,
|
||||
try
|
||||
{
|
||||
// Parse request
|
||||
Value valRequest;
|
||||
UniValue valRequest;
|
||||
if (!valRequest.read(strRequest))
|
||||
throw JSONRPCError(RPC_PARSE_ERROR, "Parse error");
|
||||
|
||||
@@ -980,7 +980,7 @@ static bool HTTPReq_JSONRPC(AcceptedConnection *conn,
|
||||
if (valRequest.isObject()) {
|
||||
jreq.parse(valRequest);
|
||||
|
||||
Value result = tableRPC.execute(jreq.strMethod, jreq.params);
|
||||
UniValue result = tableRPC.execute(jreq.strMethod, jreq.params);
|
||||
|
||||
// Send reply
|
||||
strReply = JSONRPCReply(result, NullUniValue, jreq.id);
|
||||
@@ -1049,7 +1049,7 @@ void ServiceConnection(AcceptedConnection *conn)
|
||||
}
|
||||
}
|
||||
|
||||
json_spirit::Value CRPCTable::execute(const std::string &strMethod, const json_spirit::Array ¶ms) const
|
||||
UniValue CRPCTable::execute(const std::string &strMethod, const UniValue ¶ms) const
|
||||
{
|
||||
// Find method
|
||||
const CRPCCommand *pcmd = tableRPC[strMethod];
|
||||
|
||||
Reference in New Issue
Block a user