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/rpcmining.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/rpcmining.cpp')
-rw-r--r-- | src/rpcmining.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 89e20526ed..76d90a3f7e 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -24,9 +24,8 @@ #include <boost/assign/list_of.hpp> -#include "json_spirit_wrapper.h" +#include "univalue/univalue.h" -using namespace json_spirit; using namespace std; /** @@ -71,7 +70,7 @@ UniValue GetNetworkHashPS(int lookup, int height) { return (int64_t)(workDiff.getdouble() / timeDiff); } -UniValue getnetworkhashps(const Array& params, bool fHelp) +UniValue getnetworkhashps(const UniValue& params, bool fHelp) { if (fHelp || params.size() > 2) throw runtime_error( @@ -94,7 +93,7 @@ UniValue getnetworkhashps(const Array& params, bool fHelp) } #ifdef ENABLE_WALLET -UniValue getgenerate(const Array& params, bool fHelp) +UniValue getgenerate(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( @@ -113,7 +112,7 @@ UniValue getgenerate(const Array& params, bool fHelp) return GetBoolArg("-gen", false); } -UniValue generate(const Array& params, bool fHelp) +UniValue generate(const UniValue& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 1) throw runtime_error( @@ -172,7 +171,7 @@ UniValue generate(const Array& params, bool fHelp) } -UniValue setgenerate(const Array& params, bool fHelp) +UniValue setgenerate(const UniValue& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( @@ -220,7 +219,7 @@ UniValue setgenerate(const Array& params, bool fHelp) #endif -UniValue getmininginfo(const Array& params, bool fHelp) +UniValue getmininginfo(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( @@ -266,7 +265,7 @@ UniValue getmininginfo(const Array& params, bool fHelp) // NOTE: Unlike wallet RPC (which use BTC values), mining RPCs follow GBT (BIP 22) in using satoshi amounts -UniValue prioritisetransaction(const Array& params, bool fHelp) +UniValue prioritisetransaction(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 3) throw runtime_error( @@ -301,7 +300,7 @@ UniValue prioritisetransaction(const Array& params, bool fHelp) static UniValue BIP22ValidationResult(const CValidationState& state) { if (state.IsValid()) - return Value::null; + return NullUniValue; std::string strRejectReason = state.GetRejectReason(); if (state.IsError()) @@ -316,7 +315,7 @@ static UniValue BIP22ValidationResult(const CValidationState& state) return "valid?"; } -UniValue getblocktemplate(const Array& params, bool fHelp) +UniValue getblocktemplate(const UniValue& params, bool fHelp) { if (fHelp || params.size() > 1) throw runtime_error( @@ -384,8 +383,8 @@ UniValue getblocktemplate(const Array& params, bool fHelp) UniValue lpval = NullUniValue; if (params.size() > 0) { - const Object& oparam = params[0].get_obj(); - const Value& modeval = find_value(oparam, "mode"); + const UniValue& oparam = params[0].get_obj(); + const UniValue& modeval = find_value(oparam, "mode"); if (modeval.isStr()) strMode = modeval.get_str(); else if (modeval.isNull()) @@ -398,7 +397,7 @@ UniValue getblocktemplate(const Array& params, bool fHelp) if (strMode == "proposal") { - const Value& dataval = find_value(oparam, "data"); + const UniValue& dataval = find_value(oparam, "data"); if (dataval.isStr()) throw JSONRPCError(RPC_TYPE_ERROR, "Missing data String key for proposal"); @@ -605,7 +604,7 @@ protected: }; }; -UniValue submitblock(const Array& params, bool fHelp) +UniValue submitblock(const UniValue& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( @@ -666,7 +665,7 @@ UniValue submitblock(const Array& params, bool fHelp) return BIP22ValidationResult(state); } -UniValue estimatefee(const Array& params, bool fHelp) +UniValue estimatefee(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( @@ -698,7 +697,7 @@ UniValue estimatefee(const Array& params, bool fHelp) return ValueFromAmount(feeRate.GetFeePerK()); } -UniValue estimatepriority(const Array& params, bool fHelp) +UniValue estimatepriority(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( |