diff options
author | Jonas Schnelli <jonas.schnelli@include7.ch> | 2015-05-18 14:02:18 +0200 |
---|---|---|
committer | Jonas Schnelli <jonas.schnelli@include7.ch> | 2015-06-04 09:16:21 +0200 |
commit | 9a8897f4ac992741e153d88b54bd2cde877c713d (patch) | |
tree | e827981679708bae6bef1516d69efda3524b719f /src/bitcoin-cli.cpp | |
parent | 3df0411ad9fd75fb27af53e44835d41f5480fe3f (diff) |
Remove JSON Spirit wrapper, remove JSON Spirit leftovers
- implement find_value() function for UniValue
- replace all Array/Value/Object types with UniValues, remove JSON Spirit to UniValue wrapper
- remove JSON Spirit sources
Diffstat (limited to 'src/bitcoin-cli.cpp')
-rw-r--r-- | src/bitcoin-cli.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 0cafd2b0b4..d451720141 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -12,8 +12,9 @@ #include <boost/filesystem/operations.hpp> +#include "univalue/univalue.h" + using namespace std; -using namespace json_spirit; std::string HelpMessageCli() { @@ -94,7 +95,7 @@ static bool AppInitRPC(int argc, char* argv[]) return true; } -UniValue CallRPC(const string& strMethod, const Array& params) +UniValue CallRPC(const string& strMethod, const UniValue& params) { if (mapArgs["-rpcuser"] == "" && mapArgs["-rpcpassword"] == "") throw runtime_error(strprintf( @@ -145,7 +146,7 @@ UniValue CallRPC(const string& strMethod, const Array& params) UniValue valReply(UniValue::VSTR); if (!valReply.read(strReply)) throw runtime_error("couldn't parse reply from server"); - const Object& reply = valReply.get_obj(); + const UniValue& reply = valReply.get_obj(); if (reply.empty()) throw runtime_error("expected reply to have result, error and id properties"); @@ -179,13 +180,15 @@ int CommandLineRPC(int argc, char *argv[]) const UniValue reply = CallRPC(strMethod, params); // Parse reply - const Value& result = find_value(reply, "result"); - const Value& error = find_value(reply, "error"); + const UniValue& result = find_value(reply, "result"); + const UniValue& error = find_value(reply, "error"); if (!error.isNull()) { // Error - strPrint = "error: " + error.write(); int code = error["code"].get_int(); + if (fWait && code == RPC_IN_WARMUP) + throw CConnectionFailed("server in warmup"); + strPrint = "error: " + error.write(); nRet = abs(code); } else { // Result |